From 1adf21fc1dada7c2edcc9fd7e988566cfa964dd2 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 25 Nov 2016 08:37:35 +0800 Subject: [PATCH] MDL-57019 behat: corrections to the selectors, adding waiting --- grade/tests/behat/behat_grade.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grade/tests/behat/behat_grade.php b/grade/tests/behat/behat_grade.php index 9af6c4cf6c6..f81ae6ec102 100644 --- a/grade/tests/behat/behat_grade.php +++ b/grade/tests/behat/behat_grade.php @@ -274,17 +274,19 @@ class behat_grade extends behat_base { // If the first row of the grade-navigation tabs does not have $gradepath[0] as active tab, click on it. $link = '\'' . $this->escape($gradepath[0]) . '\''; - $xpathrow1 = $xpath . '//ul[1]//.[contains(@class,\'active\') and .=' . $link . ']'; + $xpathrow1 = $xpath . '//ul[1]//*[contains(@class,\'active\') and text()=' . $link . ']'; if (!$this->getSession()->getPage()->findAll('xpath', $xpathrow1)) { - $this->find('xpath', $xpath . '//ul[1]/li/a[.=' . $link . ']')->click(); + $this->find('xpath', $xpath . '//ul[1]/li/a[text()=' . $link . ']')->click(); + $this->wait_for_pending_js(); } if (isset($gradepath[1])) { // If the second row of the grade-navigation tabs does not have $gradepath[1] as active tab, click on it. $link = '\'' . $this->escape($gradepath[1]) . '\''; - $xpathrow2 = $xpath . '//ul[2]//.[contains(@class,\'active\') and .=' . $link . ']'; + $xpathrow2 = $xpath . '//ul[2]//*[contains(@class,\'active\') and text()=' . $link . ']'; if (!$this->getSession()->getPage()->findAll('xpath', $xpathrow2)) { - $this->find('xpath', $xpath . '//ul[2]/li/a[.=' . $link . ']')->click(); + $this->find('xpath', $xpath . '//ul[2]/li/a[text()=' . $link . ']')->click(); + $this->wait_for_pending_js(); } } }