1@core @core_user 2Feature: 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 | startdate | 10 | Course 1 | C1 | 1 | ##5 months ago## | 11 | Course 2 | C2 | 0 | ##4 months ago## | 12 | Course 3 | C3 | 0 | ##3 months ago## | 13 And the following "custom profile fields" exist: 14 | datatype | shortname | name | 15 | text | frog | Favourite frog | 16 And the following "users" exist: 17 | username | firstname | lastname | email | idnumber | country | city | maildisplay | profile_field_frog | 18 | student1 | Student | 1 | student1@example.com | SID1 | | SCITY1 | 0 | Kermit | 19 | student2 | Student | 2 | student2@example.com | SID2 | GB | SCITY2 | 1 | Mr Toad | 20 | student3 | Student | 3 | student3@example.com | SID3 | AU | SCITY3 | 0 | | 21 | student4 | Student | 4 | student4@moodle.com | SID4 | AT | SCITY4 | 0 | | 22 | student5 | Trendy | Learnson | trendy@learnson.com | SID5 | AU | SCITY5 | 0 | | 23 | patricia | Patricia | Pea | patricia.pea1@example.org | TID1 | US | TCITY1 | 0 | | 24 And the following "course enrolments" exist: 25 | user | course | role | status | timeend | 26 | student1 | C1 | student | 0 | | 27 | student2 | C1 | student | 1 | | 28 | student3 | C1 | student | 0 | | 29 | student4 | C1 | student | 0 | ##yesterday## | 30 | student1 | C2 | student | 0 | | 31 | student2 | C2 | student | 0 | | 32 | student3 | C2 | student | 0 | | 33 | student5 | C2 | student | 0 | | 34 | student1 | C3 | student | 0 | | 35 | student2 | C3 | student | 0 | | 36 | student3 | C3 | student | 0 | | 37 | patricia | C1 | editingteacher | 0 | | 38 | patricia | C2 | editingteacher | 0 | | 39 | patricia | C3 | editingteacher | 0 | | 40 And the following "last access times" exist: 41 | user | course | lastaccess | 42 | student1 | C1 | ##yesterday## | 43 | student1 | C2 | ##2 weeks ago## | 44 | student2 | C1 | ##4 days ago## | 45 | student3 | C1 | ##2 weeks ago## | 46 | student4 | C1 | ##3 weeks ago## | 47 And the following "groups" exist: 48 | name | course | idnumber | 49 | Group 1 | C1 | G1 | 50 | Group 2 | C1 | G2 | 51 | Group A | C3 | GA | 52 | Group B | C3 | GB | 53 And the following "group members" exist: 54 | user | group | 55 | student2 | G1 | 56 | student2 | G2 | 57 | student3 | G2 | 58 | student1 | GA | 59 | student2 | GA | 60 | student2 | GB | 61 62 @javascript 63 Scenario: No filters applied 64 Given I am on the "C1" "Course" page logged in as "patricia" 65 And I navigate to course participants 66 Then I should see "Student 1" in the "participants" "table" 67 And I should see "Student 2" in the "participants" "table" 68 And I should see "Student 3" in the "participants" "table" 69 And I should see "Patricia Pea" in the "participants" "table" 70 71 @javascript 72 Scenario Outline: Filter users for a course with a single value 73 Given I am on the "C1" "Course" page logged in as "patricia" 74 And I navigate to course participants 75 And I set the field "Match" in the "Filter 1" "fieldset" to "<matchtype>" 76 And I set the field "type" in the "Filter 1" "fieldset" to "<filtertype>" 77 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "<filtervalue>" 78 When I click on "Apply filters" "button" 79 Then I should see "<expected1>" in the "participants" "table" 80 And I should see "<expected2>" in the "participants" "table" 81 And I should see "<expected3>" in the "participants" "table" 82 And I should not see "<notexpected1>" in the "participants" "table" 83 And I should not see "<notexpected2>" in the "participants" "table" 84 # Note the 'XX-IGNORE-XX' elements are for when there is less than 2 'not expected' items. 85 86 Examples: 87 | matchtype | filtertype | filtervalue | expected1 | expected2 | expected3 | notexpected1 | notexpected2 | 88 | Any | Groups | No group | Student 1 | Student 4 | Patricia Pea | Student 2 | Student 3 | 89 | All | Groups | No group | Student 1 | Student 4 | Patricia Pea | Student 2 | Student 3 | 90 | None | Groups | No group | Student 2 | Student 3 | | Student 1 | Patricia Pea | 91 | Any | Role | Student | Student 1 | Student 2 | Student 3 | Patricia Pea | XX-IGNORE-XX | 92 | All | Role | Student | Student 1 | Student 2 | Student 3 | Patricia Pea | XX-IGNORE-XX | 93 | None | Role | Student | Patricia Pea | | | Student 1 | Student 2 | 94 | Any | Status | Active | Student 1 | Student 3 | Patricia Pea | Student 2 | Student 4 | 95 | All | Status | Active | Student 1 | Student 3 | Patricia Pea | Student 2 | Student 4 | 96 | None | Status | Active | Student 2 | Student 4 | | Student 1 | Student 3 | 97 | Any | Inactive for more than | 1 week | Student 3 | Student 4 | | Student 1 | Student 2 | 98 | All | Inactive for more than | 1 week | Student 3 | Student 4 | | Student 1 | Student 2 | 99 | None | Inactive for more than | 1 week | Student 1 | Student 2 | Patricia Pea | Student 3 | XX-IGNORE-XX | 100 101 @javascript 102 Scenario Outline: Filter users for a course with multiple values for a single filter 103 Given I am on the "C1" "Course" page logged in as "patricia" 104 And I navigate to course participants 105 And I set the field "Match" in the "Filter 1" "fieldset" to "<matchtype>" 106 And I set the field "type" in the "Filter 1" "fieldset" to "<filtertype>" 107 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "<filtervalue1>,<filtervalue2>" 108 When I click on "Apply filters" "button" 109 Then I should see "<expected1>" in the "participants" "table" 110 And I should see "<expected2>" in the "participants" "table" 111 And I should see "<expected3>" in the "participants" "table" 112 And I should not see "<notexpected1>" in the "participants" "table" 113 And I should not see "<notexpected2>" in the "participants" "table" 114 # Note the 'XX-IGNORE-XX' elements are for when there is less than 2 'not expected' items. 115 116 Examples: 117 | matchtype | filtertype | filtervalue1 | filtervalue2 | expected1 | expected2 | expected3 | notexpected1 | notexpected2 | 118 | Any | Groups | Group 1 | Group 2 | Student 2 | Student 3 | | Student 1 | XX-IGNORE-XX | 119 | All | Groups | Group 1 | Group 2 | Student 2 | | | Student 1 | Student 3 | 120 | None | Groups | Group 1 | Group 2 | Student 1 | Patricia Pea | | Student 2 | Student 3 | 121 122 @javascript 123 Scenario Outline: Filter users which are group members in several courses 124 Given I am on the "C3" "Course" page logged in as "patricia" 125 And I navigate to course participants 126 And I set the field "type" in the "Filter 1" "fieldset" to "<filtertype>" 127 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "<filtervalue>" 128 When I click on "Apply filters" "button" 129 Then I should see "<expected1>" in the "participants" "table" 130 And I should see "<expected2>" in the "participants" "table" 131 And I should not see "<notexpected1>" in the "participants" "table" 132 And I should not see "<notexpected2>" in the "participants" "table" 133 # Note the 'XX-IGNORE-XX' elements are for when there is less than 2 'not expected' items. 134 135 Examples: 136 | filtertype | filtervalue | expected1 | expected2 | notexpected1 | notexpected2 | 137 | Groups | No group | Student 3 | | Student 1 | Student 2 | 138 | Groups | Group A | Student 1 | Student 2 | Student 3 | XX-IGNORE-XX | 139 | Groups | Group B | Student 2 | | Student 1 | Student 3 | 140 141 @javascript 142 Scenario: In separate groups mode, a student in a single group can only view and filter by users in their own group 143 Given I am on the "C1" "Course" page logged in as "patricia" 144 And I navigate to course participants 145 146 # Unsuspend student 2 for to improve coverage of this test. 147 And I click on "Edit enrolment" "icon" in the "Student 2" "table_row" 148 And I set the field "Status" to "Active" 149 And I click on "Save changes" "button" 150 And I log out 151 152 # Default view should have groups filter pre-set. 153 # Match: 154 # Groups Any ["Group 2"]. 155 156 When I log in as "student3" 157 And I am on "Course 1" course homepage 158 And I navigate to course participants 159 160 Then I should see "Student 2" in the "participants" "table" 161 And I should see "Student 3" in the "participants" "table" 162 And I should see "Group 2" in the "Filter 1" "fieldset" 163 But I should not see "Student 1" in the "participants" "table" 164 And I should not see "Group 1" in the "Filter 1" "fieldset" 165 166 # Testing result of removing groups filter row. 167 # Match any available user. 168 When I click on "Remove filter row" "button" in the "Filter 1" "fieldset" 169 170 Then I should see "Student 2" in the "participants" "table" 171 And I should see "Student 3" in the "participants" "table" 172 But I should not see "Student 1" in the "participants" "table" 173 174 # Testing result of applying groups filter manually. 175 # Match: 176 # Group Any ["Group 2"]. 177 178 # Match Groups Any ["Group 2"] 179 Given I set the field "Match" in the "Filter 1" "fieldset" to "Any" 180 And I set the field "type" in the "Filter 1" "fieldset" to "Groups" 181 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Group 2" 182 183 And I open the autocomplete suggestions list in the "Filter 1" "fieldset" 184 And I should not see "Group 1" in the ".form-autocomplete-suggestions" "css_element" 185 186 And I click on "Apply filters" "button" 187 188 Then I should see "Student 2" in the "participants" "table" 189 And I should see "Student 3" in the "participants" "table" 190 But I should not see "Student 1" in the "participants" "table" 191 192 # Testing result of removing groups filter by clearing all filters. 193 # Match any available user. 194 When I click on "Clear filters" "button" 195 196 Then I should see "Student 2" in the "participants" "table" 197 And I should see "Student 3" in the "participants" "table" 198 But I should not see "Student 1" in the "participants" "table" 199 200 @javascript 201 Scenario: In separate groups mode, a student in multiple groups can only view and filter by users in their own groups 202 Given I am on the "C1" "Course" page logged in as "patricia" 203 And I navigate to course participants 204 205 # Unsuspend student 2 for to improve coverage of this test. 206 And I click on "Edit enrolment" "icon" in the "Student 2" "table_row" 207 And I set the field "Status" to "Active" 208 And I click on "Save changes" "button" 209 And I log out 210 211 When I log in as "student2" 212 And I am on "Course 1" course homepage 213 And I navigate to course participants 214 215 # Default view should have groups filter pre-set. 216 # Match: 217 # Groups Any ["Group 1", "Group 2"]. 218 219 Then I should see "Student 2" in the "participants" "table" 220 And I should see "Student 3" in the "participants" "table" 221 And I should not see "Student 1" in the "participants" "table" 222 And I should see "Group 1" in the "Filter 1" "fieldset" 223 And I should see "Group 2" in the "Filter 1" "fieldset" 224 And I should see "Student 2" in the "participants" "table" 225 And I should see "Student 3" in the "participants" "table" 226 And I should not see "Student 1" in the "participants" "table" 227 228 # Testing result of removing groups filter row. 229 # Match any available user. 230 When I click on "Remove filter row" "button" in the "Filter 1" "fieldset" 231 232 Then I should see "Student 2" in the "participants" "table" 233 And I should see "Student 3" in the "participants" "table" 234 But I should not see "Student 1" in the "participants" "table" 235 236 # Testing result of applying groups filter manually. 237 # Match: 238 # Groups Any ["Group 1"]. 239 240 # Match Groups Any ["Group 1"] 241 And I set the field "Match" in the "Filter 1" "fieldset" to "Any" 242 And I set the field "type" in the "Filter 1" "fieldset" to "Groups" 243 244 And I open the autocomplete suggestions list in the "Filter 1" "fieldset" 245 And I should see "Group 2" in the ".form-autocomplete-suggestions" "css_element" 246 And I press the escape key 247 248 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Group 1" 249 250 And I click on "Apply filters" "button" 251 And I should see "Student 2" in the "participants" "table" 252 But I should not see "Student 1" in the "participants" "table" 253 And I should not see "Student 3" in the "participants" "table" 254 255 # Testing result of removing groups filter by clearing all filters. 256 # Match any available user. 257 When I click on "Clear filters" "button" 258 259 Then I should see "Student 2" in the "participants" "table" 260 And I should see "Student 3" in the "participants" "table" 261 But I should not see "Student 1" in the "participants" "table" 262 263 @javascript 264 Scenario: Filter users who have no role in a course 265 Given I am on the "C1" "Course" page logged in as "patricia" 266 And I navigate to course participants 267 268 # Remove the user role. 269 And I click on "Student 1's role assignments" "link" 270 And I click on ".form-autocomplete-selection [aria-selected=true]" "css_element" 271 And I press the escape key 272 And I click on "Save changes" "link" 273 274 # Match: 275 # Roles All ["No roles"]. 276 277 # Match Roles All ["No roles"]. 278 When I set the field "type" in the "Filter 1" "fieldset" to "Roles" 279 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "No roles" 280 281 And I click on "Apply filters" "button" 282 283 Then I should see "Student 1" in the "participants" "table" 284 But I should not see "Student 2" in the "participants" "table" 285 And I should not see "Student 3" in the "participants" "table" 286 And I should not see "Student 4" in the "participants" "table" 287 And I should not see "Patricia Pea" in the "participants" "table" 288 289 @javascript 290 Scenario: Multiple filters applied (All filterset match type) 291 Given I am on the "C1" "Course" page logged in as "patricia" 292 And I navigate to course participants 293 294 # Match Any: 295 # Roles All ["Student"] and 296 # Status Any ["Active"]. 297 298 # Match Roles All ["Student"]. 299 When I set the field "Match" in the "Filter 1" "fieldset" to "All" 300 And I set the field "type" in the "Filter 1" "fieldset" to "Roles" 301 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Student" 302 303 # Match Status All ["Active"]. 304 And I click on "Add condition" "button" 305 # Set filterset to match all. 306 And I set the field "Match" to "All" 307 And I set the field "Match" in the "Filter 2" "fieldset" to "Any" 308 And I set the field "type" in the "Filter 2" "fieldset" to "Status" 309 And I set the field "Type or select..." in the "Filter 2" "fieldset" to "Active" 310 311 And I click on "Apply filters" "button" 312 313 Then I should see "Student 1" in the "participants" "table" 314 And I should see "Student 3" in the "participants" "table" 315 But I should not see "Student 2" in the "participants" "table" 316 And I should not see "Student 4" in the "participants" "table" 317 And I should not see "Patricia Pea" in the "participants" "table" 318 319 # Match Any: 320 # Roles All ["Student"]; and 321 # Status Any ["Active"]; and 322 # Enrolment method Any ["Manual"]; and 323 # Groups Any ["Group 2"]. 324 325 # Match enrolment method Any ["Manual"] 326 When I click on "Add condition" "button" 327 And I set the field "Match" in the "Filter 3" "fieldset" to "Any" 328 And I set the field "type" in the "Filter 3" "fieldset" to "Enrolment methods" 329 And I set the field "Type or select..." in the "Filter 3" "fieldset" to "Manual enrolments" 330 331 # Match Groups Any ["Group 2"] 332 And I click on "Add condition" "button" 333 And I set the field "Match" in the "Filter 4" "fieldset" to "All" 334 And I set the field "type" in the "Filter 4" "fieldset" to "Groups" 335 And I set the field "Type or select..." in the "Filter 4" "fieldset" to "Group 2" 336 And I click on "Apply filters" "button" 337 338 Then I should see "Student 3" in the "participants" "table" 339 But I should not see "Patricia Pea" in the "participants" "table" 340 And I should not see "Student 1" in the "participants" "table" 341 And I should not see "Student 2" in the "participants" "table" 342 And I should not see "Student 4" in the "participants" "table" 343 344 # Change the active status filter to inactive. 345 # Match Any: 346 # Roles All ["Student"]; and 347 # Status Any ["Inactive"]; and 348 # Enrolment method Any ["Manual"]; and 349 # Groups Any ["Group 2"]. 350 351 # Match Status All ["Inactive"]. 352 And I click on "Active" "autocomplete_selection" 353 And I set the field "Type or select..." in the "Filter 2" "fieldset" to "Inactive" 354 And I click on "Apply filters" "button" 355 356 Then I should see "Student 2" in the "participants" "table" 357 But I should not see "Student 4" in the "participants" "table" 358 And I should not see "Student 1" in the "participants" "table" 359 And I should not see "Student 3" in the "participants" "table" 360 And I should not see "Patricia Pea" in the "participants" "table" 361 362 # Set both statuses (match any). 363 # Match Any: 364 # Roles All ["Student"]; and 365 # Status Any ["Active", "Inactive"]; and 366 # Enrolment method Any ["Manual"]; and 367 # Groups Any ["Group 2"]. 368 369 # Match Status Any ["Active", "Inactive"]. 370 And I set the field "Type or select..." in the "Filter 2" "fieldset" to "Active,Inactive" 371 And I click on "Apply filters" "button" 372 373 Then I should see "Student 2" in the "participants" "table" 374 And I should see "Student 3" in the "participants" "table" 375 But I should not see "Student 1" in the "participants" "table" 376 And I should not see "Student 4" in the "participants" "table" 377 378 # Set both statuses (match all). 379 # Match Any: 380 # Roles All ["Student"]; and 381 # Status Any ["Active", "Inactive"]; and 382 # Enrolment method Any ["Manual"]; and 383 # Groups Any ["Group 2"]. 384 385 # Match Status All ["Active", "Inactive"]. 386 When I set the field "Match" in the "Filter 2" "fieldset" to "All" 387 And I click on "Apply filters" "button" 388 389 Then I should see "Nothing to display" 390 391 @javascript 392 Scenario: Multiple filters applied (Any filterset match type) 393 Given I log in as "patricia" 394 And I am on "Course 1" course homepage 395 And I navigate to course participants 396 397 # Match Any: 398 # Roles All ["Teacher"] and 399 # Status Any ["Active"]. 400 401 # Match Roles all Roles ["Teacher"]. 402 When I set the field "Match" in the "Filter 1" "fieldset" to "All" 403 And I set the field "type" in the "Filter 1" "fieldset" to "Roles" 404 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Teacher" 405 406 # Match Status Any ["Active"]. 407 And I click on "Add condition" "button" 408 And I set the field "Match" in the "Filter 2" "fieldset" to "Any" 409 And I set the field "type" in the "Filter 2" "fieldset" to "Status" 410 And I set the field "Type or select..." in the "Filter 2" "fieldset" to "Active" 411 412 # Set filterset to match any. 413 And I set the field "Match" to "Any" 414 And I click on "Apply filters" "button" 415 416 Then I should see "Student 1" in the "participants" "table" 417 And I should see "Patricia Pea" in the "participants" "table" 418 And I should see "Student 3" in the "participants" "table" 419 But I should not see "Student 2" in the "participants" "table" 420 And I should not see "Student 4" in the "participants" "table" 421 422 # Match Any: 423 # Roles All ["Teacher"] and 424 # Status None ["Active"]. 425 426 # Match Status Not ["Active"] 427 When I set the field "Match" in the "Filter 2" "fieldset" to "None" 428 And I click on "Apply filters" "button" 429 430 Then I should see "Student 2" in the "participants" "table" 431 And I should see "Student 4" in the "participants" "table" 432 And I should see "Patricia Pea" in the "participants" "table" 433 But I should not see "Student 1" in the "participants" "table" 434 And I should not see "Student 3" in the "participants" "table" 435 436 # Add a keyword filter. 437 # Match Any: 438 # Roles All ["Teacher"]; and 439 # Status None ["Active"]; and 440 # Keyword Any ["patricia"]. 441 442 # Match Keyword Any ["patricia"]. 443 When I click on "Add condition" "button" 444 And I set the field "Match" in the "Filter 3" "fieldset" to "Any" 445 And I set the field "type" in the "Filter 3" "fieldset" to "Keyword" 446 And I set the field "Type..." in the "Filter 3" "fieldset" to "patricia" 447 448 And I click on "Apply filters" "button" 449 450 Then I should see "Student 2" in the "participants" "table" 451 And I should see "Student 4" in the "participants" "table" 452 And I should see "Patricia Pea" in the "participants" "table" 453 But I should not see "Student 1" in the "participants" "table" 454 And I should not see "Student 3" in the "participants" "table" 455 456 @javascript 457 Scenario: Multiple filters applied (None filterset match type) 458 Given I log in as "patricia" 459 And I am on "Course 1" course homepage 460 And I navigate to course participants 461 462 # Match None: 463 # Roles All ["Teacher"] and 464 # Status Any ["Active"]. 465 466 # Set the Roles to "All" ["Teacher"]. 467 When I set the field "Match" in the "Filter 1" "fieldset" to "All" 468 And I set the field "type" in the "Filter 1" "fieldset" to "Roles" 469 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Teacher" 470 471 # Set the Status to "Any" ["Active"]. 472 And I click on "Add condition" "button" 473 And I set the field "Match" in the "Filter 2" "fieldset" to "Any" 474 And I set the field "type" in the "Filter 2" "fieldset" to "Status" 475 And I set the field "Type or select..." in the "Filter 2" "fieldset" to "Active" 476 477 # Set filterset to match None. 478 And I set the field "Match" to "None" 479 And I click on "Apply filters" "button" 480 481 Then I should see "Student 2" in the "participants" "table" 482 And I should see "Student 4" in the "participants" "table" 483 But I should not see "Student 1" in the "participants" "table" 484 And I should not see "Student 3" in the "participants" "table" 485 And I should not see "Patricia Pea" in the "participants" "table" 486 487 # Match None: 488 # Roles All ["Teacher"] and 489 # Status None ["Active"] 490 # Set the Status to "None ["Active"] 491 When I set the field "Match" in the "Filter 2" "fieldset" to "None" 492 And I click on "Apply filters" "button" 493 Then I should see "Student 1" in the "participants" "table" 494 And I should see "Student 3" in the "participants" "table" 495 But I should not see "Student 2" in the "participants" "table" 496 And I should not see "Student 4" in the "participants" "table" 497 And I should not see "Patricia Pea" in the "participants" "table" 498 499 # Match None: 500 # Roles All ["Teacher"] and 501 # Status None ["Active"] and 502 # Keyword Any ["3@"] 503 # Set the Keyword to "Any" ["3@"] 504 When I click on "Add condition" "button" 505 Then I set the field "Match" in the "Filter 3" "fieldset" to "Any" 506 And I set the field "type" in the "Filter 3" "fieldset" to "Keyword" 507 And I set the field "Type..." in the "Filter 3" "fieldset" to "3@" 508 509 When I click on "Apply filters" "button" 510 Then I should see "Student 1" in the "participants" "table" 511 And I should not see "Student 2" in the "participants" "table" 512 And I should not see "Student 3" in the "participants" "table" 513 And I should not see "Student 4" in the "participants" "table" 514 And I should not see "Patricia Pea" in the "participants" "table" 515 516 # Match None: 517 # Roles All ["Teacher"] and 518 # Status None ["Active"] and 519 # Keyword None ["3@"]. 520 521 # Set the Keyword to "None" ["3@"] 522 When I set the field "Match" in the "Filter 3" "fieldset" to "None" 523 And I click on "Apply filters" "button" 524 525 Then I should see "Student 3" in the "participants" "table" 526 But I should not see "Student 1" in the "participants" "table" 527 And I should not see "Student 2" in the "participants" "table" 528 And I should not see "Student 4" in the "participants" "table" 529 And I should not see "Patricia Pea" in the "participants" "table" 530 531 @javascript 532 Scenario: Filter match by one or more keywords and modified match types 533 Given I am on the "C1" "Course" page logged in as "patricia" 534 And I navigate to course participants 535 536 # Match: 537 # Keyword Any ["1@example"]. 538 539 # Set the Keyword to "Any" ["1@example"] 540 When I set the field "Match" in the "Filter 1" "fieldset" to "Any" 541 And I set the field "type" in the "Filter 1" "fieldset" to "Keyword" 542 And I set the field "Type..." in the "Filter 1" "fieldset" to "1@example" 543 And I click on "Apply filters" "button" 544 545 Then I should see "Student 1" in the "participants" "table" 546 And I should see "Patricia Pea" in the "participants" "table" 547 548 But I should not see "Student 2" in the "participants" "table" 549 And I should not see "Student 3" in the "participants" "table" 550 And I should not see "Student 4" in the "participants" "table" 551 552 # Match: 553 # Keyword All ["1@example"]. 554 When I set the field "Match" in the "Filter 1" "fieldset" to "All" 555 And I click on "Apply filters" "button" 556 557 Then I should see "Student 1" in the "participants" "table" 558 And I should see "Patricia Pea" in the "participants" "table" 559 But I should not see "Student 2" in the "participants" "table" 560 And I should not see "Student 3" in the "participants" "table" 561 And I should not see "Student 4" in the "participants" "table" 562 563 # Match: 564 # Keyword None ["1@example"]. 565 When I set the field "Match" in the "Filter 1" "fieldset" to "None" 566 And I click on "Apply filters" "button" 567 568 Then I should see "Student 2" in the "participants" "table" 569 And I should see "Student 3" in the "participants" "table" 570 And I should see "Student 4" in the "participants" "table" 571 But I should not see "Student 1" in the "participants" "table" 572 And I should not see "Patricia Pea" in the "participants" "table" 573 574 # Set two keyword values. 575 # Match: 576 # Keyword None ["1@example", "moodle"]. 577 When I set the field "Type..." to "1@example, moodle" 578 And I click on "Apply filters" "button" 579 580 Then I should see "Student 2" in the "participants" "table" 581 And I should see "Student 3" in the "participants" "table" 582 But I should not see "Student 1" in the "participants" "table" 583 And I should not see "Patricia Pea" in the "participants" "table" 584 And I should not see "Student 4" in the "participants" "table" 585 586 # Set two keyword values. 587 # Match: 588 # Keyword Any ["1@example", "moodle"]. 589 When I set the field "Match" in the "Filter 1" "fieldset" to "Any" 590 And I click on "Apply filters" "button" 591 592 Then I should see "Student 1" in the "participants" "table" 593 And I should see "Patricia Pea" in the "participants" "table" 594 And I should see "Student 4" in the "participants" "table" 595 But I should not see "Student 2" in the "participants" "table" 596 And I should not see "Student 3" in the "participants" "table" 597 598 # Match: 599 # Keyword All ["1@example", "moodle"]. 600 When I set the field "Match" in the "Filter 1" "fieldset" to "All" 601 And I click on "Apply filters" "button" 602 603 Then I should see "Nothing to display" 604 605 @javascript 606 Scenario: Reorder users without losing filter 607 Given I am on the "C1" "Course" page logged in as "patricia" 608 And I navigate to course participants 609 610 When I set the field "type" in the "Filter 1" "fieldset" to "Roles" 611 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Student" 612 And I click on "Apply filters" "button" 613 614 And I should see "Student 1" in the "participants" "table" 615 And I should see "Student 2" in the "participants" "table" 616 And I should see "Student 3" in the "participants" "table" 617 And I should see "Student 4" in the "participants" "table" 618 And I should not see "Patricia Pea" in the "participants" "table" 619 620 When I click on "Surname" "link" 621 Then I should see "Student 1" in the "participants" "table" 622 And I should see "Student 2" in the "participants" "table" 623 And I should see "Student 3" in the "participants" "table" 624 And I should see "Student 4" in the "participants" "table" 625 But I should not see "Patricia Pea" in the "participants" "table" 626 627 @javascript 628 Scenario: Only possible to add filter rows for the number of filters available 629 Given I am on the "C1" "Course" page logged in as "patricia" 630 And I navigate to course participants 631 When I set the field "type" in the "Filter 1" "fieldset" to "Keyword" 632 And I click on "Add condition" "button" 633 And I set the field "type" in the "Filter 2" "fieldset" to "Status" 634 And I click on "Add condition" "button" 635 And I set the field "type" in the "Filter 3" "fieldset" to "Roles" 636 And I click on "Add condition" "button" 637 And I set the field "type" in the "Filter 4" "fieldset" to "Enrolment methods" 638 And I click on "Add condition" "button" 639 And I set the field "type" in the "Filter 5" "fieldset" to "Groups" 640 And I click on "Add condition" "button" 641 And I set the field "type" in the "Filter 6" "fieldset" to "Inactive for more than" 642 643 Then the "Add condition" "button" should be disabled 644 645 @javascript 646 Scenario: Rendering filter options for teachers in a course that don't support groups 647 Given I am on the "C2" "Course" page logged in as "patricia" 648 When I navigate to course participants 649 Then I should see "Roles" in the "type" "field" 650 And I should see "Enrolment methods" in the "type" "field" 651 But I should not see "Groups" in the "type" "field" 652 653 @javascript 654 Scenario: Rendering filter options for students who have limited privileges 655 Given I am on the "C2" "Course" page logged in as "student1" 656 When I navigate to course participants 657 Then I should see "Roles" in the "type" "field" 658 But I should not see "Status" in the "type" "field" 659 And I should not see "Enrolment methods" in the "type" "field" 660 661 @javascript 662 Scenario: Filter by user identity fields 663 Given the following config values are set as admin: 664 | showuseridentity | idnumber,email,city,country | 665 And I am on the "C1" "Course" page logged in as "patricia" 666 And I navigate to course participants 667 668 # Search by email (only) - should only see visible email + own. 669 # Match: 670 # Keyword Any ["student1@example.com"]. 671 672 # Set the Keyword to "Any" ["student1@example.com"] 673 When I set the field "type" in the "Filter 1" "fieldset" to "Keyword" 674 And I set the field "Type..." in the "Filter 1" "fieldset" to "student1@example.com" 675 And I click on "Apply filters" "button" 676 677 Then I should see "Student 1" in the "participants" "table" 678 But I should not see "Student 2" in the "participants" "table" 679 And I should not see "Patricia Pea" in the "participants" "table" 680 681 # Search by idnumber (only). 682 # Match: 683 # Keyword Any ["SID"]. 684 685 # Set the Keyword to "Any" ["SID"] 686 And I click on "student1@example.com" "autocomplete_selection" 687 And I set the field "Type..." in the "Filter 1" "fieldset" to "SID" 688 And I click on "Apply filters" "button" 689 690 Then I should see "Student 1" in the "participants" "table" 691 And I should see "Student 2" in the "participants" "table" 692 And I should see "Student 3" in the "participants" "table" 693 And I should see "Student 4" in the "participants" "table" 694 But I should not see "Patricia Pea" in the "participants" "table" 695 696 # Search by city (only). 697 # Match: 698 # Keyword Any ["SCITY"]. 699 700 # Set the Keyword to "Any" ["SCITY"] 701 And I click on "SID" "autocomplete_selection" 702 And I set the field "Type..." in the "Filter 1" "fieldset" to "SCITY" 703 And I click on "Apply filters" "button" 704 705 Then I should see "Student 1" in the "participants" "table" 706 And I should see "Student 2" in the "participants" "table" 707 And I should see "Student 3" in the "participants" "table" 708 And I should see "Student 4" in the "participants" "table" 709 But I should not see "Patricia Pea" in the "participants" "table" 710 711 # Search by country text (only) - should not match. 712 # Match: 713 # Keyword Any ["GB"]. 714 715 # Set the Keyword to "Any" ["GB"] 716 And I click on "SCITY" "autocomplete_selection" 717 And I set the field "Type..." in the "Filter 1" "fieldset" to "GB" 718 And I click on "Apply filters" "button" 719 720 Then I should see "Nothing to display" 721 722 # Check no match. 723 # Match: 724 # Keyword Any ["NOTHING"]. 725 726 # Set the Keyword to "Any" ["NOTHING"] 727 And I click on "GB" "autocomplete_selection" 728 And I set the field "Type..." in the "Filter 1" "fieldset" to "NOTHING" 729 And I click on "Apply filters" "button" 730 731 Then I should see "Nothing to display" 732 733 @javascript @skip_chrome_zerosize 734 Scenario: Filter by user identity fields when cannot see the field data 735 Given I log in as "admin" 736 And I set the following system permissions of "Teacher" role: 737 | moodle/site:viewuseridentity | Prevent | 738 And the following config values are set as admin: 739 | showuseridentity | idnumber,email,city,country | 740 And I log out 741 742 And I am on the "C1" "Course" page logged in as "patricia" 743 And I navigate to course participants 744 745 # Match: 746 # Keyword Any ["@example.com"]. 747 748 # Search by email (only) - should only see visible email + own. 749 # Set the Keyword to "Any" ["@example.com"] 750 When I set the field "type" in the "Filter 1" "fieldset" to "Keyword" 751 And I set the field "Type..." in the "Filter 1" "fieldset" to "@example." 752 And I click on "Apply filters" "button" 753 754 Then I should see "Student 2" in the "participants" "table" 755 And I should see "Patricia Pea" in the "participants" "table" 756 But I should not see "Student 1" in the "participants" "table" 757 And I should not see "Student 3" in the "participants" "table" 758 And I should not see "Student 4" in the "participants" "table" 759 760 # Search for other fields - should only see own results. 761 762 # Match: 763 # Keyword Any ["SID"]. 764 # Set the Keyword to "Any" ["SID"] 765 And I click on "@example." "autocomplete_selection" 766 And I set the field "Type..." in the "Filter 1" "fieldset" to "SID" 767 And I click on "Apply filters" "button" 768 769 Then I should see "Nothing to display" 770 771 # Match: 772 # Keyword Any ["TID"]. 773 774 # Set the Keyword to "Any" ["TID"] 775 And I click on "SID" "autocomplete_selection" 776 And I set the field "Type..." in the "Filter 1" "fieldset" to "TID" 777 And I click on "Apply filters" "button" 778 779 Then I should see "Patricia Pea" in the "participants" "table" 780 But I should not see "Student 1" in the "participants" "table" 781 782 # Match: 783 # Keyword Any ["CITY"]. 784 785 # Set the Keyword to "Any" ["CITY"] 786 And I click on "TID" "autocomplete_selection" 787 And I set the field "Type..." in the "Filter 1" "fieldset" to "CITY" 788 And I click on "Apply filters" "button" 789 790 Then I should see "Patricia Pea" in the "participants" "table" 791 But I should not see "Student 1" in the "participants" "table" 792 793 # No data matches regardless of capabilities. 794 # Match: 795 # Keyword Any ["NOTHING"]. 796 797 # Set the Keyword to "Any" ["NOTHING"] 798 And I click on "CITY" "autocomplete_selection" 799 And I set the field "Type..." in the "Filter 1" "fieldset" to "NOTHING" 800 And I click on "Apply filters" "button" 801 802 Then I should see "Nothing to display" 803 804 @javascript 805 Scenario: Individual filters can be removed, which will automatically refresh the participants list 806 # Match All: 807 # Roles All ["Student"]; and 808 # Keyword Any ["@example.com"]. 809 810 # Set the Roles to "All" ["Student"]. 811 Given I am on the "C1" "Course" page logged in as "patricia" 812 And I navigate to course participants 813 And I set the field "Match" in the "Filter 1" "fieldset" to "All" 814 And I set the field "type" in the "Filter 1" "fieldset" to "Roles" 815 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Student" 816 817 # Set the Keyword to "Any" ["@example.com"] 818 And I click on "Add condition" "button" 819 And I set the field "Match" in the "Filter 2" "fieldset" to "Any" 820 And I set the field "type" in the "Filter 2" "fieldset" to "Keyword" 821 And I set the field "Type..." in the "Filter 2" "fieldset" to "@example" 822 823 # Set filterset to match all. 824 And I set the field "Match" to "All" 825 And I click on "Apply filters" "button" 826 827 Then I should see "Student 1" in the "participants" "table" 828 And I should see "Student 2" in the "participants" "table" 829 And I should see "Student 3" in the "participants" "table" 830 But I should not see "Student 4" in the "participants" "table" 831 And I should not see "Patricia Pea" in the "participants" "table" 832 833 # Match: 834 # Keyword Any ["@example.com"]. 835 When I click on "Remove filter row" "button" in the "Filter 1" "fieldset" 836 Then I should see "Student 1" in the "participants" "table" 837 And I should see "Student 2" in the "participants" "table" 838 And I should see "Student 3" in the "participants" "table" 839 And I should see "Patricia Pea" in the "participants" "table" 840 But I should not see "Student 4" in the "participants" "table" 841 842 @javascript 843 Scenario: All filters can be cleared at once 844 # Match All: 845 # Roles All ["Student"]; and 846 # Keyword Any ["@example.com"]. 847 848 # Set the Roles to "All" ["Student"]. 849 Given I am on the "C1" "Course" page logged in as "patricia" 850 And I navigate to course participants 851 When I set the field "Match" in the "Filter 1" "fieldset" to "All" 852 And I set the field "type" in the "Filter 1" "fieldset" to "Roles" 853 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Student" 854 855 # Set the Keyword to "All" ["@example.com"]. 856 And I click on "Add condition" "button" 857 And I set the field "Match" in the "Filter 2" "fieldset" to "Any" 858 And I set the field "type" in the "Filter 2" "fieldset" to "Keyword" 859 And I set the field "Type..." in the "Filter 2" "fieldset" to "@example" 860 861 # Set filterset to match all. 862 And I set the field "Match" to "All" 863 And I click on "Apply filters" "button" 864 865 Then I should see "Student 1" in the "participants" "table" 866 And I should see "Student 2" in the "participants" "table" 867 And I should see "Student 3" in the "participants" "table" 868 But I should not see "Student 4" in the "participants" "table" 869 And I should not see "Patricia Pea" in the "participants" "table" 870 871 # Match Any. 872 When I click on "Clear filters" "button" 873 Then I should see "Student 1" in the "participants" "table" 874 And I should see "Student 2" in the "participants" "table" 875 And I should see "Student 3" in the "participants" "table" 876 And I should see "Student 4" in the "participants" "table" 877 And I should see "Patricia Pea" in the "participants" "table" 878 879 @javascript 880 Scenario: Filterset match type is reset when reducing to a single filter 881 # Match None: 882 # Keyword Any ["@example.com"]; and 883 # Roles All ["Teacher"]. 884 Given I am on the "C1" "Course" page logged in as "patricia" 885 And I navigate to course participants 886 887 # Set the Keyword to "Any" ["@example.com"] 888 When I set the field "Match" in the "Filter 1" "fieldset" to "Any" 889 And I set the field "type" in the "Filter 1" "fieldset" to "Keyword" 890 And I set the field "Type..." to "@example.com" 891 892 # Set the Roles to "All" ["Student"]. 893 And I click on "Add condition" "button" 894 And I set the field "Match" in the "Filter 2" "fieldset" to "All" 895 And I set the field "type" in the "Filter 2" "fieldset" to "Roles" 896 And I set the field "Type or select..." in the "Filter 2" "fieldset" to "Student" 897 898 # Match none of student role and @example.com keyword. 899 And I set the field "Match" to "None" 900 And I click on "Apply filters" "button" 901 902 Then I should see "Patricia Pea" in the "participants" "table" 903 But I should not see "Student 1" in the "participants" "table" 904 And I should not see "Student 2" in the "participants" "table" 905 And I should not see "Student 3" in the "participants" "table" 906 And I should not see "Student 4" in the "participants" "table" 907 908 # Match: 909 # Keyword Any ["@example.com"]. 910 # When removing the pen-ultimate filter, the filterset match type is removed too. 911 When I click on "Remove filter row" "button" in the "Filter 2" "fieldset" 912 Then I should see "Student 1" in the "participants" "table" 913 And I should see "Student 2" in the "participants" "table" 914 And I should see "Student 3" in the "participants" "table" 915 But I should not see "Student 4" in the "participants" "table" 916 And I should not see "Patricia Pea" in the "participants" "table" 917 918 # Match Any: 919 # Keyword Any ["@example.com"]; and 920 # Role All ["Student"]. 921 # The default filterset match (Any) should apply. 922 # Set the Roles to "All" ["Student"]. 923 When I click on "Add condition" "button" 924 And I set the field "Match" in the "Filter 2" "fieldset" to "All" 925 And I set the field "type" in the "Filter 2" "fieldset" to "Role" 926 And I set the field "Type or select..." in the "Filter 2" "fieldset" to "Student" 927 And I click on "Apply filters" "button" 928 929 Then I should see "Student 1" in the "participants" "table" 930 And I should see "Student 2" in the "participants" "table" 931 And I should see "Student 3" in the "participants" "table" 932 And I should not see "Student 4" in the "participants" "table" 933 But I should not see "Patricia Pea" in the "participants" "table" 934 935 @javascript 936 Scenario: Filter users by first initial 937 # Match: 938 # No filters; and 939 # First initial "T". 940 Given I am on the "C2" "Course" page logged in as "patricia" 941 And I navigate to course participants 942 And I should see "Student 1" in the "participants" "table" 943 And I should see "Student 2" in the "participants" "table" 944 And I should see "Student 3" in the "participants" "table" 945 And I should see "Trendy Learnson" in the "participants" "table" 946 And I should see "Patricia Pea" in the "participants" "table" 947 When I click on "T" "link" in the ".firstinitial" "css_element" 948 Then I should see "Trendy Learnson" in the "participants" "table" 949 But I should not see "Patricia Pea" in the "participants" "table" 950 And I should not see "Student 1" in the "participants" "table" 951 And I should not see "Student 2" in the "participants" "table" 952 And I should not see "Student 3" in the "participants" "table" 953 954 @javascript 955 Scenario: Filter users by last initial 956 # Match: 957 # No filters; and 958 # Last initial "L". 959 Given I am on the "C2" "Course" page logged in as "patricia" 960 And I navigate to course participants 961 And I should see "Student 1" in the "participants" "table" 962 And I should see "Student 2" in the "participants" "table" 963 And I should see "Student 3" in the "participants" "table" 964 And I should see "Trendy Learnson" in the "participants" "table" 965 And I should see "Patricia Pea" in the "participants" "table" 966 When I click on "L" "link" in the ".lastinitial" "css_element" 967 Then I should see "Trendy Learnson" in the "participants" "table" 968 But I should not see "Student 1" in the "participants" "table" 969 And I should not see "Student 2" in the "participants" "table" 970 And I should not see "Student 3" in the "participants" "table" 971 And I should not see "Patricia Pea" in the "participants" "table" 972 973 @javascript 974 Scenario: Filter users by first and last initials 975 # Match: 976 # No filters; and 977 # First initial "T"; and 978 # Last initial "L". 979 Given I am on the "C2" "Course" page logged in as "patricia" 980 And I navigate to course participants 981 And I should see "Student 1" in the "participants" "table" 982 And I should see "Student 2" in the "participants" "table" 983 And I should see "Student 3" in the "participants" "table" 984 And I should see "Trendy Learnson" in the "participants" "table" 985 And I should see "Patricia Pea" in the "participants" "table" 986 When I click on "T" "link" in the ".firstinitial" "css_element" 987 And I click on "L" "link" in the ".lastinitial" "css_element" 988 Then I should see "Trendy Learnson" in the "participants" "table" 989 But I should not see "Student 1" in the "participants" "table" 990 And I should not see "Student 2" in the "participants" "table" 991 And I should not see "Student 3" in the "participants" "table" 992 And I should not see "Patricia Pea" in the "participants" "table" 993 994 @javascript 995 Scenario: Initials filtering is always applied in addition to any other filtering 996 # Match: 997 # Roles All ["Teacher"]; and 998 # First initial "T". 999 Given I am on the "C2" "Course" page logged in as "patricia" 1000 And I navigate to course participants 1001 And I should see "Student 1" in the "participants" "table" 1002 And I should see "Student 2" in the "participants" "table" 1003 And I should see "Student 3" in the "participants" "table" 1004 And I should see "Trendy Learnson" in the "participants" "table" 1005 And I should see "Patricia Pea" in the "participants" "table" 1006 1007 # Set the Role to "Any" ["Student"]. 1008 When I set the field "Match" in the "Filter 1" "fieldset" to "Any" 1009 And I set the field "type" in the "Filter 1" "fieldset" to "Role" 1010 And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Student" 1011 And I click on "Apply filters" "button" 1012 1013 # Last initial "T". 1014 And I click on "T" "link" in the ".firstinitial" "css_element" 1015 Then I should see "Trendy Learnson" in the "participants" "table" 1016 But I should not see "Student 1" in the "participants" "table" 1017 And I should not see "Student 2" in the "participants" "table" 1018 And I should not see "Student 3" in the "participants" "table" 1019 And I should not see "Patricia Pea" in the "participants" "table" 1020 1021 @javascript 1022 Scenario: Filtering works correctly with custom profile fields 1023 Given the following config values are set as admin: 1024 | showuseridentity | email,profile_field_frog | 1025 And I am on the "C2" "Course" page logged in as "patricia" 1026 And I navigate to course participants 1027 And I set the field "type" in the "Filter 1" "fieldset" to "Keyword" 1028 And I set the field "Type..." to "Kermit" 1029 And I press enter 1030 And I click on "Apply filters" "button" 1031 Then I should see "Student 1" in the "participants" "table" 1032 And I should not see "Student 2" in the "participants" "table" 1033