From c5a1015338798f69fba56f80fc530c659486716a Mon Sep 17 00:00:00 2001 From: David Monllao Date: Wed, 11 Dec 2013 17:02:46 +0800 Subject: [PATCH] MDL-42625 behat: Fixing ExpectationException::__construct() call Also adding an extra checking to the selector to ensure it is no updating the list of files. --- repository/tests/behat/behat_filepicker.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/repository/tests/behat/behat_filepicker.php b/repository/tests/behat/behat_filepicker.php index 8b2ed2d1ecd..dfebcfbe148 100644 --- a/repository/tests/behat/behat_filepicker.php +++ b/repository/tests/behat/behat_filepicker.php @@ -187,9 +187,16 @@ class behat_filepicker extends behat_files { */ public function i_should_see_elements_in_filemanager($elementscount, $filemanagerelement) { $filemanagernode = $this->get_filepicker_node($filemanagerelement); - $elements = $this->find_all('css', '.fp-content .fp-file', false, $filemanagernode); + + // We count .fp-file elements inside a filemanager not being updated. + $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' filemanager ')]" . + "[not(contains(concat(' ', normalize-space(@class), ' '), ' fm-updating '))]" . + "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]" . + "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-file ')]"; + + $elements = $this->find_all('xpath', $xpath, false, $filemanagernode); if (count($elements) != $elementscount) { - throw new ExpectationException('Found '.count($elements).' elements in filemanager instead of expected '.$elementscount); + throw new ExpectationException('Found '.count($elements).' elements in filemanager instead of expected '.$elementscount, $this->getSession()); } }