1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Quiz user override
|
|
|
3 |
In order to grant a student special access to a quiz
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to create an override for that user.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
And the following "custom profile fields" exist:
|
|
|
9 |
| datatype | shortname | name |
|
|
|
10 |
| text | frog | Favourite frog |
|
|
|
11 |
Given the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email | profile_field_frog |
|
|
|
13 |
| teacher | Teacher | One | teacher@example.com | |
|
|
|
14 |
| helper | Exam | Helper | helper@example.com | |
|
|
|
15 |
| student1 | Student | One | student1@example.com | yellow frog |
|
|
|
16 |
| student2 | Student | Two | student2@example.com | prince frog |
|
|
|
17 |
| student3 | Student | Three | student3@example.com | Kermit |
|
|
|
18 |
And the following "courses" exist:
|
|
|
19 |
| fullname | shortname | category |
|
|
|
20 |
| Course 1 | C1 | 0 |
|
|
|
21 |
And the following "course enrolments" exist:
|
|
|
22 |
| user | course | role |
|
|
|
23 |
| teacher | C1 | editingteacher |
|
|
|
24 |
| helper | C1 | teacher |
|
|
|
25 |
| student1 | C1 | student |
|
|
|
26 |
| student2 | C1 | student |
|
|
|
27 |
| student3 | C1 | student |
|
|
|
28 |
|
|
|
29 |
@javascript
|
|
|
30 |
Scenario: Add, modify then delete a user override
|
|
|
31 |
Given the following "activities" exist:
|
|
|
32 |
| activity | name | course | idnumber |
|
|
|
33 |
| quiz | Test quiz | C1 | quiz1 |
|
|
|
34 |
And I am on the "Test quiz" "mod_quiz > View" page logged in as "teacher"
|
|
|
35 |
And I change window size to "large"
|
|
|
36 |
And I navigate to "Overrides" in current page administration
|
|
|
37 |
And I press "Add user override"
|
|
|
38 |
And I set the following fields to these values:
|
|
|
39 |
| Override user | Student One (student1@example.com) |
|
|
|
40 |
| id_timeclose_enabled | 1 |
|
|
|
41 |
| timeclose[day] | 1 |
|
|
|
42 |
| timeclose[month] | January |
|
|
|
43 |
| timeclose[year] | 2020 |
|
|
|
44 |
| timeclose[hour] | 08 |
|
|
|
45 |
| timeclose[minute] | 00 |
|
|
|
46 |
And I press "Save"
|
|
|
47 |
Then I should see "Wednesday, 1 January 2020, 8:00"
|
|
|
48 |
|
|
|
49 |
And I click on "Edit" "link" in the "Student One" "table_row"
|
|
|
50 |
And I set the following fields to these values:
|
|
|
51 |
| timeclose[year] | 2030 |
|
|
|
52 |
And I press "Save"
|
|
|
53 |
And I should see "Action"
|
|
|
54 |
And I should see "Tuesday, 1 January 2030, 8:00" in the "Student One" "table_row"
|
|
|
55 |
And I should see "student1@example.com" in the "Student One" "table_row"
|
|
|
56 |
|
|
|
57 |
And I click on "Delete" "link" in the "Student One" "table_row"
|
|
|
58 |
And I should see "Are you sure you want to delete the override for user Student One (student1@example.com)?"
|
|
|
59 |
And I press "Continue"
|
|
|
60 |
And I should not see "Student One"
|
|
|
61 |
|
|
|
62 |
@javascript
|
|
|
63 |
Scenario: Add multiple user overrides, one after another
|
|
|
64 |
Given the following "activities" exist:
|
|
|
65 |
| activity | name | course | idnumber |
|
|
|
66 |
| quiz | Test quiz | C1 | quiz1 |
|
|
|
67 |
And I am on the "Test quiz" "mod_quiz > View" page logged in as "teacher"
|
|
|
68 |
And I change window size to "large"
|
|
|
69 |
And I navigate to "Overrides" in current page administration
|
|
|
70 |
And I press "Add user override"
|
|
|
71 |
And I set the following fields to these values:
|
|
|
72 |
| Override user | Student One |
|
|
|
73 |
| timeclose[enabled] | 1 |
|
|
|
74 |
| Close the quiz | ## 1 January 2020 08:00 ## |
|
|
|
75 |
And I press "Save and enter another override"
|
|
|
76 |
And I set the following fields to these values:
|
|
|
77 |
| Override user | Student Two |
|
|
|
78 |
| timeclose[enabled] | 1 |
|
|
|
79 |
| Close the quiz | ## 2 January 2020 08:00 ## |
|
|
|
80 |
When I press "Save"
|
|
|
81 |
Then the following should exist in the "generaltable" table:
|
|
|
82 |
| User | Overrides | -4- |
|
|
|
83 |
| Student One | Quiz closes | 1 January 2020, 8:00 |
|
|
|
84 |
| Student Two | Quiz closes | 2 January 2020, 8:00 |
|
|
|
85 |
|
|
|
86 |
@javascript
|
|
|
87 |
Scenario: Can add a user override when the quiz is not available to the student
|
|
|
88 |
Given the following "activities" exist:
|
|
|
89 |
| activity | name | course | idnumber | visible |
|
|
|
90 |
| quiz | Test quiz | C1 | quiz1 | 0 |
|
|
|
91 |
When I am on the "Test quiz" "mod_quiz > User overrides" page logged in as "teacher"
|
|
|
92 |
And I press "Add user override"
|
|
|
93 |
And I set the following fields to these values:
|
|
|
94 |
| Override user | Student One (student1@example.com) |
|
|
|
95 |
| Attempts allowed | 1 |
|
|
|
96 |
And I press "Save"
|
|
|
97 |
Then I should see "This override is inactive"
|
|
|
98 |
And I should see "Action"
|
|
|
99 |
And "Edit" "icon" should exist in the "Student One" "table_row"
|
|
|
100 |
And "copy" "icon" should exist in the "Student One" "table_row"
|
|
|
101 |
And "Delete" "icon" should exist in the "Student One" "table_row"
|
|
|
102 |
And I follow "Student One"
|
|
|
103 |
And I should see "Student One"
|
|
|
104 |
And I should see "User details"
|
|
|
105 |
|
|
|
106 |
@javascript
|
|
|
107 |
Scenario: Teacher without 'See full user identity in lists' can see and edit overrides
|
|
|
108 |
Given the following "permission overrides" exist:
|
|
|
109 |
| capability | permission | role | contextlevel | reference |
|
|
|
110 |
| moodle/site:viewuseridentity | Prevent | editingteacher | Course | C1 |
|
|
|
111 |
And the following "activities" exist:
|
|
|
112 |
| activity | name | course | idnumber | visible |
|
|
|
113 |
| quiz | Test quiz | C1 | quiz1 | 0 |
|
|
|
114 |
When I am on the "Test quiz" "mod_quiz > User overrides" page logged in as "teacher"
|
|
|
115 |
And I press "Add user override"
|
|
|
116 |
And I set the following fields to these values:
|
|
|
117 |
| Override user | Student One |
|
|
|
118 |
| Attempts allowed | 1 |
|
|
|
119 |
And I press "Save"
|
|
|
120 |
And I should see "Action"
|
|
|
121 |
And I should not see "student1@example.com"
|
|
|
122 |
And "Edit" "icon" should exist in the "Student One" "table_row"
|
|
|
123 |
And "copy" "icon" should exist in the "Student One" "table_row"
|
|
|
124 |
And "Delete" "icon" should exist in the "Student One" "table_row"
|
|
|
125 |
|
|
|
126 |
Scenario: A teacher without accessallgroups permission should only be able to add user override for users that he/she shares groups with,
|
|
|
127 |
when the activity's group mode is to "separate groups"
|
|
|
128 |
Given the following "groups" exist:
|
|
|
129 |
| name | course | idnumber |
|
|
|
130 |
| Group 1 | C1 | G1 |
|
|
|
131 |
| Group 2 | C1 | G2 |
|
|
|
132 |
And the following "group members" exist:
|
|
|
133 |
| user | group |
|
|
|
134 |
| student1 | G1 |
|
|
|
135 |
| teacher | G1 |
|
|
|
136 |
| student2 | G2 |
|
|
|
137 |
And the following "permission overrides" exist:
|
|
|
138 |
| capability | permission | role | contextlevel | reference |
|
|
|
139 |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
|
|
|
140 |
And the following "activities" exist:
|
|
|
141 |
| activity | name | course | idnumber | groupmode |
|
|
|
142 |
| quiz | Test quiz | C1 | quiz1 | 1 |
|
|
|
143 |
When I am on the "Test quiz" "mod_quiz > User overrides" page logged in as "teacher"
|
|
|
144 |
And I press "Add user override"
|
|
|
145 |
Then the "Override user" select box should contain "Student One (student1@example.com)"
|
|
|
146 |
And the "Override user" select box should not contain "Student Two (student2@example.com)"
|
|
|
147 |
|
|
|
148 |
Scenario: Override user in an activity with group mode set to "separate groups" as a teacher who is not a member in any group, and does not have accessallgroups permission
|
|
|
149 |
Given the following "groups" exist:
|
|
|
150 |
| name | course | idnumber |
|
|
|
151 |
| Group 1 | C1 | G1 |
|
|
|
152 |
And the following "group members" exist:
|
|
|
153 |
| user | group |
|
|
|
154 |
| student1 | G1 |
|
|
|
155 |
And the following "permission overrides" exist:
|
|
|
156 |
| capability | permission | role | contextlevel | reference |
|
|
|
157 |
| moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 |
|
|
|
158 |
And the following "activities" exist:
|
|
|
159 |
| activity | name | course | idnumber | groupmode |
|
|
|
160 |
| quiz | Test quiz | C1 | quiz1 | 1 |
|
|
|
161 |
When I am on the "Test quiz" "mod_quiz > User overrides" page logged in as "teacher"
|
|
|
162 |
Then I should see "No groups you can access."
|
|
|
163 |
And the "Add user override" "button" should be disabled
|
|
|
164 |
|
|
|
165 |
Scenario: A non-editing teacher can see the overrides, but not change them
|
|
|
166 |
Given the following "activities" exist:
|
|
|
167 |
| activity | name | course | idnumber |
|
|
|
168 |
| quiz | Test quiz | C1 | quiz1 |
|
|
|
169 |
And the following "mod_quiz > user overrides" exist:
|
|
|
170 |
| quiz | user | attempts |
|
|
|
171 |
| Test quiz | student1 | 2 |
|
|
|
172 |
| Test quiz | student2 | 2 |
|
|
|
173 |
And I am on the "Test quiz" "mod_quiz > View" page logged in as "helper"
|
|
|
174 |
When I navigate to "Overrides" in current page administration
|
|
|
175 |
Then "Student One" "table_row" should exist
|
|
|
176 |
And "Student Two" "table_row" should exist
|
|
|
177 |
And "Add user override" "button" should not exist
|
|
|
178 |
And I should not see "Action"
|
|
|
179 |
And "Edit" "link" should not exist in the "Student One" "table_row"
|
|
|
180 |
And "Copy" "link" should not exist in the "Student One" "table_row"
|
|
|
181 |
And "Delete" "link" should not exist in the "Student One" "table_row"
|
|
|
182 |
And I am on the "Test quiz" "mod_quiz > View" page
|
|
|
183 |
And I should see "Settings overrides exist (Users: 2)"
|
|
|
184 |
|
|
|
185 |
@javascript
|
|
|
186 |
Scenario: Teachers can see user additional user identity information
|
|
|
187 |
Given the following config values are set as admin:
|
|
|
188 |
| showuseridentity | email,profile_field_frog |
|
|
|
189 |
And the following "activities" exist:
|
|
|
190 |
| activity | name | course | idnumber |
|
|
|
191 |
| quiz | Test quiz | C1 | quiz1 |
|
|
|
192 |
And the following "mod_quiz > user overrides" exist:
|
|
|
193 |
| quiz | user | attempts |
|
|
|
194 |
| Test quiz | student1 | 2 |
|
|
|
195 |
| Test quiz | student2 | 2 |
|
|
|
196 |
When I am on the "Test quiz" "mod_quiz > User overrides" page logged in as "teacher"
|
|
|
197 |
Then I should see "yellow frog" in the "Student One" "table_row"
|
|
|
198 |
And I should see "prince frog" in the "Student Two" "table_row"
|
|
|
199 |
|
|
|
200 |
And I press "Add user override"
|
|
|
201 |
And I expand the "Override user" autocomplete
|
|
|
202 |
And I should see "Kermit"
|
|
|
203 |
And I should not see "Student one"
|
|
|
204 |
And I should not see "Student two"
|
|
|
205 |
And I press "Cancel"
|
|
|
206 |
|
|
|
207 |
And I click on "Edit" "link" in the "Student One" "table_row"
|
|
|
208 |
And I should see "Student One (student1@example.com, yellow frog)"
|
|
|
209 |
And I press "Cancel"
|
|
|
210 |
|
|
|
211 |
And I click on "Delete" "link" in the "Student One" "table_row"
|
|
|
212 |
And I should see "Student One (student1@example.com, yellow frog)"
|
|
|
213 |
|
|
|
214 |
Scenario: Add button disabled if no users
|
|
|
215 |
Given the following "courses" exist:
|
|
|
216 |
| fullname | shortname | category |
|
|
|
217 |
| Course 2 | C2 | 0 |
|
|
|
218 |
And the following "activities" exist:
|
|
|
219 |
| activity | name | course | idnumber |
|
|
|
220 |
| quiz | Other quiz | C2 | quiz2 |
|
|
|
221 |
When I am on the "Other quiz" "mod_quiz > User overrides" page logged in as "admin"
|
|
|
222 |
Then the "Add user override" "button" should be disabled
|
|
|
223 |
|
|
|
224 |
@javascript
|
|
|
225 |
Scenario: Should see only enrolled users in user selector
|
|
|
226 |
Given the following "users" exist:
|
|
|
227 |
| username | firstname | lastname | email |
|
|
|
228 |
| manager | Max | Manager | man@example.com |
|
|
|
229 |
And the following "role assigns" exist:
|
|
|
230 |
| user | role | contextlevel | reference |
|
|
|
231 |
| manager | manager | System | |
|
|
|
232 |
And the following "activities" exist:
|
|
|
233 |
| activity | name | course | idnumber | groupmode |
|
|
|
234 |
| quiz | Test quiz | C1 | quiz1 | 1 |
|
|
|
235 |
And the following "role capability" exists:
|
|
|
236 |
| role | manager |
|
|
|
237 |
| mod/quiz:attempt | allow |
|
|
|
238 |
When I am on the "Test quiz" "mod_quiz > User overrides" page logged in as "teacher"
|
|
|
239 |
And I press "Add user override"
|
|
|
240 |
And I click on "Override user" "field"
|
|
|
241 |
And I type "Max Manager"
|
|
|
242 |
Then I should see "No suggestions"
|