MDL-49963 core: Select all button on participant list works across pages
[moodle.git] / user / tests / behat / view_participants.feature
1 @core @core_user
2 Feature: View course participants
3   In order to know who is on a course
4   As a teacher
5   I need to be able to view the participants on a course
7   Background:
8     Given the following "users" exist:
9       | username  | firstname | lastname | email                 |
10       | teacher1  | Teacher   | 1        | teacher1@example.com  |
11       | student1  | Student   | 1        | student1@example.com  |
12       | student2  | Student   | 2        | student2@example.com  |
13       | student3  | Student   | 3        | student3@example.com  |
14       | student4  | Student   | 4        | student4@example.com  |
15       | student5  | Student   | 5        | student5@example.com  |
16       | student6  | Student   | 6        | student6@example.com  |
17       | student7  | Student   | 7        | student7@example.com  |
18       | student8  | Student   | 8        | student8@example.com  |
19       | student9  | Student   | 9        | student9@example.com  |
20       | student10 | Student   | 10       | student10@example.com |
21       | student11 | Student   | 11       | student11@example.com |
22       | student12 | Student   | 12       | student12@example.com |
23       | student13 | Student   | 13       | student13@example.com |
24       | student14 | Student   | 14       | student14@example.com |
25       | student15 | Student   | 15       | student15@example.com |
26       | student16 | Student   | 16       | student16@example.com |
27       | student17 | Student   | 17       | student17@example.com |
28       | student18 | Student   | 18       | student18@example.com |
29       | student19 | Student   | 19       | student19@example.com |
30       | student20 | Student   | 20       | student20@example.com |
31     And the following "courses" exist:
32       | fullname | shortname | format |
33       | Course 1 | C1        | topics |
34     And the following "course enrolments" exist:
35       | user      | course | role           |
36       | teacher1  | C1     | editingteacher |
37       | student1  | C1     | student        |
38       | student2  | C1     | student        |
39       | student3  | C1     | student        |
40       | student4  | C1     | student        |
41       | student5  | C1     | student        |
42       | student6  | C1     | student        |
43       | student7  | C1     | student        |
44       | student8  | C1     | student        |
45       | student9  | C1     | student        |
46       | student10 | C1     | student        |
47       | student11 | C1     | student        |
48       | student12 | C1     | student        |
49       | student13 | C1     | student        |
50       | student14 | C1     | student        |
51       | student15 | C1     | student        |
52       | student16 | C1     | student        |
53       | student17 | C1     | student        |
54       | student18 | C1     | student        |
55       | student19 | C1     | student        |
57   @javascript
58   Scenario: Use select and deselect all buttons
59     When I log in as "teacher1"
60     And I follow "Course 1"
61     And I follow "Participants"
62     And I press "Select all"
63     Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
64     Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
65     Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
66     Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
67     Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
68     Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
69     Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
70     Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
71     Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
72     Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
73     Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
74     Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
75     Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
76     Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
77     Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
78     Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
79     Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
80     Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
81     Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
82     Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
84     And I press "Deselect all"
85     Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
86     Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
87     Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
88     Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
89     Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
90     Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
91     Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
92     Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
93     Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
94     Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
95     Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
96     Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
97     Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
98     Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
99     Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
100     Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
101     Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
102     Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
103     Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
104     Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
106   @javascript
107   Scenario: Use select all users on this page, select all n users and deselect all
108     And the following "course enrolments" exist:
109       | user      | course | role    |
110       | student20 | C1     | student |
111     When I log in as "teacher1"
112     And I follow "Course 1"
113     And I follow "Participants"
114     And I press "Select all users on this page"
115     Then I should not see "Student 11"
116     Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
117     Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
118     Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
119     Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
120     Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
121     Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
122     Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
123     Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
124     Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
125     Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
126     Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
127     Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
128     Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
129     Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
130     Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
131     Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
132     Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
133     Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
134     Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
135     Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
137     And I press "Deselect all"
138     Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
139     Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
140     Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
141     Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
142     Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
143     Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
144     Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
145     Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
146     Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
147     Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
148     Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
149     Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
150     Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
151     Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
152     Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
153     Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
154     Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
155     Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
156     Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
157     Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
159     And I press "Select all 21 users"
160     Then I should see "Student 11"
161     Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1"
162     Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1"
163     Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"
164     Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "1"
165     Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "1"
166     Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "1"
167     Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "1"
168     Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "1"
169     Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "1"
170     Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "1"
171     Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "1"
172     Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "1"
173     Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "1"
174     Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "1"
175     Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "1"
176     Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "1"
177     Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "1"
178     Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "1"
179     Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "1"
180     Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "1"
181     Then the field with xpath "//tbody//tr[21]//input[@class='usercheckbox']" matches value "1"
183     And I press "Deselect all"
184     Then the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "0"
185     Then the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "0"
186     Then the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "0"
187     Then the field with xpath "//tbody//tr[4]//input[@class='usercheckbox']" matches value "0"
188     Then the field with xpath "//tbody//tr[5]//input[@class='usercheckbox']" matches value "0"
189     Then the field with xpath "//tbody//tr[6]//input[@class='usercheckbox']" matches value "0"
190     Then the field with xpath "//tbody//tr[7]//input[@class='usercheckbox']" matches value "0"
191     Then the field with xpath "//tbody//tr[8]//input[@class='usercheckbox']" matches value "0"
192     Then the field with xpath "//tbody//tr[9]//input[@class='usercheckbox']" matches value "0"
193     Then the field with xpath "//tbody//tr[10]//input[@class='usercheckbox']" matches value "0"
194     Then the field with xpath "//tbody//tr[11]//input[@class='usercheckbox']" matches value "0"
195     Then the field with xpath "//tbody//tr[12]//input[@class='usercheckbox']" matches value "0"
196     Then the field with xpath "//tbody//tr[13]//input[@class='usercheckbox']" matches value "0"
197     Then the field with xpath "//tbody//tr[14]//input[@class='usercheckbox']" matches value "0"
198     Then the field with xpath "//tbody//tr[15]//input[@class='usercheckbox']" matches value "0"
199     Then the field with xpath "//tbody//tr[16]//input[@class='usercheckbox']" matches value "0"
200     Then the field with xpath "//tbody//tr[17]//input[@class='usercheckbox']" matches value "0"
201     Then the field with xpath "//tbody//tr[18]//input[@class='usercheckbox']" matches value "0"
202     Then the field with xpath "//tbody//tr[19]//input[@class='usercheckbox']" matches value "0"
203     Then the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0"
204     Then the field with xpath "//tbody//tr[21]//input[@class='usercheckbox']" matches value "0"