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