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