Merge branch 'MDL-61801-33' of git://github.com/andrewnicols/moodle into MOODLE_33_STABLE
[moodle.git] / admin / tests / behat / filter_users.feature
blobb9a03e5ee7bb5b97ea77a5f0b3e0094a70a4be01
1 @core @core_admin
2 Feature: An administrator can filter user accounts by role, cohort and other profile fields
3   In order to find the user accounts I am looking for
4   As an admin
5   I need to filter the users account list using different filter
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email | auth | confirmed |
10       | user1 | User | One | one@example.com | manual | 0 |
11       | user2 | User | Two | two@example.com | ldap | 1 |
12       | user3 | User | Three | three@example.com | manual | 1 |
13       | user4 | User | Four | four@example.com | ldap | 0 |
14     And the following "cohorts" exist:
15       | name | idnumber |
16       | Cohort 1 | CH1 |
17     And the following "courses" exist:
18       | fullname | shortname | category |
19       | Course 1 | C1 | 0 |
20     And the following "course enrolments" exist:
21       | user | course | role |
22       | user1 | C1 | student |
23       | user2 | C1 | student |
24       | user3 | C1 | student |
25     And I log in as "admin"
26     And I add "User Two (two@example.com)" user to "CH1" cohort members
27     And I add "User Three (three@example.com)" user to "CH1" cohort members
28     And I navigate to "Users > Accounts > Browse list of users" in site administration
30   Scenario: Filter user accounts by role and cohort
31     When I set the following fields to these values:
32       | courserole_rl | Student |
33       | courserole_ct | any category |
34       | courserole | C1 |
35     And I press "Add filter"
36     Then I should see "User One"
37     And I should see "User Two"
38     And I should see "User Three"
39     And I should not see "User Four"
40     And I set the following fields to these values:
41       | cohort | CH1 |
42     And I press "Add filter"
43     And I should not see "User One"
44     And I should see "User Two"
45     And I should see "User Three"
46     And I should not see "User Four"
47     And I press "Remove all filters"
48     And I should see "User One"
49     And I should see "User Two"
50     And I should see "User Three"
51     And I should see "User Four"
53   Scenario: Filter user accounts by confirm and authentication method
54     When I set the following fields to these values:
55       | Confirmed | No |
56     And I press "Add filter"
57     Then I should see "User One"
58     And I should not see "User Two"
59     And I should not see "User Three"
60     And I should see "User Four"
61     And I set the following fields to these values:
62       | Authentication | manual |
63     And I press "Add filter"
64     And I should see "User One"
65     And I should not see "User Two"
66     And I should not see "User Three"
67     And I should not see "User Four"