1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Edit quizzes where some questions require the previous one to have been completed
|
|
|
3 |
In order to create quizzes where later questions can only be seen after earlier ones are answered
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to configure this on the Edit quiz page
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | T1 | Teacher1 | teacher1@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 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
And the following "question categories" exist:
|
|
|
18 |
| contextlevel | reference | name |
|
|
|
19 |
| Course | C1 | Test questions |
|
|
|
20 |
And I log in as "teacher1"
|
|
|
21 |
|
|
|
22 |
@javascript
|
|
|
23 |
Scenario: The first question cannot depend on the previous (whatever is in the DB)
|
|
|
24 |
Given the following "activities" exist:
|
|
|
25 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
26 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
27 |
And the following "questions" exist:
|
|
|
28 |
| questioncategory | qtype | name | questiontext |
|
|
|
29 |
| Test questions | truefalse | TF1 | First question |
|
|
|
30 |
And quiz "Quiz 1" contains the following questions:
|
|
|
31 |
| question | page | requireprevious |
|
|
|
32 |
| TF1 | 1 | 1 |
|
|
|
33 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
34 |
Then "be attempted" "link" should not be visible
|
|
|
35 |
# The text "be attempted" is used as a relatively unique string in both the add and remove links.
|
|
|
36 |
|
|
|
37 |
@javascript
|
|
|
38 |
Scenario: If the second question depends on the first, that is shown
|
|
|
39 |
Given the following "activities" exist:
|
|
|
40 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
41 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
42 |
And the following "questions" exist:
|
|
|
43 |
| questioncategory | qtype | name | questiontext |
|
|
|
44 |
| Test questions | truefalse | TF1 | First question |
|
|
|
45 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
46 |
And quiz "Quiz 1" contains the following questions:
|
|
|
47 |
| question | page | requireprevious |
|
|
|
48 |
| TF1 | 1 | 0 |
|
|
|
49 |
| TF2 | 1 | 1 |
|
|
|
50 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
51 |
Then "This question cannot be attempted until the previous question has been completed." "link" should be visible
|
|
|
52 |
|
|
|
53 |
@javascript
|
|
|
54 |
Scenario: A question can depend on a random question
|
|
|
55 |
Given the following "activities" exist:
|
|
|
56 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
57 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
58 |
And the following "questions" exist:
|
|
|
59 |
| questioncategory | qtype | name | questiontext |
|
|
|
60 |
| Test questions | truefalse | TF1 | First question |
|
|
|
61 |
| Test questions | random | Random (Test questions) | 0 |
|
|
|
62 |
And quiz "Quiz 1" contains the following questions:
|
|
|
63 |
| question | page | requireprevious |
|
|
|
64 |
| Random (Test questions) | 1 | 0 |
|
|
|
65 |
| TF1 | 1 | 1 |
|
|
|
66 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
67 |
Then "This question cannot be attempted until the previous question has been completed." "link" should be visible
|
|
|
68 |
|
|
|
69 |
@javascript
|
|
|
70 |
Scenario: The second question can be set to depend on the first
|
|
|
71 |
Given the following "activities" exist:
|
|
|
72 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
73 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
74 |
And the following "questions" exist:
|
|
|
75 |
| questioncategory | qtype | name | questiontext |
|
|
|
76 |
| Test questions | truefalse | TF1 | First question |
|
|
|
77 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
78 |
| Test questions | truefalse | TF3 | Third question |
|
|
|
79 |
And quiz "Quiz 1" contains the following questions:
|
|
|
80 |
| question | page | requireprevious |
|
|
|
81 |
| TF1 | 1 | 0 |
|
|
|
82 |
| TF2 | 1 | 0 |
|
|
|
83 |
| TF3 | 1 | 0 |
|
|
|
84 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
85 |
When I follow "No restriction on when question 2 can be attempted • Click to change"
|
|
|
86 |
Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible
|
|
|
87 |
And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible
|
|
|
88 |
|
|
|
89 |
@javascript
|
|
|
90 |
Scenario: A question that did depend on the previous can be un-linked
|
|
|
91 |
Given the following "activities" exist:
|
|
|
92 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
93 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
94 |
And the following "questions" exist:
|
|
|
95 |
| questioncategory | qtype | name | questiontext |
|
|
|
96 |
| Test questions | truefalse | TF1 | First question |
|
|
|
97 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
98 |
| Test questions | truefalse | TF3 | Third question |
|
|
|
99 |
And quiz "Quiz 1" contains the following questions:
|
|
|
100 |
| question | page | requireprevious |
|
|
|
101 |
| TF1 | 1 | 0 |
|
|
|
102 |
| TF2 | 1 | 1 |
|
|
|
103 |
| TF3 | 1 | 1 |
|
|
|
104 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
105 |
When I follow "Question 3 cannot be attempted until the previous question 2 has been completed • Click to change"
|
|
|
106 |
Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible
|
|
|
107 |
And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible
|
|
|
108 |
|
|
|
109 |
@javascript
|
|
|
110 |
Scenario: Question dependency cannot apply to deferred feedback quizzes so UI is hidden
|
|
|
111 |
Given the following "activities" exist:
|
|
|
112 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
113 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | deferredfeedback |
|
|
|
114 |
And the following "questions" exist:
|
|
|
115 |
| questioncategory | qtype | name | questiontext |
|
|
|
116 |
| Test questions | truefalse | TF1 | First question |
|
|
|
117 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
118 |
| Test questions | random | Random (Test questions) | 0 |
|
|
|
119 |
And quiz "Quiz 1" contains the following questions:
|
|
|
120 |
| question | page | requireprevious |
|
|
|
121 |
| Random (Test questions) | 1 | 0 |
|
|
|
122 |
| TF1 | 1 | 1 |
|
|
|
123 |
| TF2 | 1 | 1 |
|
|
|
124 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
125 |
Then "be attempted" "link" in the "TF1" "list_item" should not be visible
|
|
|
126 |
Then "be attempted" "link" in the "TF2" "list_item" should not be visible
|
|
|
127 |
|
|
|
128 |
@javascript
|
|
|
129 |
Scenario: Question dependency cannot apply to questions in a shuffled section so UI is hidden
|
|
|
130 |
Given the following "activities" exist:
|
|
|
131 |
| activity | name | intro | course | idnumber | preferredbehaviour | questionsperpage |
|
|
|
132 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback | 2 |
|
|
|
133 |
And the following "questions" exist:
|
|
|
134 |
| questioncategory | qtype | name | questiontext |
|
|
|
135 |
| Test questions | truefalse | TF1 | First question |
|
|
|
136 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
137 |
And quiz "Quiz 1" contains the following questions:
|
|
|
138 |
| question | page | requireprevious |
|
|
|
139 |
| TF1 | 1 | 1 |
|
|
|
140 |
| TF2 | 1 | 1 |
|
|
|
141 |
And quiz "Quiz 1" contains the following sections:
|
|
|
142 |
| heading | firstslot | shuffle |
|
|
|
143 |
| Section 1 | 1 | 1 |
|
|
|
144 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
145 |
Then "be attempted" "link" in the "TF2" "list_item" should not be visible
|
|
|
146 |
|
|
|
147 |
@javascript
|
|
|
148 |
Scenario: Question dependency cannot apply to the first questions in section when the previous section is shuffled
|
|
|
149 |
Given the following "activities" exist:
|
|
|
150 |
| activity | name | intro | course | idnumber | preferredbehaviour | questionsperpage |
|
|
|
151 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback | 2 |
|
|
|
152 |
And the following "questions" exist:
|
|
|
153 |
| questioncategory | qtype | name | questiontext |
|
|
|
154 |
| Test questions | truefalse | TF1 | First question |
|
|
|
155 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
156 |
And quiz "Quiz 1" contains the following questions:
|
|
|
157 |
| question | page | requireprevious |
|
|
|
158 |
| TF1 | 1 | 1 |
|
|
|
159 |
| TF2 | 1 | 1 |
|
|
|
160 |
And quiz "Quiz 1" contains the following sections:
|
|
|
161 |
| heading | firstslot | shuffle |
|
|
|
162 |
| Section 1 | 1 | 1 |
|
|
|
163 |
| Section 2 | 2 | 0 |
|
|
|
164 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
165 |
Then "be attempted" "link" in the "TF2" "list_item" should not be visible
|
|
|
166 |
|
|
|
167 |
@javascript
|
|
|
168 |
Scenario: Question dependency cannot apply to quizzes with sequential navigation so UI is hidden
|
|
|
169 |
Given the following "activities" exist:
|
|
|
170 |
| activity | name | intro | course | idnumber | preferredbehaviour | navmethod |
|
|
|
171 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback | sequential |
|
|
|
172 |
And the following "questions" exist:
|
|
|
173 |
| questioncategory | qtype | name | questiontext |
|
|
|
174 |
| Test questions | truefalse | TF1 | First question |
|
|
|
175 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
176 |
And quiz "Quiz 1" contains the following questions:
|
|
|
177 |
| question | page | requireprevious |
|
|
|
178 |
| TF1 | 1 | 1 |
|
|
|
179 |
| TF2 | 1 | 1 |
|
|
|
180 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
181 |
Then "be attempted" "link" in the "TF2" "list_item" should not be visible
|
|
|
182 |
|
|
|
183 |
@javascript
|
|
|
184 |
Scenario: A question can never depend on an essay
|
|
|
185 |
Given the following "activities" exist:
|
|
|
186 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
187 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
188 |
And the following "questions" exist:
|
|
|
189 |
| questioncategory | qtype | name | questiontext |
|
|
|
190 |
| Test questions | essay | Story | First question |
|
|
|
191 |
| Test questions | truefalse | TF1 | First question |
|
|
|
192 |
And quiz "Quiz 1" contains the following questions:
|
|
|
193 |
| question | page | requireprevious |
|
|
|
194 |
| Story | 1 | 0 |
|
|
|
195 |
| TF1 | 1 | 0 |
|
|
|
196 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
197 |
Then "be attempted" "link" in the "TF1" "list_item" should not be visible
|
|
|
198 |
|
|
|
199 |
@javascript
|
|
|
200 |
Scenario: A question can never depend on a description
|
|
|
201 |
Given the following "activities" exist:
|
|
|
202 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
203 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
204 |
And the following "questions" exist:
|
|
|
205 |
| questioncategory | qtype | name | questiontext |
|
|
|
206 |
| Test questions | description | Info | Read me |
|
|
|
207 |
| Test questions | truefalse | TF1 | First question |
|
|
|
208 |
And quiz "Quiz 1" contains the following questions:
|
|
|
209 |
| question | page | requireprevious |
|
|
|
210 |
| Info | 1 | 0 |
|
|
|
211 |
| TF1 | 1 | 0 |
|
|
|
212 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
213 |
Then "be attempted" "link" in the "TF1" "list_item" should not be visible
|
|
|
214 |
|
|
|
215 |
@javascript
|
|
|
216 |
Scenario: When questions are reordered, the dependency icons are updated correctly
|
|
|
217 |
Given the following "activities" exist:
|
|
|
218 |
| activity | name | intro | course | idnumber | preferredbehaviour |
|
|
|
219 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
|
|
|
220 |
And the following "questions" exist:
|
|
|
221 |
| questioncategory | qtype | name | questiontext |
|
|
|
222 |
| Test questions | truefalse | TF1 | First question |
|
|
|
223 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
224 |
| Test questions | truefalse | TF3 | Third question |
|
|
|
225 |
And quiz "Quiz 1" contains the following questions:
|
|
|
226 |
| question | page | requireprevious |
|
|
|
227 |
| TF1 | 1 | 0 |
|
|
|
228 |
| TF2 | 1 | 1 |
|
|
|
229 |
| TF3 | 1 | 1 |
|
|
|
230 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
231 |
When I move "TF1" to "After Question 3" in the quiz by clicking the move icon
|
|
|
232 |
Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible
|
|
|
233 |
And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible
|
|
|
234 |
And "be attempted" "link" in the "TF2" "list_item" should not be visible
|