From 5ec684b3537159bc1cb1fedb38b7dfb5003d8d92 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 20 Aug 2014 18:53:46 +0100 Subject: [PATCH] MDL-46916 behat: improve question state test. --- question/tests/behat/behat_question.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/question/tests/behat/behat_question.php b/question/tests/behat/behat_question.php index 00e0e388448..caea254aaba 100644 --- a/question/tests/behat/behat_question.php +++ b/question/tests/behat/behat_question.php @@ -75,12 +75,12 @@ class behat_question extends behat_question_base { // Split in two checkings to give more feedback in case of exception. $exception = new ElementNotFoundException($this->getSession(), 'Question "' . $questiondescription . '" '); - $questionxpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' qtext ')][contains(., $questiondescriptionliteral)]"; + $questionxpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' que ')]" . + "[contains(div[@class='content']/div[@class='formulation'], {$questiondescriptionliteral})]"; $this->find('xpath', $questionxpath, $exception); $exception = new ExpectationException('Question "' . $questiondescription . '" state is not "' . $state . '"', $this->getSession()); - $xpath = $questionxpath . "/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' que ')]" . - "/descendant::div[@class='state'][contains(., $stateliteral)]"; + $xpath = $questionxpath . "/div[@class='info']/div[@class='state' and contains(., {$stateliteral})]"; $this->find('xpath', $xpath, $exception); } }