1 |
efrain |
1 |
@core @core_grades @javascript
|
|
|
2 |
Feature: Teachers can perform bulk actions on grade items and categories in the gradebook setup
|
|
|
3 |
In order to be able to easily organize my gradebook
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to select multiple grade items and categories and perform bulk actions on them
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category |
|
|
|
10 |
| Course | C1 | 0 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email | idnumber |
|
|
|
13 |
| teacher1 | Teacher 1 | 1 | teacher1@example.com | t1 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
And the following "grade categories" exist:
|
|
|
18 |
| fullname | course |
|
|
|
19 |
| Category 1 | C1 |
|
|
|
20 |
And the following "grade categories" exist:
|
|
|
21 |
| fullname | course | gradecategory |
|
|
|
22 |
| Category 2 | C1 | Category 1 |
|
|
|
23 |
| Category 3 | C1 | Category 2 |
|
|
|
24 |
And the following "grade items" exist:
|
|
|
25 |
| itemname | course | category |
|
|
|
26 |
| Grade item 1 | C1 | ? |
|
|
|
27 |
| Grade item 2 | C1 | Category 1 |
|
|
|
28 |
| Grade item 3 | C1 | Category 1 |
|
|
|
29 |
| Grade item 4 | C1 | Category 2 |
|
|
|
30 |
And I log in as "teacher1"
|
|
|
31 |
And I am on "Course" course homepage
|
|
|
32 |
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
|
|
33 |
|
|
|
34 |
Scenario: A teacher can see bulk action options in the gradebook setup
|
|
|
35 |
# Bulk action options should not be displayed until at least one grade item is selected.
|
|
|
36 |
Given I should not see "Move" in the "sticky-footer" "region"
|
|
|
37 |
When I set the field "Grade item 1" to "1"
|
|
|
38 |
Then I should see "Move" in the "sticky-footer" "region"
|
|
|
39 |
And I set the field "Grade item 2" to "1"
|
|
|
40 |
And I should see "Move" in the "sticky-footer" "region"
|
|
|
41 |
# Unchecking all grade items should hide the bulk action area.
|
|
|
42 |
And I set the following fields to these values:
|
|
|
43 |
| Grade item 1 | 0 |
|
|
|
44 |
| Grade item 2 | 0 |
|
|
|
45 |
And I should not see "Move" in the "sticky-footer" "region"
|
|
|
46 |
|
|
|
47 |
Scenario: A teacher can see the number of selected grade items and categories in the bulk action area
|
|
|
48 |
Given I set the field "Grade item 1" to "1"
|
|
|
49 |
# Selecting a grade category should also select all grade items in that category.
|
|
|
50 |
When I set the field "Category 2" to "1"
|
|
|
51 |
Then I should see "4 selected" in the "sticky-footer" "region"
|
|
|
52 |
And I set the field "Category 2" to "0"
|
|
|
53 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
54 |
And I set the field "All" to "1"
|
|
|
55 |
And I should see "8 selected" in the "sticky-footer" "region"
|
|
|
56 |
And I set the field "All" to "0"
|
|
|
57 |
And I should not see "selected" in the "sticky-footer" "region"
|
|
|
58 |
|
|
|
59 |
Scenario: A teacher can unselect all grade items and categories in the bulk action area
|
|
|
60 |
Given I set the following fields to these values:
|
|
|
61 |
| Grade item 1 | 1 |
|
|
|
62 |
| Category 2 | 1 |
|
|
|
63 |
And I should see "4 selected" in the "sticky-footer" "region"
|
|
|
64 |
And "Close bulk edit" "button" should exist in the "sticky-footer" "region"
|
|
|
65 |
When I click on "Close bulk edit" "button" in the "sticky-footer" "region"
|
|
|
66 |
Then the following fields match these values:
|
|
|
67 |
| All | 0 |
|
|
|
68 |
| Grade item 1 | 0 |
|
|
|
69 |
| Category 1 | 0 |
|
|
|
70 |
| Grade item 2 | 0 |
|
|
|
71 |
| Grade item 3 | 0 |
|
|
|
72 |
| Category 2 | 0 |
|
|
|
73 |
| Grade item 4 | 0 |
|
|
|
74 |
| Category 3 | 0 |
|
|
|
75 |
And "Close bulk edit" "button" should not exist in the "sticky-footer" "region"
|
|
|
76 |
|
|
|
77 |
Scenario: A teacher can see bulk move modal with all available grade categories
|
|
|
78 |
Given I set the field "Grade item 1" to "1"
|
|
|
79 |
When I click on "Move" "button" in the "sticky-footer" "region"
|
|
|
80 |
Then "Move items" "dialogue" should exist
|
|
|
81 |
And "Course" "list_item" should exist in the "Move items" "dialogue"
|
|
|
82 |
And "Category 1" "list_item" should exist in the "Move items" "dialogue"
|
|
|
83 |
And "Category 2" "list_item" should exist in the "Move items" "dialogue"
|
|
|
84 |
And "Category 3" "list_item" should exist in the "Move items" "dialogue"
|
|
|
85 |
|
|
|
86 |
Scenario: A teacher can collapse grade categories in the bulk move modal
|
|
|
87 |
Given I set the field "Grade item 1" to "1"
|
|
|
88 |
And I click on "Move" "button" in the "sticky-footer" "region"
|
|
|
89 |
# Collapse "Category 2" category.
|
|
|
90 |
When I click on "Collapse" "link" in the "Category 2" "list_item"
|
|
|
91 |
Then "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
92 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
93 |
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
94 |
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
95 |
And "Expand" "link" should exist in the "Category 2" "list_item"
|
|
|
96 |
# Collapse "Category 1" category.
|
|
|
97 |
And I click on "Collapse" "link" in the "Category 1" "list_item"
|
|
|
98 |
And "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
99 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
100 |
And "Category 2" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
101 |
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
102 |
And "Expand" "link" should exist in the "Category 1" "list_item"
|
|
|
103 |
# Expand "Category 1" category.
|
|
|
104 |
And I click on "Expand" "link" in the "Category 1" "list_item"
|
|
|
105 |
And "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
106 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
107 |
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
108 |
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
109 |
And "Collapse" "link" should exist in the "Category 1" "list_item"
|
|
|
110 |
# Expand "Category 2" category.
|
|
|
111 |
And I click on "Expand" "link" in the "Category 2" "list_item"
|
|
|
112 |
And "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
113 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
114 |
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
115 |
And "Category 3" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
116 |
And "Collapse" "link" should exist in the "Category 2" "list_item"
|
|
|
117 |
|
|
|
118 |
Scenario: A teacher can move multiple grade items to a category
|
11 |
efrain |
119 |
Given I set the field "Grade item 2" to "1"
|
|
|
120 |
And I set the field "Grade item 1" to "1"
|
1 |
efrain |
121 |
And I click on "Move" "button" in the "sticky-footer" "region"
|
|
|
122 |
And I click on "Category 3" "list_item" in the "Move items" "dialogue"
|
|
|
123 |
And I click on "Move" "button" in the "Move items" "dialogue"
|
|
|
124 |
And I wait to be redirected
|
|
|
125 |
# Confirm that 'Grade item 1' and 'Grade item 2' have been moved to 'Category 3'
|
|
|
126 |
And I click on grade item menu "Grade item 1" of type "gradeitem" on "setup" page
|
|
|
127 |
When I choose "Edit grade item" in the open action menu
|
|
|
128 |
And "Edit grade item" "dialogue" should exist
|
|
|
129 |
Then I should see "Category 3" in the "Grade category" "form_row"
|
|
|
130 |
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
|
|
|
131 |
And I click on grade item menu "Grade item 2" of type "gradeitem" on "setup" page
|
|
|
132 |
And I choose "Edit grade item" in the open action menu
|
|
|
133 |
And "Edit grade item" "dialogue" should exist
|
|
|
134 |
And I should see "Category 3" in the "Grade category" "form_row"
|
|
|
135 |
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
|
|
|
136 |
# Confirm that all other grade items have not been moved.
|
|
|
137 |
And I click on grade item menu "Grade item 3" of type "gradeitem" on "setup" page
|
|
|
138 |
When I choose "Edit grade item" in the open action menu
|
|
|
139 |
And I wait until "Edit grade item" "dialogue" exists
|
|
|
140 |
Then I should see "Category 1" in the "Grade category" "form_row"
|
|
|
141 |
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
|
|
|
142 |
And I click on grade item menu "Grade item 4" of type "gradeitem" on "setup" page
|
|
|
143 |
And I choose "Edit grade item" in the open action menu
|
|
|
144 |
And I wait until "Edit grade item" "dialogue" exists
|
|
|
145 |
And I should see "Category 2" in the "Grade category" "form_row"
|
|
|
146 |
|
|
|
147 |
@accessibility
|
|
|
148 |
Scenario: A teacher can navigate through the grade categories in the bulk modal using the keyboard
|
|
|
149 |
Given I set the field "Grade item 1" to "1"
|
|
|
150 |
And I press tab key in "sticky-footer" "region"
|
|
|
151 |
And the focused element is "Move" "button" in the "sticky-footer" "region"
|
|
|
152 |
And I press enter
|
|
|
153 |
And "Move items" "dialogue" should exist
|
|
|
154 |
And I press tab
|
|
|
155 |
And the focused element is "Close" "button" in the "Move items" "dialogue"
|
|
|
156 |
And I press tab
|
|
|
157 |
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
|
|
|
158 |
# Move to the next grade category.
|
|
|
159 |
When I press the down key
|
|
|
160 |
Then the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
|
|
|
161 |
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
|
|
|
162 |
And I press the down key
|
|
|
163 |
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
|
|
|
164 |
# Move to the previous grade category.
|
|
|
165 |
And I press the up key
|
|
|
166 |
And the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
|
|
|
167 |
And I press the up key
|
|
|
168 |
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
|
|
|
169 |
# Move to the last grade category.
|
|
|
170 |
And I press the end key
|
|
|
171 |
And the focused element is "Category 3" "list_item" in the "Move items" "dialogue"
|
|
|
172 |
# Move to the first grade category.
|
|
|
173 |
And I press the home key
|
|
|
174 |
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
|
|
|
175 |
|
|
|
176 |
@accessibility
|
|
|
177 |
Scenario: A teacher can collapse and expand the grade categories in the bulk modal using the keyboard
|
|
|
178 |
Given I set the field "Grade item 1" to "1"
|
|
|
179 |
And I press tab key in "sticky-footer" "region"
|
|
|
180 |
And the focused element is "Move" "button" in the "sticky-footer" "region"
|
|
|
181 |
And I press enter
|
|
|
182 |
And "Move items" "dialogue" should exist
|
|
|
183 |
And I press tab
|
|
|
184 |
And the focused element is "Close" "button" in the "Move items" "dialogue"
|
|
|
185 |
And I press tab
|
|
|
186 |
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
|
|
|
187 |
And I press the down key
|
|
|
188 |
Then the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
|
|
|
189 |
And I press the down key
|
|
|
190 |
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
|
|
|
191 |
And "Collapse" "link" should exist in the "Category 2" "list_item"
|
|
|
192 |
# Collapse "Category 2" category.
|
|
|
193 |
When I press the left key
|
|
|
194 |
Then "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
195 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
196 |
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
197 |
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
198 |
And "Expand" "link" should exist in the "Category 2" "list_item"
|
|
|
199 |
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
|
|
|
200 |
And the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
|
|
|
201 |
And "Collapse" "link" should exist in the "Category 2" "list_item"
|
|
|
202 |
# Collapse "Category 1" category.
|
|
|
203 |
And I press the left key
|
|
|
204 |
And "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
205 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
206 |
And "Category 2" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
207 |
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
208 |
And "Expand" "link" should exist in the "Category 1" "list_item"
|
|
|
209 |
And I press the down key
|
|
|
210 |
# Expand "Category 1" category.
|
|
|
211 |
And I press the right key
|
|
|
212 |
And "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
213 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
214 |
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
215 |
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
|
|
|
216 |
And "Collapse" "link" should exist in the "Category 1" "list_item"
|
|
|
217 |
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
|
|
|
218 |
# Expand "Category 2" category.
|
|
|
219 |
And I press the right key
|
|
|
220 |
And "Course" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
221 |
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
222 |
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
223 |
And "Category 3" "list_item" in the "Move items" "dialogue" should be visible
|
|
|
224 |
And "Collapse" "link" should exist in the "Category 2" "list_item"
|
|
|
225 |
|
|
|
226 |
@accessibility
|
|
|
227 |
Scenario: A teacher can move multiple items to a category using the keyboard
|
|
|
228 |
Given I set the following fields to these values:
|
|
|
229 |
| Grade item 1 | 1 |
|
|
|
230 |
| Grade item 2 | 1 |
|
|
|
231 |
And I press tab key in "sticky-footer" "region"
|
|
|
232 |
And the focused element is "Move" "button" in the "sticky-footer" "region"
|
|
|
233 |
And I press enter
|
|
|
234 |
And "Move items" "dialogue" should exist
|
|
|
235 |
And I press tab
|
|
|
236 |
And the focused element is "Close" "button" in the "Move items" "dialogue"
|
|
|
237 |
And I press tab
|
|
|
238 |
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
|
|
|
239 |
And I press the down key
|
|
|
240 |
And the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
|
|
|
241 |
And I press the down key
|
|
|
242 |
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
|
|
|
243 |
And I press the down key
|
|
|
244 |
And the focused element is "Category 3" "list_item" in the "Move items" "dialogue"
|
|
|
245 |
And the "data-selected" attribute of "Category 3" "list_item" should contain "false"
|
|
|
246 |
# Select the grade category "Category 2".
|
|
|
247 |
And I press enter
|
|
|
248 |
And the "data-selected" attribute of "Category 3" "list_item" should contain "true"
|
|
|
249 |
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
|
|
|
250 |
And I press tab
|
|
|
251 |
And the focused element is "Cancel" "button" in the "Move items" "dialogue"
|
|
|
252 |
And I press tab
|
|
|
253 |
And the focused element is "Move" "button" in the "Move items" "dialogue"
|
|
|
254 |
When I press the enter key
|
|
|
255 |
And I wait until the page is ready
|
|
|
256 |
And I wait "2" seconds
|
|
|
257 |
And I press tab key in "region-main" "region"
|
|
|
258 |
# Confirm that 'Grade item 1' and 'Grade item 2' have been moved to 'Category 3'
|
|
|
259 |
And I click on grade item menu "Grade item 1" of type "gradeitem" on "setup" page
|
|
|
260 |
And I choose "Edit grade item" in the open action menu
|
|
|
261 |
And I wait until "Edit grade item" "dialogue" exists
|
|
|
262 |
Then I should see "Category 3" in the "Grade category" "form_row"
|
|
|
263 |
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
|
|
|
264 |
And I click on grade item menu "Grade item 2" of type "gradeitem" on "setup" page
|
|
|
265 |
And I choose "Edit grade item" in the open action menu
|
|
|
266 |
And I wait until "Edit grade item" "dialogue" exists
|
|
|
267 |
And I should see "Category 3" in the "Grade category" "form_row"
|