2 Feature: Preview a Matching question
4 In order to check my Matching questions will work for students
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 |
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 | match | matching-001 | foursubq |
23 Given I log in as "teacher1"
24 And I follow "Course 1"
25 And I navigate to "Question bank" node in "Course administration"
28 Scenario: Preview a question and submit a correct response.
29 When I click on "Edit" "link" in the "matching-001" "table_row"
30 And I set the following fields to these values:
32 And I press "id_submitbutton"
33 When I click on "Preview" "link" in the "matching-001" "table_row"
34 And I switch to "questionpreview" window
35 And I set the field "How questions behave" to "Immediate feedback"
36 And I press "Start again with these options"
37 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "amphibian"
38 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "mammal"
39 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "amphibian"
41 Then I should see "Well done!"
42 And I should see "General feedback."
43 And I switch to the main window
46 Scenario: Preview a question and submit a partially correct response.
47 When I click on "Edit" "link" in the "matching-001" "table_row"
48 And I set the following fields to these values:
50 And I press "id_submitbutton"
51 When I click on "Preview" "link" in the "matching-001" "table_row"
52 And I switch to "questionpreview" window
53 And I set the field "How questions behave" to "Immediate feedback"
54 And I press "Start again with these options"
55 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "amphibian"
56 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "insect"
57 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "amphibian"
59 Then I should see "Parts, but only parts, of your response are correct."
60 And I should see "General feedback."
61 And I switch to the main window
64 Scenario: Preview a question and submit an incorrect response.
65 When I click on "Edit" "link" in the "matching-001" "table_row"
66 And I set the following fields to these values:
68 And I press "id_submitbutton"
69 When I click on "Preview" "link" in the "matching-001" "table_row"
70 And I switch to "questionpreview" window
71 And I set the field "How questions behave" to "Immediate feedback"
72 And I press "Start again with these options"
73 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "mammal"
74 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "insect"
75 And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "insect"
77 Then I should see "That is not right at all."
78 And I should see "General feedback."
79 And I switch to the main window