Commit | Line | Data |
---|---|---|
9651e491 JP |
1 | @core @core_user |
2 | Feature: Course participants can be filtered | |
3 | In order to filter the list of course participants | |
4 | As a user | |
5 | I need to visit the course participants page and apply the appropriate filters | |
6 | ||
7 | Background: | |
8 | Given the following "courses" exist: | |
9 | | fullname | shortname | groupmode | | |
10 | | Course 1 | C1 | 1 | | |
11 | | Course 2 | C2 | 0 | | |
12 | And the following "users" exist: | |
e52856bc JP |
13 | | username | firstname | lastname | email | idnumber | country | city | maildisplay | |
14 | | student1 | Student | 1 | student1@example.com | SID1 | | SCITY1 | 0 | | |
15 | | student2 | Student | 2 | student2@example.com | SID2 | GB | SCITY2 | 1 | | |
16 | | student3 | Student | 3 | student3@example.com | SID3 | AU | SCITY3 | 0 | | |
17 | | student4 | Student | 4 | student4@example.com | SID4 | AT | SCITY4 | 0 | | |
18 | | teacher1 | Teacher | 1 | teacher1@example.com | TID1 | US | TCITY1 | 0 | | |
9651e491 JP |
19 | And the following "course enrolments" exist: |
20 | | user | course | role | status | timeend | | |
21 | | student1 | C1 | student | 0 | | | |
22 | | student2 | C1 | student | 1 | | | |
23 | | student3 | C1 | student | 0 | | | |
24 | | student4 | C1 | student | 0 | ##yesterday## | | |
25 | | student1 | C2 | student | 0 | | | |
26 | | student2 | C2 | student | 0 | | | |
27 | | student3 | C2 | student | 0 | | | |
28 | | teacher1 | C1 | editingteacher | 0 | | | |
29 | | teacher1 | C2 | editingteacher | 0 | | | |
30 | And the following "groups" exist: | |
31 | | name | course | idnumber | | |
32 | | Group 1 | C1 | G1 | | |
33 | | Group 2 | C1 | G2 | | |
34 | And the following "group members" exist: | |
35 | | user | group | | |
36 | | student2 | G1 | | |
37 | | student2 | G2 | | |
38 | | student3 | G2 | | |
39 | ||
40 | @javascript | |
41 | Scenario: No filters applied | |
42 | Given I log in as "teacher1" | |
43 | And I am on "Course 1" course homepage | |
44 | And I navigate to course participants | |
9651e491 JP |
45 | Then I should see "Student 1" in the "participants" "table" |
46 | And I should see "Student 2" in the "participants" "table" | |
47 | And I should see "Student 3" in the "participants" "table" | |
48 | And I should see "Teacher 1" in the "participants" "table" | |
49 | ||
50 | @javascript | |
51 | Scenario Outline: Filter users for a course | |
52 | Given I log in as "teacher1" | |
53 | And I am on "Course 1" course homepage | |
54 | And I navigate to course participants | |
55 | When I open the autocomplete suggestions list | |
56 | And I click on "<filter1>" item in the autocomplete list | |
9651e491 JP |
57 | Then I should see "<expected1>" in the "participants" "table" |
58 | And I should see "<expected2>" in the "participants" "table" | |
59 | And I should see "<expected3>" in the "participants" "table" | |
60 | And I should not see "<notexpected1>" in the "participants" "table" | |
61 | And I should not see "<notexpected2>" in the "participants" "table" | |
62 | # Note the 'XX-IGNORE-XX' elements are for when there is less than 2 'not expected' items. | |
63 | Examples: | |
64 | | filter1 | expected1 | expected2 | expected3 | notexpected1 | notexpected2 | | |
65 | | Group: Group 1 | Student 2 | | | Student 1 | Student 3 | | |
66 | | Group: Group 2 | Student 2 | Student 3 | | Student 1 | XX-IGNORE-XX | | |
67 | | Role: Teacher | Teacher 1 | | | Student 1 | Student 2 | | |
68 | | Status: Active | Teacher 1 | Student 1 | Student 3 | Student 2 | Student 4 | | |
69 | | Status: Inactive | Student 2 | Student 4 | | Teacher 1 | Student 1 | | |
70 | ||
71 | @javascript | |
72 | Scenario: Multiple filters applied | |
73 | Given I log in as "teacher1" | |
74 | And I am on "Course 1" course homepage | |
75 | And I navigate to course participants | |
76 | When I open the autocomplete suggestions list | |
77 | And I click on "Role: Student" item in the autocomplete list | |
78 | And I open the autocomplete suggestions list | |
79 | And I click on "Status: Active" item in the autocomplete list | |
9651e491 JP |
80 | Then I should see "Student 1" in the "participants" "table" |
81 | And I should see "Student 3" in the "participants" "table" | |
82 | And I should not see "Student 2" in the "participants" "table" | |
83 | And I should not see "Student 4" in the "participants" "table" | |
84 | And I should not see "Teacher 1" in the "participants" "table" | |
a3bfb41c JP |
85 | # Add more filters. |
86 | And I open the autocomplete suggestions list | |
87 | And I click on "Enrolment methods: Manual enrolments" item in the autocomplete list | |
88 | And I open the autocomplete suggestions list | |
89 | And I click on "Group: Group 2" item in the autocomplete list | |
90 | And I should see "Student 3" in the "participants" "table" | |
91 | But I should not see "Teacher 1" in the "participants" "table" | |
92 | And I should not see "Student 1" in the "participants" "table" | |
93 | And I should not see "Student 2" in the "participants" "table" | |
94 | And I should not see "Student 4" in the "participants" "table" | |
95 | # Deselect the active status filter. | |
96 | And I click on "Status: Active" "text" in the ".form-autocomplete-selection" "css_element" | |
97 | # Apply Status: Inactive filter. | |
98 | And I open the autocomplete suggestions list | |
99 | And I click on "Status: Inactive" item in the autocomplete list | |
100 | Then I should see "Student 2" in the "participants" "table" | |
101 | But I should not see "Student 4" in the "participants" "table" | |
102 | And I should not see "Student 1" in the "participants" "table" | |
103 | And I should not see "Student 3" in the "participants" "table" | |
104 | And I should not see "Teacher 1" in the "participants" "table" | |
9651e491 JP |
105 | |
106 | @javascript | |
107 | Scenario: Filter by keyword | |
108 | Given I log in as "teacher1" | |
109 | And I am on "Course 1" course homepage | |
110 | And I navigate to course participants | |
446b21b5 | 111 | # Note: This is the literal string "student", not the Role student. |
9651e491 JP |
112 | When I set the field "Filters" to "student" |
113 | And I press key "13" in the field "Filters" | |
9651e491 JP |
114 | Then I should see "Student 1" in the "participants" "table" |
115 | And I should see "Student 2" in the "participants" "table" | |
116 | And I should see "Student 3" in the "participants" "table" | |
117 | And I should see "Student 4" in the "participants" "table" | |
118 | And I should not see "Teacher 1" in the "participants" "table" | |
119 | ||
7fde8358 | 120 | @javascript |
121 | Scenario: Reorder users without losing filter | |
122 | Given I log in as "teacher1" | |
123 | And I am on "Course 1" course homepage | |
124 | And I navigate to course participants | |
125 | And I open the autocomplete suggestions list | |
126 | And I click on "Role: Student" item in the autocomplete list | |
127 | When I click on "Surname" "link" | |
128 | Then I should see "Role: Student" | |
129 | And I should see "Student 1" in the "participants" "table" | |
130 | And I should see "Student 2" in the "participants" "table" | |
131 | And I should see "Student 3" in the "participants" "table" | |
132 | And I should see "Student 4" in the "participants" "table" | |
133 | And I should not see "Teacher 1" in the "participants" "table" | |
134 | ||
9651e491 JP |
135 | @javascript |
136 | Scenario: Rendering filter options for teachers in a course that don't support groups | |
137 | Given I log in as "teacher1" | |
138 | And I am on "Course 2" course homepage | |
139 | And I navigate to course participants | |
140 | When I open the autocomplete suggestions list | |
141 | Then I should see "Role:" in the ".form-autocomplete-suggestions" "css_element" | |
142 | And I should see "Enrolment methods:" in the ".form-autocomplete-suggestions" "css_element" | |
143 | But I should not see "Group:" in the ".form-autocomplete-suggestions" "css_element" | |
144 | ||
145 | @javascript | |
146 | Scenario: Rendering filter options for students who have limited privileges | |
147 | Given I log in as "student1" | |
148 | And I am on "Course 2" course homepage | |
149 | And I navigate to course participants | |
150 | When I open the autocomplete suggestions list | |
151 | Then I should see "Role:" in the ".form-autocomplete-suggestions" "css_element" | |
152 | But I should not see "Status:" in the ".form-autocomplete-suggestions" "css_element" | |
153 | And I should not see "Enrolment methods:" in the ".form-autocomplete-suggestions" "css_element" | |
e52856bc JP |
154 | |
155 | @javascript | |
156 | Scenario: Filter by user identity fields | |
157 | Given I log in as "teacher1" | |
158 | And the following config values are set as admin: | |
159 | | showuseridentity | idnumber,email,city,country | | |
160 | And I am on "Course 1" course homepage | |
161 | And I navigate to course participants | |
162 | # Search by email (only). | |
163 | When I set the field "Filters" to "student1@example.com" | |
164 | And I press key "13" in the field "Filters" | |
165 | Then I should see "Student 1" in the "participants" "table" | |
166 | And I should not see "Student 2" in the "participants" "table" | |
167 | And I should not see "Teacher 1" in the "participants" "table" | |
168 | # Search by idnumber (only). | |
8420b61c JP |
169 | And I click on "student1@example.com" "text" in the ".form-autocomplete-selection" "css_element" |
170 | And I set the field "Filters" to "SID" | |
e52856bc | 171 | And I press key "13" in the field "Filters" |
8420b61c | 172 | And I should see "Student 1" in the "participants" "table" |
e52856bc JP |
173 | And I should see "Student 2" in the "participants" "table" |
174 | And I should see "Student 3" in the "participants" "table" | |
175 | And I should see "Student 4" in the "participants" "table" | |
176 | And I should not see "Teacher 1" in the "participants" "table" | |
177 | # Search by city (only). | |
8420b61c JP |
178 | And I click on "SID" "text" in the ".form-autocomplete-selection" "css_element" |
179 | And I set the field "Filters" to "SCITY" | |
e52856bc | 180 | And I press key "13" in the field "Filters" |
8420b61c | 181 | And I should see "Student 1" in the "participants" "table" |
e52856bc JP |
182 | And I should see "Student 2" in the "participants" "table" |
183 | And I should see "Student 3" in the "participants" "table" | |
184 | And I should see "Student 4" in the "participants" "table" | |
185 | And I should not see "Teacher 1" in the "participants" "table" | |
186 | # Search by country text (only) - should not match. | |
8420b61c JP |
187 | And I click on "SCITY" "text" in the ".form-autocomplete-selection" "css_element" |
188 | And I set the field "Filters" to "GB" | |
e52856bc | 189 | And I press key "13" in the field "Filters" |
8420b61c | 190 | And I should see "Nothing to display" |
e52856bc | 191 | # Check no match. |
8420b61c JP |
192 | And I click on "GB" "text" in the ".form-autocomplete-selection" "css_element" |
193 | And I set the field "Filters" to "NOTHING" | |
194 | And I press key "13" in the field "Filters" | |
195 | And I should see "Nothing to display" | |
e52856bc JP |
196 | |
197 | @javascript | |
198 | Scenario: Filter by user identity fields when cannot see the field data | |
199 | Given I log in as "admin" | |
200 | And I set the following system permissions of "Teacher" role: | |
201 | | moodle/site:viewuseridentity | Prevent | | |
202 | And the following config values are set as admin: | |
203 | | showuseridentity | idnumber,email,city,country | | |
204 | And I log out | |
205 | And I log in as "teacher1" | |
206 | And I am on "Course 1" course homepage | |
207 | And I navigate to course participants | |
208 | # Search by email (only) - should only see visible email + own. | |
209 | When I set the field "Filters" to "@example.com" | |
210 | And I press key "13" in the field "Filters" | |
211 | Then I should not see "Student 1" in the "participants" "table" | |
212 | And I should see "Student 2" in the "participants" "table" | |
213 | And I should not see "Student 3" in the "participants" "table" | |
214 | And I should not see "Student 4" in the "participants" "table" | |
215 | And I should see "Teacher 1" in the "participants" "table" | |
216 | # Search for other fields - should only see own results. | |
8420b61c JP |
217 | And I click on "@example.com" "text" in the ".form-autocomplete-selection" "css_element" |
218 | And I set the field "Filters" to "SID" | |
e52856bc | 219 | And I press key "13" in the field "Filters" |
8420b61c JP |
220 | And I should see "Nothing to display" |
221 | And I click on "SID" "text" in the ".form-autocomplete-selection" "css_element" | |
222 | And I set the field "Filters" to "TID" | |
e52856bc | 223 | And I press key "13" in the field "Filters" |
8420b61c JP |
224 | And I should see "Teacher 1" in the "participants" "table" |
225 | And I set the field "Filters" to "CITY" | |
226 | And I press key "13" in the field "Filters" | |
227 | And I should see "Teacher 1" in the "participants" "table" | |
e52856bc JP |
228 | And I should not see "Student 1" in the "participants" "table" |
229 | # Check no match. | |
8420b61c JP |
230 | And I set the field "Filters" to "NOTHING" |
231 | And I press key "13" in the field "Filters" | |
232 | And I should see "Nothing to display" |