1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Attempt a quiz
|
|
|
3 |
As a student
|
|
|
4 |
In order to demonstrate what I know
|
|
|
5 |
I need to be able to attempt quizzes
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student | Student | One | student@example.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 |
| student | C1 | student |
|
|
|
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 | questiontext |
|
|
|
22 |
| Test questions | truefalse | TF1 | First question |
|
|
|
23 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
24 |
| Test questions | truefalse | TF3 | Third question |
|
|
|
25 |
| Test questions | truefalse | TF4 | Fourth question |
|
|
|
26 |
| Test questions | truefalse | TF5 | Fifth question |
|
|
|
27 |
| Test questions | truefalse | TF6 | Sixth question |
|
|
|
28 |
And the following "activities" exist:
|
|
|
29 |
| activity | name | intro | course | idnumber | grade | navmethod |
|
|
|
30 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | 100 | free |
|
|
|
31 |
| quiz | Quiz 2 | Quiz 2 description | C1 | quiz2 | 6 | free |
|
|
|
32 |
| quiz | Quiz 3 | Quiz 3 description | C1 | quiz3 | 100 | free |
|
|
|
33 |
| quiz | Quiz 4 | Quiz 4 description | C1 | quiz4 | 100 | sequential |
|
|
|
34 |
And quiz "Quiz 1" contains the following questions:
|
|
|
35 |
| question | page | maxmark |
|
|
|
36 |
| TF1 | 1 | |
|
|
|
37 |
| TF2 | 1 | 3.0 |
|
|
|
38 |
And quiz "Quiz 2" contains the following questions:
|
|
|
39 |
| question | page |
|
|
|
40 |
| TF1 | 1 |
|
|
|
41 |
| TF2 | 1 |
|
|
|
42 |
| TF3 | 2 |
|
|
|
43 |
| TF4 | 3 |
|
|
|
44 |
| TF5 | 4 |
|
|
|
45 |
| TF6 | 4 |
|
|
|
46 |
And quiz "Quiz 2" contains the following sections:
|
|
|
47 |
| heading | firstslot | shuffle |
|
|
|
48 |
| Section 1 | 1 | 0 |
|
|
|
49 |
| Section 2 | 3 | 0 |
|
|
|
50 |
| | 4 | 1 |
|
|
|
51 |
| Section 3 | 5 | 1 |
|
|
|
52 |
And quiz "Quiz 3" contains the following questions:
|
|
|
53 |
| question | page |
|
|
|
54 |
| TF1 | 1 |
|
|
|
55 |
| TF2 | 2 |
|
|
|
56 |
And quiz "Quiz 4" contains the following questions:
|
|
|
57 |
| question | page |
|
|
|
58 |
| TF1 | 1 |
|
|
|
59 |
| TF2 | 2 |
|
|
|
60 |
|
|
|
61 |
@javascript
|
|
|
62 |
Scenario: Attempt a quiz with a single unnamed section, review and re-attempt
|
|
|
63 |
Given user "student" has attempted "Quiz 1" with responses:
|
|
|
64 |
| slot | response |
|
|
|
65 |
| 1 | True |
|
|
|
66 |
| 2 | False |
|
|
|
67 |
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
|
|
68 |
And I follow "Review"
|
|
|
69 |
And I should see "Status"
|
|
|
70 |
Then I should see "Started"
|
|
|
71 |
And I should see "Completed"
|
|
|
72 |
And I should see "Duration"
|
|
|
73 |
And I should see "Marks"
|
|
|
74 |
And I should see "Grade"
|
|
|
75 |
And I should see "25.00 out of 100.00"
|
|
|
76 |
And I follow "Finish review"
|
|
|
77 |
And I press "Re-attempt quiz"
|
|
|
78 |
|
|
|
79 |
@javascript
|
|
|
80 |
Scenario: Attempt a quiz with multiple sections
|
|
|
81 |
Given I am on the "Quiz 2" "mod_quiz > View" page logged in as "student"
|
|
|
82 |
When I press "Attempt quiz"
|
|
|
83 |
|
|
|
84 |
Then I should see "Section 1" in the "Quiz navigation" "block"
|
|
|
85 |
And I should see question "1" in section "Section 1" in the quiz navigation
|
|
|
86 |
And I should see question "2" in section "Section 1" in the quiz navigation
|
|
|
87 |
And I should see question "3" in section "Section 2" in the quiz navigation
|
|
|
88 |
And I should see question "4" in section "Untitled section" in the quiz navigation
|
|
|
89 |
And I should see question "5" in section "Section 3" in the quiz navigation
|
|
|
90 |
And I should see question "6" in section "Section 3" in the quiz navigation
|
|
|
91 |
And I click on "True" "radio" in the "First question" "question"
|
|
|
92 |
|
|
|
93 |
And I follow "Finish attempt ..."
|
|
|
94 |
And I should see question "1" in section "Section 1" in the quiz navigation
|
|
|
95 |
And I should see question "2" in section "Section 1" in the quiz navigation
|
|
|
96 |
And I should see question "3" in section "Section 2" in the quiz navigation
|
|
|
97 |
And I should see question "4" in section "Untitled section" in the quiz navigation
|
|
|
98 |
And I should see question "5" in section "Section 3" in the quiz navigation
|
|
|
99 |
And I should see question "6" in section "Section 3" in the quiz navigation
|
|
|
100 |
And I should see "Section 1" in the "quizsummaryofattempt" "table"
|
|
|
101 |
And I should see "Section 2" in the "quizsummaryofattempt" "table"
|
|
|
102 |
And I should see "Untitled section" in the "quizsummaryofattempt" "table"
|
|
|
103 |
And I should see "Section 3" in the "quizsummaryofattempt" "table"
|
|
|
104 |
|
|
|
105 |
And I press "Submit all and finish"
|
|
|
106 |
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
|
|
107 |
And I should see "1.00 out of 6.00 (16.67%)" in the "Grade" "table_row"
|
|
|
108 |
And I should see question "1" in section "Section 1" in the quiz navigation
|
|
|
109 |
And I should see question "2" in section "Section 1" in the quiz navigation
|
|
|
110 |
And I should see question "3" in section "Section 2" in the quiz navigation
|
|
|
111 |
And I should see question "4" in section "Untitled section" in the quiz navigation
|
|
|
112 |
And I should see question "5" in section "Section 3" in the quiz navigation
|
|
|
113 |
And I should see question "6" in section "Section 3" in the quiz navigation
|
|
|
114 |
|
|
|
115 |
And I follow "Show one page at a time"
|
|
|
116 |
And I should see "First question"
|
|
|
117 |
And I should not see "Third question"
|
|
|
118 |
And I should see "Next page"
|
|
|
119 |
|
|
|
120 |
And I follow "Show all questions on one page"
|
|
|
121 |
And I should see "Fourth question"
|
|
|
122 |
And I should see "Sixth question"
|
|
|
123 |
And I should not see "Next page"
|
|
|
124 |
|
|
|
125 |
@javascript
|
|
|
126 |
Scenario: Next and previous navigation
|
|
|
127 |
Given I am on the "Quiz 3" "mod_quiz > View" page logged in as "student"
|
|
|
128 |
When I press "Attempt quiz"
|
|
|
129 |
Then I should see "First question"
|
|
|
130 |
And I should not see "Second question"
|
|
|
131 |
And I press "Next page"
|
|
|
132 |
And I should see "Second question"
|
|
|
133 |
And I should not see "First question"
|
|
|
134 |
And I click on "Finish attempt ..." "button" in the "region-main" "region"
|
|
|
135 |
And I should see "Summary of attempt"
|
|
|
136 |
And I press "Return to attempt"
|
|
|
137 |
And I should see "Second question"
|
|
|
138 |
And I should not see "First question"
|
|
|
139 |
And I press "Previous page"
|
|
|
140 |
And I should see "First question"
|
|
|
141 |
And I should not see "Second question"
|
|
|
142 |
And I follow "Finish attempt ..."
|
|
|
143 |
And I press "Submit all and finish"
|
|
|
144 |
And I should see "Once you submit your answers, you won’t be able to change them." in the "Submit all your answers and finish?" "dialogue"
|
|
|
145 |
And I should see "Questions without a response: 2" in the "Submit all your answers and finish?" "dialogue"
|
|
|
146 |
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
|
|
147 |
And I should see "0.00 out of 100.00" in the "Grade" "table_row"
|
|
|
148 |
And I should see "First question"
|
|
|
149 |
And I should see "Second question"
|
|
|
150 |
And I follow "Show one page at a time"
|
|
|
151 |
And I should see "0.00 out of 100.00" in the "Grade" "table_row"
|
|
|
152 |
And I should see "First question"
|
|
|
153 |
And I should not see "Second question"
|
|
|
154 |
And I follow "Next page"
|
|
|
155 |
And "Grade" "table_row" should not exist
|
|
|
156 |
And I should see "Second question"
|
|
|
157 |
And I should not see "First question"
|
|
|
158 |
And I follow "Previous page"
|
|
|
159 |
And I should see "0.00 out of 100.00" in the "Grade" "table_row"
|
|
|
160 |
And I should see "First question"
|
|
|
161 |
And I should not see "Second question"
|
|
|
162 |
|
|
|
163 |
@javascript
|
|
|
164 |
Scenario: Next and previous with sequential navigation method
|
|
|
165 |
Given I am on the "Quiz 4" "mod_quiz > View" page logged in as "student"
|
|
|
166 |
When I press "Attempt quiz"
|
|
|
167 |
Then I should see "First question"
|
|
|
168 |
And I should not see "Second question"
|
|
|
169 |
And I press "Next page"
|
|
|
170 |
And I should see "Second question"
|
|
|
171 |
And I should not see "First question"
|
|
|
172 |
And "Previous page" "button" should not exist
|
|
|
173 |
And I click on "Finish attempt ..." "button" in the "region-main" "region"
|
|
|
174 |
And I should see "Summary of attempt"
|
|
|
175 |
And I press "Submit all and finish"
|
|
|
176 |
And I should see "Once you submit your answers, you won’t be able to change them." in the "Submit all your answers and finish?" "dialogue"
|
|
|
177 |
And I should not see "Questions without a response: 2" in the "Submit all your answers and finish?" "dialogue"
|
|
|
178 |
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
|
|
179 |
And I should see "First question"
|
|
|
180 |
And I should see "Second question"
|
|
|
181 |
And I follow "Show one page at a time"
|
|
|
182 |
And I should see "First question"
|
|
|
183 |
And I should not see "Second question"
|
|
|
184 |
And I follow "Next page"
|
|
|
185 |
And I should see "Second question"
|
|
|
186 |
And I should not see "First question"
|
|
|
187 |
And I follow "Previous page"
|
|
|
188 |
And I should see "First question"
|
|
|
189 |
And I should not see "Second question"
|
|
|
190 |
|
|
|
191 |
@javascript
|
|
|
192 |
Scenario: Take a quiz with number of attempts set
|
|
|
193 |
Given the following "activities" exist:
|
|
|
194 |
| activity | name | course | grade | navmethod | attempts |
|
|
|
195 |
| quiz | Quiz 5 | C1 | 100 | free | 2 |
|
|
|
196 |
And the following "questions" exist:
|
|
|
197 |
| questioncategory | qtype | name | questiontext |
|
|
|
198 |
| Test questions | truefalse | TF7 | First question |
|
|
|
199 |
And quiz "Quiz 5" contains the following questions:
|
|
|
200 |
| question | page |
|
|
|
201 |
| TF7 | 1 |
|
|
|
202 |
And user "student" has attempted "Quiz 5" with responses:
|
|
|
203 |
| slot | response |
|
|
|
204 |
| 1 | True |
|
|
|
205 |
When I am on the "Quiz 5" "mod_quiz > View" page logged in as "student"
|
|
|
206 |
Then I should see "Attempts allowed: 2"
|
|
|
207 |
And I should not see "No more attempts are allowed"
|
|
|
208 |
And I press "Re-attempt quiz"
|
|
|
209 |
And I should see "First question"
|
|
|
210 |
And I click on "Finish attempt ..." "button" in the "region-main" "region"
|
|
|
211 |
And I press "Submit all and finish"
|
|
|
212 |
And I should see "Once you submit your answers, you won’t be able to change them." in the "Submit all your answers and finish?" "dialogue"
|
|
|
213 |
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
|
|
214 |
And I follow "Finish review"
|
|
|
215 |
And I should not see "Re-attempt quiz"
|
|
|
216 |
And I should see "No more attempts are allowed"
|
|
|
217 |
|
|
|
218 |
@javascript
|
|
|
219 |
Scenario: Student still sees the same version after the question is edited.
|
|
|
220 |
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
|
|
221 |
And I press "Attempt quiz"
|
|
|
222 |
And I should see "First question"
|
|
|
223 |
And I click on "False" "radio" in the "First question" "question"
|
|
|
224 |
And I press "Finish attempt ..."
|
|
|
225 |
And I log out
|
|
|
226 |
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "admin"
|
|
|
227 |
And I press "Preview quiz"
|
|
|
228 |
And I click on "Edit question" "link" in the "First question" "question"
|
|
|
229 |
And I set the field "Question text" to "First question version 2"
|
|
|
230 |
And I press "id_submitbutton"
|
|
|
231 |
And I should see "v2 (latest)" in the "First question" "question"
|
|
|
232 |
And I log out
|
|
|
233 |
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
|
|
234 |
And I press "Continue your attempt"
|
|
|
235 |
Then I should see "First question"
|
|
|
236 |
And I should not see "First question version 2"
|