997122262f6356c1fe61e652eb91da772fce5f78
[moodle.git] / user / tests / behat / filter_participants_showall.feature
1 @core @core_user
2 Feature: Course participants can be filtered to display all the users
3   In order to filter the list of course participants
4   As a user
5   I need to visit the course participants page, apply the appropriate filters and show all users per page
7   Background:
8     Given the following "courses" exist:
9       | fullname | shortname | groupmode |
10       | Course 1 | C1        |     1     |
11       | Course 2 | C2        |     0     |
12     And the following "users" exist:
13       | username  | firstname | lastname | email                 |
14       | student1  | Student   | 1        | student1@example.com  |
15       | student2  | Student   | 2        | student2@example.com  |
16       | student3  | Student   | 3        | student3@example.com  |
17       | student4  | Student   | 4        | student4@example.com  |
18       | student5  | Student   | 5        | student5@example.com  |
19       | student6  | Student   | 6        | student6@example.com  |
20       | student7  | Student   | 7        | student7@example.com  |
21       | student8  | Student   | 8        | student8@example.com  |
22       | student9  | Student   | 9        | student9@example.com  |
23       | student10 | Student   | 10       | student10@example.com |
24       | student11 | Student   | 11       | student11@example.com |
25       | student12 | Student   | 12       | student12@example.com |
26       | student13 | Student   | 13       | student13@example.com |
27       | student14 | Student   | 14       | student14@example.com |
28       | student15 | Student   | 15       | student15@example.com |
29       | student16 | Student   | 16       | student16@example.com |
30       | student17 | Student   | 17       | student17@example.com |
31       | student18 | Student   | 18       | student18@example.com |
32       | student19 | Student   | 19       | student19@example.com |
33       | student20 | Student   | 20       | student20@example.com |
34       | student21 | Student   | 21       | student21@example.com |
35       | student22 | Student   | 22       | student22@example.com |
36       | student23 | Student   | 23       | student23@example.com |
37       | student24 | Student   | 24       | student24@example.com |
38       | teacher1  | Teacher   | 1        | teacher1@example.com |
39     And the following "course enrolments" exist:
40       | user      | course | role           | status | timeend       |
41       | student1  | C1     | student        |    0   |               |
42       | student2  | C1     | student        |    0   |               |
43       | student3  | C1     | student        |    0   |               |
44       | student4  | C1     | student        |    0   |               |
45       | student5  | C1     | student        |    0   |               |
46       | student6  | C1     | student        |    0   |               |
47       | student7  | C1     | student        |    0   |               |
48       | student8  | C1     | student        |    0   |               |
49       | student9  | C1     | student        |    0   |               |
50       | student10 | C1     | student        |    0   |               |
51       | student11 | C1     | student        |    0   |               |
52       | student12 | C1     | student        |    0   |               |
53       | student13 | C1     | student        |    0   |               |
54       | student14 | C1     | student        |    0   |               |
55       | student15 | C1     | student        |    0   |               |
56       | student16 | C1     | student        |    0   |               |
57       | student17 | C1     | student        |    0   |               |
58       | student18 | C1     | student        |    0   |               |
59       | student19 | C1     | student        |    0   |               |
60       | student20 | C1     | student        |    0   |               |
61       | student21 | C1     | student        |    0   |               |
62       | student22 | C1     | student        |    0   |               |
63       | student23 | C1     | student        |    0   |               |
64       | student24 | C1     | student        |    1   |               |
65       | student1  | C2     | student        |    0   |               |
66       | student2  | C2     | student        |    0   |               |
67       | student3  | C2     | student        |    0   |               |
68       | teacher1  | C1     | editingteacher |    0   |               |
69       | teacher1  | C2     | editingteacher |    0   |               |
70     And the following "groups" exist:
71       | name    | course | idnumber |
72       | Group 1 | C1     | G1       |
73       | Group 2 | C1     | G2       |
74     And the following "group members" exist:
75       | user     | group |
76       | student2 | G1    |
77       | student2 | G2    |
78       | student3 | G2    |
80   @javascript
81   Scenario: Show all users in a course that match a single filter value
82     Given I log in as "teacher1"
83     And I am on "Course 1" course homepage
84     And I navigate to course participants
85     And I set the field "Match" in the "Filter 1" "fieldset" to "All"
86     And I set the field "type" in the "Filter 1" "fieldset" to "Roles"
87     And I click on ".form-autocomplete-downarrow" "css_element" in the "Filter 1" "fieldset"
88     And I click on "Student" "list_item"
89     When I click on "Apply filters" "button"
90     Then I should see "24 participants found"
91     And I should see "Show all 24"
92     And I should not see "Show 20 per page"
93     And I should not see "of the following"
94     And I click on "Show all 24" "link"
95     And I should see "Show 20 per page"
96     And I should not see "Show all 24"
98   @javascript
99   Scenario: Apply one value for more than one filter and show all matching users
100     Given I log in as "teacher1"
101     And I am on "Course 1" course homepage
102     And I navigate to course participants
103     And I click on "Add condition" "button"
104     And I set the field "Match" to "All"
105     And I set the field "Match" in the "Filter 1" "fieldset" to "Any"
106     And I set the field "type" in the "Filter 1" "fieldset" to "Roles"
107     And I click on ".form-autocomplete-downarrow" "css_element" in the "Filter 1" "fieldset"
108     And I click on "Student" "list_item"
109     And I set the field "Match" in the "Filter 2" "fieldset" to "Any"
110     And I set the field "type" in the "Filter 2" "fieldset" to "Status"
111     And I click on ".form-autocomplete-downarrow" "css_element" in the "Filter 2" "fieldset"
112     And I click on "Active" "list_item"
113     When I click on "Apply filters" "button"
114     And I click on "Show all 23" "link"
115     Then I should see "23 participants found"
116     And I should see "Show 20 per page"
117     And I should see "of the following"
118     And I should see "Student 1"
119     And I should not see "Student 24"
120     And I should not see "Show all 23"