1 |
efrain |
1 |
@mod @mod_lesson
|
|
|
2 |
Feature: Lesson group override
|
|
|
3 |
In order to grant a student special access to a lesson
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to create an override for that user.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Tina | Teacher1 | teacher1@example.com |
|
|
|
11 |
| student1 | Sam1 | Student1 | student1@example.com |
|
|
|
12 |
| student2 | Sam2 | Student2 | student2@example.com |
|
|
|
13 |
| student3 | Sam3 | Student3 | student3@example.com |
|
|
|
14 |
And the following "courses" exist:
|
|
|
15 |
| fullname | shortname | category |
|
|
|
16 |
| Course 1 | C1 | 0 |
|
|
|
17 |
And the following "course enrolments" exist:
|
|
|
18 |
| user | course | role |
|
|
|
19 |
| teacher1 | C1 | editingteacher |
|
|
|
20 |
| student1 | C1 | student |
|
|
|
21 |
| student2 | C1 | student |
|
|
|
22 |
| student3 | C1 | student |
|
|
|
23 |
And the following "groups" exist:
|
|
|
24 |
| name | course | idnumber |
|
|
|
25 |
| Group 1 | C1 | G1 |
|
|
|
26 |
| Group 2 | C1 | G2 |
|
|
|
27 |
Given the following "group members" exist:
|
|
|
28 |
| user | group |
|
|
|
29 |
| student1 | G1 |
|
|
|
30 |
| student2 | G2 |
|
|
|
31 |
| student3 | G1 |
|
|
|
32 |
And the following "activities" exist:
|
|
|
33 |
| activity | name | groupmode | course | idnumber |
|
|
|
34 |
| lesson | Test lesson name | 1 | C1 | lesson1 |
|
|
|
35 |
And the following "mod_lesson > page" exist:
|
|
|
36 |
| lesson | qtype | title | content |
|
|
|
37 |
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
|
|
38 |
And the following "mod_lesson > answers" exist:
|
|
|
39 |
| page | answer | response | jumpto | score |
|
|
|
40 |
| True/false question 1 | False | Correct | Next page | 1 |
|
|
|
41 |
| True/false question 1 | True | Wrong | This page | 0 |
|
|
|
42 |
|
|
|
43 |
Scenario: Add, modify then delete a group override
|
|
|
44 |
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
|
|
45 |
And I navigate to "Overrides" in current page administration
|
|
|
46 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
47 |
And I follow "Add group override"
|
|
|
48 |
And I set the following fields to these values:
|
|
|
49 |
| Override group | Group 1 |
|
|
|
50 |
| id_deadline_enabled | 1 |
|
|
|
51 |
| deadline[day] | 1 |
|
|
|
52 |
| deadline[month] | January |
|
|
|
53 |
| deadline[year] | 2020 |
|
|
|
54 |
| deadline[hour] | 08 |
|
|
|
55 |
| deadline[minute] | 00 |
|
|
|
56 |
And I press "Save"
|
|
|
57 |
And I should see "Wednesday, 1 January 2020, 8:00"
|
|
|
58 |
Then I click on "Edit" "link" in the "region-main" "region"
|
|
|
59 |
And I set the following fields to these values:
|
|
|
60 |
| deadline[year] | 2030 |
|
|
|
61 |
And I press "Save"
|
|
|
62 |
And I should see "Tuesday, 1 January 2030, 8:00"
|
|
|
63 |
And I click on "Delete" "link"
|
|
|
64 |
And I press "Continue"
|
|
|
65 |
And I should not see "Group 1"
|
|
|
66 |
|
|
|
67 |
Scenario: Duplicate a user override
|
|
|
68 |
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
|
|
69 |
When I navigate to "Overrides" in current page administration
|
|
|
70 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
71 |
And I follow "Add group override"
|
|
|
72 |
And I set the following fields to these values:
|
|
|
73 |
| Override group | Group 1 |
|
|
|
74 |
| id_deadline_enabled | 1 |
|
|
|
75 |
| deadline[day] | 1 |
|
|
|
76 |
| deadline[month] | January |
|
|
|
77 |
| deadline[year] | 2020 |
|
|
|
78 |
| deadline[hour] | 08 |
|
|
|
79 |
| deadline[minute] | 00 |
|
|
|
80 |
And I press "Save"
|
|
|
81 |
And I should see "Wednesday, 1 January 2020, 8:00"
|
|
|
82 |
Then I click on "copy" "link"
|
|
|
83 |
And I set the following fields to these values:
|
|
|
84 |
| Override group | Group 2 |
|
|
|
85 |
| deadline[year] | 2030 |
|
|
|
86 |
And I press "Save"
|
|
|
87 |
And I should see "Tuesday, 1 January 2030, 8:00"
|
|
|
88 |
And I should see "Group 2"
|
|
|
89 |
|
|
|
90 |
Scenario: Allow a single group to have re-take the lesson
|
|
|
91 |
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
92 |
And I set the following fields to these values:
|
|
|
93 |
| Re-takes allowed | 0 |
|
|
|
94 |
And I press "Save and display"
|
|
|
95 |
And I navigate to "Overrides" in current page administration
|
|
|
96 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
97 |
And I follow "Add group override"
|
|
|
98 |
And I set the following fields to these values:
|
|
|
99 |
| Override group | Group 1 |
|
|
|
100 |
| Re-takes allowed | 1 |
|
|
|
101 |
And I press "Save"
|
|
|
102 |
And I should see "Re-takes allowed"
|
|
|
103 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
104 |
And I should see "Cat is an amphibian"
|
|
|
105 |
And I set the following fields to these values:
|
|
|
106 |
| False | 1 |
|
|
|
107 |
And I press "Submit"
|
|
|
108 |
And I press "Continue"
|
|
|
109 |
And I should see "Congratulations - end of lesson reached"
|
|
|
110 |
And I am on the "Test lesson name" "lesson activity" page
|
|
|
111 |
Then I should not see "You are not allowed to retake this lesson."
|
|
|
112 |
And I should see "Cat is an amphibian"
|
|
|
113 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student2
|
|
|
114 |
And I should see "Cat is an amphibian"
|
|
|
115 |
And I set the following fields to these values:
|
|
|
116 |
| False | 1 |
|
|
|
117 |
And I press "Submit"
|
|
|
118 |
And I press "Continue"
|
|
|
119 |
And I should see "Congratulations - end of lesson reached"
|
|
|
120 |
And I am on the "Test lesson name" "lesson activity" page
|
|
|
121 |
And I should see "You are not allowed to retake this lesson."
|
|
|
122 |
|
|
|
123 |
Scenario: Allow a single group to have a different password
|
|
|
124 |
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
125 |
And I set the following fields to these values:
|
|
|
126 |
| Password protected lesson | Yes |
|
|
|
127 |
| id_password | moodle_rules |
|
|
|
128 |
And I press "Save and display"
|
|
|
129 |
And I navigate to "Overrides" in current page administration
|
|
|
130 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
131 |
And I follow "Add group override"
|
|
|
132 |
And I set the following fields to these values:
|
|
|
133 |
| Override group | Group 1 |
|
|
|
134 |
| Password protected lesson | 12345 |
|
|
|
135 |
And I press "Save"
|
|
|
136 |
And I should see "Password protected lesson"
|
|
|
137 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
138 |
Then I should see "Test lesson name is a password protected lesson"
|
|
|
139 |
And I should not see "Cat is an amphibian"
|
|
|
140 |
And I set the field "userpassword" to "moodle_rules"
|
|
|
141 |
And I press "Continue"
|
|
|
142 |
And I should see "Login failed, please try again..."
|
|
|
143 |
And I should see "Test lesson name is a password protected lesson"
|
|
|
144 |
And I set the field "userpassword" to "12345"
|
|
|
145 |
And I press "Continue"
|
|
|
146 |
And I should see "Cat is an amphibian"
|
|
|
147 |
And I set the following fields to these values:
|
|
|
148 |
| False | 1 |
|
|
|
149 |
And I press "Submit"
|
|
|
150 |
And I press "Continue"
|
|
|
151 |
And I should see "Congratulations - end of lesson reached"
|
|
|
152 |
And I am on the "Test lesson name" "lesson activity" page logged in as student2
|
|
|
153 |
And I should see "Test lesson name is a password protected lesson"
|
|
|
154 |
And I should not see "Cat is an amphibian"
|
|
|
155 |
And I set the field "userpassword" to "12345"
|
|
|
156 |
And I press "Continue"
|
|
|
157 |
And I should see "Login failed, please try again..."
|
|
|
158 |
And I should see "Test lesson name is a password protected lesson"
|
|
|
159 |
And I set the field "userpassword" to "moodle_rules"
|
|
|
160 |
And I press "Continue"
|
|
|
161 |
|
|
|
162 |
Scenario: Allow a group to have a different due date
|
|
|
163 |
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
164 |
And I set the following fields to these values:
|
|
|
165 |
| id_deadline_enabled | 1 |
|
|
|
166 |
| deadline[day] | 1 |
|
|
|
167 |
| deadline[month] | January |
|
|
|
168 |
| deadline[year] | 2000 |
|
|
|
169 |
| deadline[hour] | 08 |
|
|
|
170 |
| deadline[minute] | 00 |
|
|
|
171 |
And I press "Save and display"
|
|
|
172 |
And I navigate to "Overrides" in current page administration
|
|
|
173 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
174 |
And I follow "Add group override"
|
|
|
175 |
And I set the following fields to these values:
|
|
|
176 |
| Override group | Group 1 |
|
|
|
177 |
| id_deadline_enabled | 1 |
|
|
|
178 |
| deadline[day] | 1 |
|
|
|
179 |
| deadline[month] | January |
|
|
|
180 |
| deadline[year] | 2030 |
|
|
|
181 |
| deadline[hour] | 08 |
|
|
|
182 |
| deadline[minute] | 00 |
|
|
|
183 |
And I press "Save"
|
|
|
184 |
And I should see "Lesson closes"
|
|
|
185 |
And I am on the "Test lesson name" "lesson activity" page logged in as student2
|
|
|
186 |
Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00"
|
|
|
187 |
And I should not see "Cat is an amphibian"
|
|
|
188 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
189 |
And I should see "Cat is an amphibian"
|
|
|
190 |
|
|
|
191 |
Scenario: Allow a group to have a different start date
|
|
|
192 |
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
193 |
And I set the following fields to these values:
|
|
|
194 |
| id_available_enabled | 1 |
|
|
|
195 |
| available[day] | 1 |
|
|
|
196 |
| available[month] | January |
|
|
|
197 |
| available[year] | 2030 |
|
|
|
198 |
| available[hour] | 08 |
|
|
|
199 |
| available[minute] | 00 |
|
|
|
200 |
And I press "Save and display"
|
|
|
201 |
And I navigate to "Overrides" in current page administration
|
|
|
202 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
203 |
And I follow "Add group override"
|
|
|
204 |
And I set the following fields to these values:
|
|
|
205 |
| Override group | Group 1 |
|
|
|
206 |
| id_available_enabled | 1 |
|
|
|
207 |
| available[day] | 1 |
|
|
|
208 |
| available[month] | January |
|
|
|
209 |
| available[year] | 2015 |
|
|
|
210 |
| available[hour] | 08 |
|
|
|
211 |
| available[minute] | 00 |
|
|
|
212 |
And I press "Save"
|
|
|
213 |
And I should see "Lesson opens"
|
|
|
214 |
And I am on the "Test lesson name" "lesson activity" page logged in as student2
|
|
|
215 |
Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00"
|
|
|
216 |
And I should not see "Cat is an amphibian"
|
|
|
217 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
218 |
And I should see "Cat is an amphibian"
|
|
|
219 |
|
|
|
220 |
Scenario: Allow a single group to have multiple attempts at each question
|
|
|
221 |
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
222 |
And I set the following fields to these values:
|
|
|
223 |
| Re-takes allowed | 1 |
|
|
|
224 |
And I press "Save and display"
|
|
|
225 |
And I navigate to "Overrides" in current page administration
|
|
|
226 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
227 |
And I follow "Add group override"
|
|
|
228 |
And I set the following fields to these values:
|
|
|
229 |
| Override group | Group 1 |
|
|
|
230 |
| Maximum number of attempts per question | 2 |
|
|
|
231 |
And I press "Save"
|
|
|
232 |
And I should see "Maximum number of attempts per question"
|
|
|
233 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
234 |
And I should see "Cat is an amphibian"
|
|
|
235 |
And I set the following fields to these values:
|
|
|
236 |
| True | 1 |
|
|
|
237 |
And I press "Submit"
|
|
|
238 |
And I press "Continue"
|
|
|
239 |
And I should see "Cat is an amphibian"
|
|
|
240 |
And I set the following fields to these values:
|
|
|
241 |
| True | 1 |
|
|
|
242 |
And I press "Submit"
|
|
|
243 |
And I press "Continue"
|
|
|
244 |
And I should see "Congratulations - end of lesson reached"
|
|
|
245 |
And I am on the "Test lesson name" "lesson activity" page logged in as student2
|
|
|
246 |
And I should see "Cat is an amphibian"
|
|
|
247 |
And I set the following fields to these values:
|
|
|
248 |
| True | 1 |
|
|
|
249 |
And I press "Submit"
|
|
|
250 |
Then I press "Continue"
|
|
|
251 |
And I should see "Congratulations - end of lesson reached"
|
|
|
252 |
|
|
|
253 |
@javascript
|
|
|
254 |
Scenario: Add both a user and group override and verify that both are applied correctly
|
|
|
255 |
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
|
|
256 |
When I set the following fields to these values:
|
|
|
257 |
| id_available_enabled | 1 |
|
|
|
258 |
| available[day] | 1 |
|
|
|
259 |
| available[month] | January |
|
|
|
260 |
| available[year] | 2040 |
|
|
|
261 |
| available[hour] | 08 |
|
|
|
262 |
| available[minute] | 00 |
|
|
|
263 |
And I press "Save and display"
|
|
|
264 |
And I am on the "Test lesson name" "lesson activity" page
|
|
|
265 |
And I navigate to "Overrides" in current page administration
|
|
|
266 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
267 |
And I follow "Add group override"
|
|
|
268 |
And I set the following fields to these values:
|
|
|
269 |
| Override group | Group 1 |
|
|
|
270 |
| id_available_enabled | 1 |
|
|
|
271 |
| available[day] | 1 |
|
|
|
272 |
| available[month] | January |
|
|
|
273 |
| available[year] | 2030 |
|
|
|
274 |
| available[hour] | 08 |
|
|
|
275 |
| available[minute] | 00 |
|
|
|
276 |
And I press "Save"
|
|
|
277 |
And I should see "Tuesday, 1 January 2030, 8:00"
|
|
|
278 |
And I am on the "Test lesson name" "lesson activity" page
|
|
|
279 |
And I navigate to "Overrides" in current page administration
|
|
|
280 |
And I follow "Add user override"
|
|
|
281 |
And I set the following fields to these values:
|
|
|
282 |
| Override user | Student1 |
|
|
|
283 |
| id_available_enabled | 1 |
|
|
|
284 |
| available[day] | 1 |
|
|
|
285 |
| available[month] | January |
|
|
|
286 |
| available[year] | 2031 |
|
|
|
287 |
| available[hour] | 08 |
|
|
|
288 |
| available[minute] | 00 |
|
|
|
289 |
And I press "Save"
|
|
|
290 |
And I should see "Wednesday, 1 January 2031, 8:00"
|
|
|
291 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
292 |
And the activity date in "Test lesson name" should contain "Opens: Wednesday, 1 January 2031, 8:00"
|
|
|
293 |
And I am on the "Test lesson name" "lesson activity" page logged in as student2
|
|
|
294 |
And the activity date in "Test lesson name" should contain "Opens: Sunday, 1 January 2040, 8:00"
|
|
|
295 |
And I am on the "Test lesson name" "lesson activity" page logged in as student3
|
|
|
296 |
And the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00"
|
|
|
297 |
|
|
|
298 |
Scenario: Override a group when teacher is in no group, and does not have accessallgroups permission, and the activity's group mode is 'separate groups'
|
|
|
299 |
Given the following "permission overrides" exist:
|
|
|
300 |
| capability | permission | role | contextlevel | reference |
|
|
|
301 |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
|
|
|
302 |
And the following "activities" exist:
|
|
|
303 |
| activity | name | course | idnumber | groupmode |
|
|
|
304 |
| lesson | Lesson 2 | C1 | lesson2 | 1 |
|
|
|
305 |
When I am on the "Lesson 2" "lesson activity" page logged in as teacher1
|
|
|
306 |
And I navigate to "Overrides" in current page administration
|
|
|
307 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
308 |
Then I should see "No groups you can access."
|
|
|
309 |
And I should not see "Add group override"
|
|
|
310 |
|
|
|
311 |
Scenario: A teacher without accessallgroups permission should only be able to add group override for their groups, when the activity's group mode is 'separate groups'
|
|
|
312 |
Given the following "permission overrides" exist:
|
|
|
313 |
| capability | permission | role | contextlevel | reference |
|
|
|
314 |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
|
|
|
315 |
And the following "activities" exist:
|
|
|
316 |
| activity | name | course | idnumber | groupmode |
|
|
|
317 |
| lesson | Lesson 2 | C1 | lesson2 | 1 |
|
|
|
318 |
And the following "group members" exist:
|
|
|
319 |
| user | group |
|
|
|
320 |
| teacher1 | G1 |
|
|
|
321 |
When I am on the "Lesson 2" "lesson activity" page logged in as teacher1
|
|
|
322 |
And I navigate to "Overrides" in current page administration
|
|
|
323 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
324 |
And I follow "Add group override"
|
|
|
325 |
Then the "Override group" select box should contain "Group 1"
|
|
|
326 |
And the "Override group" select box should not contain "Group 2"
|
|
|
327 |
|
|
|
328 |
Scenario: A teacher without accessallgroups permission should only be able to see the group overrides for their groups, when the activity's group mode is 'separate groups'
|
|
|
329 |
Given the following "permission overrides" exist:
|
|
|
330 |
| capability | permission | role | contextlevel | reference |
|
|
|
331 |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
|
|
|
332 |
And the following "activities" exist:
|
|
|
333 |
| activity | name | course | idnumber | groupmode |
|
|
|
334 |
| lesson | Lesson 2 | C1 | lesson2 | 1 |
|
|
|
335 |
And the following "group members" exist:
|
|
|
336 |
| user | group |
|
|
|
337 |
| teacher1 | G1 |
|
|
|
338 |
And I am on the "Lesson 2" "lesson activity" page logged in as admin
|
|
|
339 |
And I navigate to "Overrides" in current page administration
|
|
|
340 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
341 |
And I follow "Add group override"
|
|
|
342 |
And I set the following fields to these values:
|
|
|
343 |
| Override group | Group 1 |
|
|
|
344 |
| id_available_enabled | 1 |
|
|
|
345 |
| available[day] | 1 |
|
|
|
346 |
| available[month] | January |
|
|
|
347 |
| available[year] | 2020 |
|
|
|
348 |
| available[hour] | 08 |
|
|
|
349 |
| available[minute] | 00 |
|
|
|
350 |
And I press "Save and enter another override"
|
|
|
351 |
And I set the following fields to these values:
|
|
|
352 |
| Override group | Group 2 |
|
|
|
353 |
| id_available_enabled | 1 |
|
|
|
354 |
| available[day] | 1 |
|
|
|
355 |
| available[month] | January |
|
|
|
356 |
| available[year] | 2020 |
|
|
|
357 |
| available[hour] | 08 |
|
|
|
358 |
| available[minute] | 00 |
|
|
|
359 |
And I press "Save"
|
|
|
360 |
When I am on the "Lesson 2" "lesson activity" page logged in as teacher1
|
|
|
361 |
And I navigate to "Overrides" in current page administration
|
|
|
362 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
363 |
Then I should see "Group 1" in the ".generaltable" "css_element"
|
|
|
364 |
And I should not see "Group 2" in the ".generaltable" "css_element"
|
|
|
365 |
|
|
|
366 |
Scenario: "Not visible" groups should not be available for group overrides
|
|
|
367 |
Given the following "groups" exist:
|
|
|
368 |
| name | course | idnumber | visibility | participation |
|
|
|
369 |
| Visible to everyone/Participation | C1 | VP | 0 | 1 |
|
|
|
370 |
| Only Only visible to members/Participation | C1 | MP | 1 | 1 |
|
|
|
371 |
| Only see own membership | C1 | O | 2 | 0 |
|
|
|
372 |
| Not visible | C1 | N | 3 | 0 |
|
|
|
373 |
| Visible to everyone/Non-Participation | C1 | VN | 0 | 0 |
|
|
|
374 |
| Only visible to members/Non-Participation | C1 | MN | 1 | 0 |
|
|
|
375 |
When I am on the "lesson1" Activity page logged in as teacher1
|
|
|
376 |
And I navigate to "Overrides" in current page administration
|
|
|
377 |
And I select "Group overrides" from the "jump" singleselect
|
|
|
378 |
And I follow "Add group override"
|
|
|
379 |
Then I should see "Visible to everyone/Participation" in the "Override group" "select"
|
|
|
380 |
And I should see "Visible to everyone/Non-Participation" in the "Override group" "select"
|
|
|
381 |
And I should see "Only visible to members" in the "Override group" "select"
|
|
|
382 |
And I should see "Only visible to members/Non-Participation" in the "Override group" "select"
|
|
|
383 |
And I should see "Only see own membership" in the "Override group" "select"
|
|
|
384 |
And I should not see "Not visible" in the "Override group" "select"
|