MDL-52964 Qtype: Add behat tests to core question types
[moodle.git] / question / type / multichoice / tests / behat / preview.feature
blob10563c3b05e4017676dcdadb4844bdead7540469
1 @qtype @qtype_multichoice
2 Feature: Preview a Multiple choice question
3   As a teacher
4   In order to check my Multiple choice questions will work for students
5   I need to preview them
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email               |
10       | teacher1 | T1        | Teacher1 | teacher1@moodle.com |
11     And the following "courses" exist:
12       | fullname | shortname | category |
13       | Course 1 | C1        | 0        |
14     And the following "course enrolments" exist:
15       | user     | course | role           |
16       | teacher1 | C1     | editingteacher |
17     And the following "question categories" exist:
18       | contextlevel | reference | name           |
19       | Course       | C1        | Test questions |
20     And the following "questions" exist:
21       | questioncategory | qtype       | name             | template    |
22       | Test questions   | multichoice | Multi-choice-001 | two_of_four |
23       | Test questions   | multichoice | Multi-choice-002 | one_of_four |
24     Given I log in as "teacher1"
25     And I follow "Course 1"
26     And I navigate to "Question bank" node in "Course administration"
28   @javascript
29   Scenario: Preview a question and submit a partially correct response.
30     When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
31     And I switch to "questionpreview" window
32     And I set the field "How questions behave" to "Immediate feedback"
33     And I press "Start again with these options"
34     And I click on "One" "checkbox"
35     And I click on "Two" "checkbox"
36     And I press "Check"
37     Then I should see "One is odd"
38     And I should see "Two is even"
39     And I should see "Mark 0.50 out of 1.00"
40     And I should see "Parts, but only parts, of your response are correct."
41     And I switch to the main window
43   @javascript
44   Scenario: Preview a question and submit a correct response.
45     When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
46     And I switch to "questionpreview" window
47     And I set the field "How questions behave" to "Immediate feedback"
48     And I press "Start again with these options"
49     And I click on "One" "checkbox"
50     And I click on "Three" "checkbox"
51     And I press "Check"
52     Then I should see "One is odd"
53     And I should see "Three is odd"
54     And I should see "Mark 1.00 out of 1.00"
55     And I should see "Well done!"
56     And I should see "The odd numbers are One and Three."
57     And I should see "The correct answer is: One, Three"
58     And I switch to the main window
60   @javascript
61   Scenario: Preview a question and submit a correct response.
62     When I click on "Preview" "link" in the "Multi-choice-002" "table_row"
63     And I switch to "questionpreview" window
64     And I set the field "How questions behave" to "Immediate feedback"
65     And I press "Start again with these options"
66     And I click on "One" "radio"
67     And I press "Check"
68     Then I should see "The oddest number is One."
69     And I should see "Mark 1.00 out of 1.00"
70     And I should see "Well done!"
71     And I should see "The correct answer is: One"
72     And I switch to the main window