MDL-46916 behat: improve question state test.

This commit is contained in:
Tim Hunt
2014-08-21 14:15:22 +01:00
parent b01092111c
commit 5ec684b353
+3 -3
View File
@@ -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);
}
}