Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

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