MDL-44246 behat: New mod_quiz test when JS is disabled

Also including a modification in behat_question_base
to make the internal method work with both JS and non-JS.
This commit is contained in:
David Monllao
2014-03-11 17:10:03 +08:00
committed by Marina Glancy
parent 5a22864234
commit 0176d12dd6
2 changed files with 12 additions and 7 deletions

View File

@@ -40,7 +40,10 @@ Feature: Add a quiz
And I press "Next"
And I should see "Answer saved"
And I press "Submit all and finish"
And I press "Yes"
@javascript
Scenario: Add and configure small quiz and perform an attempt as a student with Javascript enabled
Then I click on "Yes" "button" in the "Confirmation" "dialogue"
And I should see "So you think it is true"
And I should see "Thank you, this is the general feedback"
And I should see "The correct answer is 'False'."
@@ -48,5 +51,10 @@ Feature: Add a quiz
And I should see "Highest grade: 0.00 / 10.00."
And I log out
@javascript
Scenario: Add and configure small quiz and perform an attempt as a student with Javascript enabled
Scenario: Add and configure small quiz and perform an attempt as a student with Javascript disabled
Then I should see "So you think it is true"
And I should see "Thank you, this is the general feedback"
And I should see "The correct answer is 'False'."
And I follow "Finish review"
And I should see "Highest grade: 0.00 / 10.00."
And I log out

View File

@@ -51,12 +51,9 @@ class behat_question_base extends behat_base {
* @return Given[] the steps.
*/
protected function finish_adding_question($questiontypename, TableNode $questiondata) {
$questiontypename = $this->getSession()->getSelectorsHandler()->xpathLiteral($questiontypename);
$questiontypexpath = "//span[@class='qtypename'][normalize-space(.)=$questiontypename]" .
"/ancestor::div[@class='qtypeoption']/descendant::input";
return array(
new Given('I click on "' . $this->escape($questiontypexpath) . '" "xpath_element"'),
new Given('I set the field "' . $this->escape($questiontypename) . '" to "1"'),
new Given('I click on "#chooseqtype_submit" "css_element"'),
new Given('I set the following fields to these values:', $questiondata),
new Given('I press "id_submitbutton"')