weekly release 5.0dev
[moodle.git] / user / tests / behat / filter_idnumber.feature
blobe6b1f0edcc08092a43f3ea94457e89348202cfa0
1 @core @core_user
2 Feature: Filter users by idnumber
3   As a system administrator
4   I need to be able to filter users by their ID number
5   So that I can quickly find users based on an external key.
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email | idnumber |
10       | teacher1 | Teacher  | 1 | teacher@example.com  | 0000002 |
11       | student1 | Student1 | 1 | student1@example.com | 0000003 |
12       | student2 | Student2 | 1 | student2@example.com | 2000000 |
13       | student3 | Student3 | 1 | student3@example.com | 3000000 |
14     And I log in as "admin"
15     And I navigate to "Users > Accounts > Browse list of users" in site administration
17   @javascript
18   Scenario: Filtering id numbers - with case "is empty"
19     # We should see see admin on the user list, the following e-mail is admin's e-mail.
20     Then I should see "moodle@example.com" in the "reportbuilder-table" "table"
21     And I should see "Teacher" in the "reportbuilder-table" "table"
22     And I should see "Student1" in the "reportbuilder-table" "table"
23     And I should see "Student2" in the "reportbuilder-table" "table"
24     And I should see "Student3" in the "reportbuilder-table" "table"
25     And I click on "Filters" "button"
26     And I set the following fields in the "ID number" "core_reportbuilder > Filter" to these values:
27       | ID number operator | Is empty |
28     And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
29     And I click on "Filters" "button"
30     # We should see admin on the user list, the following e-mail is admin's e-mail.
31     Then I should see "moodle@example.com" in the "reportbuilder-table" "table"
32     And I should not see "Teacher" in the "reportbuilder-table" "table"
33     And I should not see "Student1" in the "reportbuilder-table" "table"
34     And I should not see "Student2" in the "reportbuilder-table" "table"
35     And I should not see "Student3" in the "reportbuilder-table" "table"
37   @javascript
38   Scenario Outline: Filtering id numbers - with all other cases
39     # We should see see admin on the user list, the following e-mail is admin's e-mail.
40     Then I should see "moodle@example.com" in the "reportbuilder-table" "table"
41     And I should see "Teacher" in the "reportbuilder-table" "table"
42     And I should see "Student1" in the "reportbuilder-table" "table"
43     And I should see "Student2" in the "reportbuilder-table" "table"
44     And I should see "Student3" in the "reportbuilder-table" "table"
45     And I click on "Filters" "button"
46     And I set the following fields in the "ID number" "core_reportbuilder > Filter" to these values:
47       | ID number operator | <Category> |
48       | ID number value    | <Argument> |
49     And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
50     And I click on "Filters" "button"
51     Then I should <Admin's Visibility> "moodle@example.com" in the "reportbuilder-table" "table"
52     And I should <Teacher's Vis> "Teacher" in the "reportbuilder-table" "table"
53     And I should <S1's Vis> "Student1" in the "reportbuilder-table" "table"
54     And I should <S2's Vis> "Student2" in the "reportbuilder-table" "table"
55     And I should <S3's Vis> "Student3" in the "reportbuilder-table" "table"
57     Examples:
58       | Category         | Argument | Admin's Visibility | Teacher's Vis | S1's Vis | S2's Vis | S3's Vis |
59       | Contains         | 0        | not see            | see           | see      | see      | see      |
60       | Does not contain | 2        | see                | not see       | see      | not see  | see      |
61       | Is equal to      | 2000000  | not see            | not see       | not see  | see      | not see  |
62       | Starts with      | 0        | not see            | see           | see      | not see  | not see  |
63       | Ends with        | 0        | not see            | not see       | not see  | see      | see      |