1 |
efrain |
1 |
@core @core_courseformat @show_editor @javascript
|
|
|
2 |
Feature: Bulk activity and section selection.
|
|
|
3 |
In order to edit the course activities
|
|
|
4 |
As a teacher with capability 'moodle/course:manageactivities'
|
|
|
5 |
I need to be able to bulk select activities or sections.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "course" exists:
|
|
|
9 |
| fullname | Course 1 |
|
|
|
10 |
| shortname | C1 |
|
|
|
11 |
| category | 0 |
|
|
|
12 |
| numsections | 4 |
|
|
|
13 |
| initsections | 1 |
|
|
|
14 |
And the following "activities" exist:
|
|
|
15 |
| activity | name | intro | course | idnumber | section |
|
|
|
16 |
| assign | Activity sample 1 | Test assignment description | C1 | sample1 | 1 |
|
|
|
17 |
| assign | Activity sample 2 | Test assignment description | C1 | sample2 | 1 |
|
|
|
18 |
| assign | Activity sample 3 | Test assignment description | C1 | sample3 | 2 |
|
|
|
19 |
| assign | Activity sample 4 | Test assignment description | C1 | sample4 | 2 |
|
|
|
20 |
And the following "users" exist:
|
|
|
21 |
| username | firstname | lastname | email |
|
|
|
22 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
23 |
And the following "course enrolments" exist:
|
|
|
24 |
| user | course | role |
|
|
|
25 |
| teacher1 | C1 | editingteacher |
|
|
|
26 |
And I am on the "C1" "Course" page logged in as "teacher1"
|
|
|
27 |
And I turn editing mode on
|
|
|
28 |
|
|
|
29 |
Scenario: Enable and disable bulk editing
|
|
|
30 |
When I click on "Bulk actions" "button"
|
|
|
31 |
Then I should see "0 selected" in the "sticky-footer" "region"
|
|
|
32 |
And the focused element is "Select section Section 1" "checkbox"
|
|
|
33 |
And I click on "Close bulk actions" "button" in the "sticky-footer" "region"
|
|
|
34 |
And "sticky-footer" "region" should not be visible
|
|
|
35 |
And the focused element is "Bulk actions" "button"
|
|
|
36 |
|
|
|
37 |
Scenario: Selecting activities disable section selection
|
|
|
38 |
Given I click on "Bulk actions" "button"
|
|
|
39 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
40 |
When I click on "Select activity Activity sample 1" "checkbox"
|
|
|
41 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
42 |
Then the "Select section Section 1" "checkbox" should be disabled
|
|
|
43 |
|
|
|
44 |
Scenario: Selecting sections disable activity selection
|
|
|
45 |
Given I click on "Bulk actions" "button"
|
|
|
46 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
47 |
When I click on "Select section Section 1" "checkbox"
|
|
|
48 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
49 |
Then the "Select activity Activity sample 1" "checkbox" should be disabled
|
|
|
50 |
|
|
|
51 |
Scenario: Disable bulk resets the selection
|
|
|
52 |
Given I click on "Bulk actions" "button"
|
|
|
53 |
And I click on "Select activity Activity sample 1" "checkbox"
|
|
|
54 |
And I click on "Select activity Activity sample 2" "checkbox"
|
|
|
55 |
And I should see "2 selected" in the "sticky-footer" "region"
|
|
|
56 |
And the field "Activity sample 1" matches value "1"
|
|
|
57 |
And the field "Activity sample 2" matches value "1"
|
|
|
58 |
And the field "Activity sample 3" matches value ""
|
|
|
59 |
And the field "Activity sample 4" matches value ""
|
|
|
60 |
When I click on "Close bulk actions" "button" in the "sticky-footer" "region"
|
|
|
61 |
And I click on "Bulk actions" "button"
|
|
|
62 |
Then I should see "0 selected" in the "sticky-footer" "region"
|
|
|
63 |
And the field "Activity sample 1" matches value ""
|
|
|
64 |
And the field "Activity sample 2" matches value ""
|
|
|
65 |
And the field "Activity sample 3" matches value ""
|
|
|
66 |
And the field "Activity sample 4" matches value ""
|
|
|
67 |
|
|
|
68 |
Scenario: Select all is disabled until an activity is selected
|
|
|
69 |
Given I click on "Bulk actions" "button"
|
|
|
70 |
And the "Select all" "checkbox" should be disabled
|
|
|
71 |
When I click on "Select activity Activity sample 1" "checkbox"
|
|
|
72 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
73 |
Then the "Select all" "checkbox" should be enabled
|
|
|
74 |
|
|
|
75 |
Scenario: Select all is disabled until a section is selected
|
|
|
76 |
Given I click on "Bulk actions" "button"
|
|
|
77 |
And the "Select all" "checkbox" should be disabled
|
|
|
78 |
When I click on "Select section Section 1" "checkbox"
|
|
|
79 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
80 |
Then the "Select all" "checkbox" should be enabled
|
|
|
81 |
|
|
|
82 |
Scenario: Select all when an activity is selected will select all activities
|
|
|
83 |
Given I click on "Bulk actions" "button"
|
|
|
84 |
And I click on "Select activity Activity sample 1" "checkbox"
|
|
|
85 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
86 |
And the field "Activity sample 1" matches value "1"
|
|
|
87 |
And the field "Activity sample 2" matches value ""
|
|
|
88 |
And the field "Activity sample 3" matches value ""
|
|
|
89 |
And the field "Activity sample 4" matches value ""
|
|
|
90 |
And the "Select all" "checkbox" should be enabled
|
|
|
91 |
When I click on "Select all" "checkbox" in the "sticky-footer" "region"
|
|
|
92 |
Then I should see "4 selected" in the "sticky-footer" "region"
|
|
|
93 |
And the field "Activity sample 1" matches value "1"
|
|
|
94 |
And the field "Activity sample 2" matches value "1"
|
|
|
95 |
And the field "Activity sample 3" matches value "1"
|
|
|
96 |
And the field "Activity sample 4" matches value "1"
|
|
|
97 |
|
|
|
98 |
Scenario: Select all when a section is selected will select all sections
|
|
|
99 |
Given I click on "Bulk actions" "button"
|
|
|
100 |
And I click on "Select section Section 1" "checkbox"
|
|
|
101 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
102 |
And the field "Select section Section 1" matches value "1"
|
|
|
103 |
And the field "Select section Section 2" matches value ""
|
|
|
104 |
And the field "Select section Section 3" matches value ""
|
|
|
105 |
And the field "Select section Section 4" matches value ""
|
|
|
106 |
And the "Select all" "checkbox" should be enabled
|
|
|
107 |
When I click on "Select all" "checkbox" in the "sticky-footer" "region"
|
|
|
108 |
Then I should see "4 selected" in the "sticky-footer" "region"
|
|
|
109 |
And the field "Select section Section 1" matches value "1"
|
|
|
110 |
And the field "Select section Section 2" matches value "1"
|
|
|
111 |
And the field "Select section Section 3" matches value "1"
|
|
|
112 |
And the field "Select section Section 4" matches value "1"
|
|
|
113 |
|
|
|
114 |
Scenario: Click on a select all with all sections selected unselects all sections
|
|
|
115 |
Given I click on "Bulk actions" "button"
|
|
|
116 |
And I click on "Select section Section 1" "checkbox"
|
|
|
117 |
And I click on "Select section Section 2" "checkbox"
|
|
|
118 |
And I click on "Select section Section 3" "checkbox"
|
|
|
119 |
And I click on "Select section Section 4" "checkbox"
|
|
|
120 |
And I should see "4 selected" in the "sticky-footer" "region"
|
|
|
121 |
And the "Select all" "checkbox" should be enabled
|
|
|
122 |
When I click on "Select all" "checkbox" in the "sticky-footer" "region"
|
|
|
123 |
Then I should see "0 selected" in the "sticky-footer" "region"
|
|
|
124 |
And the focused element is "Select section Section 1" "checkbox"
|
|
|
125 |
And the field "Select section Section 1" matches value ""
|
|
|
126 |
And the field "Select section Section 2" matches value ""
|
|
|
127 |
And the field "Select section Section 3" matches value ""
|
|
|
128 |
And the field "Select section Section 4" matches value ""
|
|
|
129 |
|
|
|
130 |
Scenario: Click on a select all with all activity selected unselects all activities
|
|
|
131 |
Given I click on "Bulk actions" "button"
|
|
|
132 |
And I click on "Select activity Activity sample 1" "checkbox"
|
|
|
133 |
And I click on "Select activity Activity sample 2" "checkbox"
|
|
|
134 |
And I click on "Select activity Activity sample 3" "checkbox"
|
|
|
135 |
And I click on "Select activity Activity sample 4" "checkbox"
|
|
|
136 |
And I should see "4 selected" in the "sticky-footer" "region"
|
|
|
137 |
And the "Select all" "checkbox" should be enabled
|
|
|
138 |
When I click on "Select all" "checkbox" in the "sticky-footer" "region"
|
|
|
139 |
Then I should see "0 selected" in the "sticky-footer" "region"
|
|
|
140 |
And the focused element is "Select section Section 1" "checkbox"
|
|
|
141 |
And the field "Activity sample 1" matches value ""
|
|
|
142 |
And the field "Activity sample 2" matches value ""
|
|
|
143 |
And the field "Activity sample 3" matches value ""
|
|
|
144 |
And the field "Activity sample 4" matches value ""
|
|
|
145 |
|
|
|
146 |
Scenario: Click an activity name in bulk mode select and unselects the activity
|
|
|
147 |
Given I click on "Bulk actions" "button"
|
|
|
148 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
149 |
When I click on "Activity sample 1" "link" in the "Section 1" "section"
|
|
|
150 |
And the field "Activity sample 1" matches value "1"
|
|
|
151 |
And the field "Activity sample 2" matches value ""
|
|
|
152 |
And the field "Activity sample 3" matches value ""
|
|
|
153 |
And the field "Activity sample 4" matches value ""
|
|
|
154 |
And I click on "Activity sample 2" "link" in the "Section 1" "section"
|
|
|
155 |
And the field "Activity sample 1" matches value "1"
|
|
|
156 |
And the field "Activity sample 2" matches value "1"
|
|
|
157 |
And the field "Activity sample 3" matches value ""
|
|
|
158 |
And the field "Activity sample 4" matches value ""
|
|
|
159 |
And I should see "2 selected" in the "sticky-footer" "region"
|
|
|
160 |
Then I click on "Activity sample 1" "link" in the "Section 1" "section"
|
|
|
161 |
And I should see "1 selected" in the "sticky-footer" "region"
|
|
|
162 |
And the field "Activity sample 1" matches value ""
|
|
|
163 |
And the field "Activity sample 2" matches value "1"
|
|
|
164 |
And the field "Activity sample 3" matches value ""
|
|
|
165 |
And the field "Activity sample 4" matches value ""
|
|
|
166 |
|
|
|
167 |
Scenario: Select a range of activities using shift
|
|
|
168 |
Given I click on "Bulk actions" "button"
|
|
|
169 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
170 |
When I click on "Activity sample 1" "link" in the "Section 1" "section"
|
|
|
171 |
And the field "Activity sample 1" matches value "1"
|
|
|
172 |
And the field "Activity sample 2" matches value ""
|
|
|
173 |
And the field "Activity sample 3" matches value ""
|
|
|
174 |
And the field "Activity sample 4" matches value ""
|
|
|
175 |
And I shift click on "Activity sample 3" "link" in the "Section 2" "section"
|
|
|
176 |
Then I should see "3 selected" in the "sticky-footer" "region"
|
|
|
177 |
And the field "Activity sample 1" matches value "1"
|
|
|
178 |
And the field "Activity sample 2" matches value "1"
|
|
|
179 |
And the field "Activity sample 3" matches value "1"
|
|
|
180 |
And the field "Activity sample 4" matches value ""
|
|
|
181 |
|
|
|
182 |
Scenario: Select all activities in a section using alt
|
|
|
183 |
Given I click on "Bulk actions" "button"
|
|
|
184 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
185 |
When I alt click on "Activity sample 3" "link" in the "Section 2" "section"
|
|
|
186 |
Then I should see "2 selected" in the "sticky-footer" "region"
|
|
|
187 |
And the field "Activity sample 1" matches value ""
|
|
|
188 |
And the field "Activity sample 2" matches value ""
|
|
|
189 |
And the field "Activity sample 3" matches value "1"
|
|
|
190 |
And the field "Activity sample 4" matches value "1"
|
|
|
191 |
|
|
|
192 |
Scenario: Select a range of sections using shift
|
|
|
193 |
Given I click on "Bulk actions" "button"
|
|
|
194 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
195 |
When I click on "Select section Section 1" "checkbox"
|
|
|
196 |
And the field "Select section Section 1" matches value "1"
|
|
|
197 |
And the field "Select section Section 2" matches value ""
|
|
|
198 |
And the field "Select section Section 3" matches value ""
|
|
|
199 |
And the field "Select section Section 4" matches value ""
|
|
|
200 |
And I shift click on "Select section Section 3" "checkbox" in the "page" "region"
|
|
|
201 |
Then I should see "3 selected" in the "sticky-footer" "region"
|
|
|
202 |
And the field "Select section Section 1" matches value "1"
|
|
|
203 |
And the field "Select section Section 2" matches value "1"
|
|
|
204 |
And the field "Select section Section 3" matches value "1"
|
|
|
205 |
And the field "Select section Section 4" matches value ""
|
|
|
206 |
|
|
|
207 |
Scenario: Select all section with alt click
|
|
|
208 |
Given I click on "Bulk actions" "button"
|
|
|
209 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
210 |
And the field "Select section Section 1" matches value ""
|
|
|
211 |
And the field "Select section Section 2" matches value ""
|
|
|
212 |
And the field "Select section Section 3" matches value ""
|
|
|
213 |
And the field "Select section Section 4" matches value ""
|
|
|
214 |
When I alt click on "Select section Section 3" "checkbox" in the "page" "region"
|
|
|
215 |
And I should see "4 selected" in the "sticky-footer" "region"
|
|
|
216 |
And the field "Select section Section 1" matches value "1"
|
|
|
217 |
And the field "Select section Section 2" matches value "1"
|
|
|
218 |
And the field "Select section Section 3" matches value "1"
|
|
|
219 |
And the field "Select section Section 4" matches value "1"
|
|
|
220 |
|
|
|
221 |
Scenario: Bulk section selection is available also in one section per page
|
|
|
222 |
Given I navigate to "Settings" in current page administration
|
|
|
223 |
And I expand all fieldsets
|
|
|
224 |
And I set the field "Course layout" to "Show one section per page"
|
|
|
225 |
And I click on "Save and display" "button"
|
|
|
226 |
And I click on "Bulk actions" "button"
|
|
|
227 |
And I should see "0 selected" in the "sticky-footer" "region"
|
|
|
228 |
When I click on "Select section Section 1" "checkbox"
|
|
|
229 |
And I click on "Select section Section 2" "checkbox"
|
|
|
230 |
Then I should see "2 selected" in the "sticky-footer" "region"
|
|
|
231 |
|
|
|
232 |
Scenario: Bulk selection in small devices
|
|
|
233 |
Given I change the viewport size to "mobile"
|
|
|
234 |
And I close block drawer if open
|
|
|
235 |
When I click on "Bulk actions" "button"
|
|
|
236 |
Then I should not see "0 selected" in the "sticky-footer" "region"
|
|
|
237 |
And I should not see "Select all" in the "sticky-footer" "region"
|
|
|
238 |
And I should not see "Availability" in the "sticky-footer" "region"
|
|
|
239 |
And I should not see "Duplicate" in the "sticky-footer" "region"
|
|
|
240 |
And I should not see "Move" in the "sticky-footer" "region"
|
|
|
241 |
And I should not see "Delete" in the "sticky-footer" "region"
|
|
|
242 |
And I click on "Close bulk actions" "button" in the "sticky-footer" "region"
|
|
|
243 |
And "sticky-footer" "region" should not be visible
|