1 |
efrain |
1 |
@core @core_admin @core_reportbuilder
|
|
|
2 |
Feature: An administrator can browse user accounts
|
|
|
3 |
In order to find the user accounts I am looking for
|
|
|
4 |
As an admin
|
|
|
5 |
I can browse users and see their basic information
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "custom profile fields" exist:
|
|
|
9 |
| datatype | shortname | name |
|
|
|
10 |
| text | frog | Favourite frog |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email | department | profile_field_frog | firstnamephonetic |
|
|
|
13 |
| user1 | User | One | one@example.com | Attack | Kermit | Yewzer |
|
|
|
14 |
| user2 | User | Two | two@example.com | Defence | Tree | Yoozare |
|
|
|
15 |
And I log in as "admin"
|
|
|
16 |
|
|
|
17 |
Scenario: User accounts display default fields
|
|
|
18 |
When I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
19 |
# Name field always present, email field is default for showidentity.
|
|
|
20 |
Then the following should exist in the "reportbuilder-table" table:
|
|
|
21 |
| First name / Last name | Email address |
|
|
|
22 |
| User One | one@example.com |
|
|
|
23 |
| User Two | two@example.com |
|
|
|
24 |
# Should not see other identity fields or non-default name fields.
|
|
|
25 |
And I should not see "Department" in the "reportbuilder-table" "table"
|
|
|
26 |
And I should not see "Attack" in the "reportbuilder-table" "table"
|
|
|
27 |
And I should not see "Favourite frog" in the "reportbuilder-table" "table"
|
|
|
28 |
And I should not see "Kermit" in the "reportbuilder-table" "table"
|
|
|
29 |
And I should not see "First name - phonetic" in the "reportbuilder-table" "table"
|
|
|
30 |
And I should not see "Yoozare" in the "reportbuilder-table" "table"
|
|
|
31 |
|
|
|
32 |
Scenario: User accounts with extra name fields
|
|
|
33 |
Given the following config values are set as admin:
|
|
|
34 |
| alternativefullnameformat | firstnamephonetic lastname |
|
|
|
35 |
When I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
36 |
Then the following should exist in the "reportbuilder-table" table:
|
|
|
37 |
| First name - phonetic / Last name | Email address |
|
|
|
38 |
| Yewzer One | one@example.com |
|
|
|
39 |
| Yoozare Two | two@example.com |
|
|
|
40 |
|
|
|
41 |
Scenario: User accounts with specified identity fields
|
|
|
42 |
Given the following config values are set as admin:
|
|
|
43 |
| showuseridentity | department,profile_field_frog |
|
|
|
44 |
When I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
45 |
Then the following should exist in the "reportbuilder-table" table:
|
|
|
46 |
| First name / Last name | Favourite frog | Department |
|
|
|
47 |
| User One | Kermit | Attack |
|
|
|
48 |
| User Two | Tree | Defence |
|
|
|
49 |
And I should not see "Email address" in the "table" "css_element"
|
|
|
50 |
And I should not see "one@example.com"
|
|
|
51 |
|
|
|
52 |
@javascript
|
|
|
53 |
Scenario: Sort user accounts by custom profile field
|
|
|
54 |
Given the following config values are set as admin:
|
|
|
55 |
| showuseridentity | profile_field_frog |
|
|
|
56 |
When I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
57 |
And I follow "Favourite frog"
|
|
|
58 |
Then "Kermit" "text" should appear before "Tree" "text"
|
|
|
59 |
And I follow "Favourite frog"
|
|
|
60 |
Then "Tree" "text" should appear before "Kermi" "text"
|
|
|
61 |
|
|
|
62 |
@javascript
|
|
|
63 |
Scenario: Edit user information
|
|
|
64 |
Given I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
65 |
And I press "Edit" action in the "User One" report row
|
|
|
66 |
And I set the field "Last name" to "OneOne"
|
|
|
67 |
And I press "Update profile"
|
|
|
68 |
Then I should see "User OneOne"
|
|
|
69 |
|
|
|
70 |
@javascript
|
|
|
71 |
Scenario: Suspend and activate user account
|
|
|
72 |
Given I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
73 |
And I press "Suspend user account" action in the "User One" report row
|
|
|
74 |
And I should see "Suspended" in the "User One" "table_row"
|
|
|
75 |
And I press "Activate user account" action in the "User One" report row
|
|
|
76 |
Then I should not see "Suspended" in the "User One" "table_row"
|
|
|
77 |
|
|
|
78 |
@javascript
|
|
|
79 |
Scenario: Delete a user account
|
|
|
80 |
Given I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
81 |
And I press "Delete" action in the "User One" report row
|
|
|
82 |
And I should see "Are you absolutely sure you want to completely delete the user User One" in the "Delete user" "dialogue"
|
|
|
83 |
And I click on "Delete" "button" in the "Delete user" "dialogue"
|
|
|
84 |
Then I should see "Deleted user User One"
|
|
|
85 |
And I should not see "User One" in the "reportbuilder-table" "table"
|
|
|
86 |
|
|
|
87 |
@javascript
|
|
|
88 |
Scenario: Resend email and confirm a user account
|
|
|
89 |
Given the following "users" exist:
|
|
|
90 |
| username | firstname | lastname | email | confirmed |
|
|
|
91 |
| user3 | User | Three | three@example.com | 0 |
|
|
|
92 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
93 |
Then I should see "Confirmation pending" in the "User Three" "table_row"
|
|
|
94 |
And I press "Resend confirmation email" action in the "User Three" report row
|
|
|
95 |
And I should see "Confirmation email sent successfully"
|
|
|
96 |
And I press "Confirm" action in the "User Three" report row
|
|
|
97 |
And I should not see "Confirmation pending" in the "User Three" "table_row"
|
|
|
98 |
|
|
|
99 |
@javascript
|
|
|
100 |
Scenario: User report filters
|
|
|
101 |
Given the following "users" exist:
|
|
|
102 |
| username | firstname | lastname | email | profile_field_frog |
|
|
|
103 |
| user3 | User | Three | three@example.com | Glass |
|
|
|
104 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
105 |
Then the following should exist in the "reportbuilder-table" table:
|
|
|
106 |
| First name / Last name | Email address |
|
|
|
107 |
| User One | one@example.com |
|
|
|
108 |
| User Two | two@example.com |
|
|
|
109 |
| User Three | three@example.com |
|
|
|
110 |
And I click on "Filters" "button"
|
|
|
111 |
And I set the following fields in the "Last name" "core_reportbuilder > Filter" to these values:
|
|
|
112 |
| Last name operator | Is equal to |
|
|
|
113 |
| Last name value | Three |
|
|
|
114 |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
|
|
115 |
And I click on "Filters" "button"
|
|
|
116 |
And I should see "User Three" in the "reportbuilder-table" "table"
|
|
|
117 |
And I should not see "User One" in the "reportbuilder-table" "table"
|
|
|
118 |
And I should not see "User Two" in the "reportbuilder-table" "table"
|
|
|
119 |
And I click on "Filters" "button"
|
|
|
120 |
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
|
|
|
121 |
And I set the following fields in the "Favourite frog" "core_reportbuilder > Filter" to these values:
|
|
|
122 |
| Favourite frog operator | Is equal to |
|
|
|
123 |
| Favourite frog value | Kermit |
|
|
|
124 |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
|
|
125 |
And I click on "Filters" "button"
|
|
|
126 |
And I should see "User One" in the "reportbuilder-table" "table"
|
|
|
127 |
And I should not see "User Two" in the "reportbuilder-table" "table"
|
|
|
128 |
And I should not see "User Three" in the "reportbuilder-table" "table"
|
|
|
129 |
|
|
|
130 |
@javascript
|
|
|
131 |
Scenario: User report enrolled in any course filter
|
|
|
132 |
Given the following "courses" exist:
|
|
|
133 |
| shortname | fullname |
|
|
|
134 |
| C1 | Course 1 |
|
|
|
135 |
And the following "course enrolments" exist:
|
|
|
136 |
| user | course | role |
|
|
|
137 |
| user2 | C1 | student |
|
|
|
138 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
139 |
Then the following should exist in the "reportbuilder-table" table:
|
|
|
140 |
| First name / Last name | Email address |
|
|
|
141 |
| User One | one@example.com |
|
|
|
142 |
| User Two | two@example.com |
|
|
|
143 |
And I click on "Filters" "button"
|
|
|
144 |
And I set the following fields in the "Enrolled in any course" "core_reportbuilder > Filter" to these values:
|
|
|
145 |
| Enrolled in any course operator | Yes |
|
|
|
146 |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
|
|
147 |
And I click on "Filters" "button"
|
|
|
148 |
And I should not see "User One" in the "reportbuilder-table" "table"
|
|
|
149 |
And I should see "User Two" in the "reportbuilder-table" "table"
|
|
|
150 |
|
|
|
151 |
@javascript
|
|
|
152 |
Scenario: User report system role and course role filters
|
|
|
153 |
Given the following "users" exist:
|
|
|
154 |
| username | firstname | lastname | email |
|
|
|
155 |
| user3 | User | Three | three@example.com |
|
|
|
156 |
And the following "courses" exist:
|
|
|
157 |
| shortname | fullname |
|
|
|
158 |
| C1 | Course 1 |
|
|
|
159 |
And the following "course enrolments" exist:
|
|
|
160 |
| user | course | role |
|
|
|
161 |
| user1 | C1 | student |
|
|
|
162 |
| user2 | C1 | editingteacher |
|
|
|
163 |
| user3 | C1 | student |
|
|
|
164 |
And the following "role assigns" exist:
|
|
|
165 |
| user | role | contextlevel | reference |
|
|
|
166 |
| user1 | coursecreator | system | |
|
|
|
167 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
168 |
Then the following should exist in the "reportbuilder-table" table:
|
|
|
169 |
| First name / Last name | Email address |
|
|
|
170 |
| User One | one@example.com |
|
|
|
171 |
| User Two | two@example.com |
|
|
|
172 |
| User Three | three@example.com |
|
|
|
173 |
And I click on "Filters" "button"
|
|
|
174 |
And I set the following fields in the "System role" "core_reportbuilder > Filter" to these values:
|
|
|
175 |
| System role operator | Is equal to |
|
|
|
176 |
| System role value | Course creator |
|
|
|
177 |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
|
|
178 |
And I click on "Filters" "button"
|
|
|
179 |
And I should see "User One" in the "reportbuilder-table" "table"
|
|
|
180 |
And I should not see "User Two" in the "reportbuilder-table" "table"
|
|
|
181 |
And I should not see "User Three" in the "reportbuilder-table" "table"
|
|
|
182 |
And I click on "Filters" "button"
|
|
|
183 |
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
|
|
|
184 |
And I set the following fields in the "Course role" "core_reportbuilder > Filter" to these values:
|
|
|
185 |
| Role name | Teacher |
|
|
|
186 |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
|
|
187 |
And I click on "Filters" "button"
|
|
|
188 |
And I should not see "User One" in the "reportbuilder-table" "table"
|
|
|
189 |
And I should see "User Two" in the "reportbuilder-table" "table"
|
|
|
190 |
And I should not see "User Three" in the "reportbuilder-table" "table"
|
|
|
191 |
|
|
|
192 |
Scenario: Add a new user
|
|
|
193 |
Given I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
194 |
And I click on "Add a new user" "link"
|
|
|
195 |
Then I should see "Username"
|
|
|
196 |
And I should see "User picture"
|
|
|
197 |
And I should see "Additional names"
|
|
|
198 |
|
|
|
199 |
@javascript
|
|
|
200 |
Scenario: Browse user list as a person with limited capabilities
|
|
|
201 |
Given the following "users" exist:
|
|
|
202 |
| username | firstname | lastname | email |
|
|
|
203 |
| manager | Max | Manager | manager@example.com |
|
|
|
204 |
And the following "roles" exist:
|
|
|
205 |
| name | shortname | description | archetype |
|
|
|
206 |
| Custom manager | custom1 | My custom role 1 | |
|
|
|
207 |
And the following "permission overrides" exist:
|
|
|
208 |
| capability | permission | role | contextlevel | reference |
|
|
|
209 |
| moodle/site:configview | Allow | custom1 | System | |
|
|
|
210 |
| moodle/user:update | Allow | custom1 | System | |
|
|
|
211 |
And the following "role assigns" exist:
|
|
|
212 |
| user | role | contextlevel | reference |
|
|
|
213 |
| manager | custom1 | System | |
|
|
|
214 |
When I log in as "manager"
|
|
|
215 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
216 |
And I click on "User One" "checkbox"
|
|
|
217 |
And the "Bulk user actions" select box should contain "Confirm"
|
|
|
218 |
And the "Bulk user actions" select box should not contain "Delete"
|
|
|
219 |
And I set the field "Bulk user actions" to "Force password change"
|
|
|
220 |
And I should see "Are you absolutely sure you want to force a password change to User One ?"
|
|
|
221 |
And I press "Yes"
|
|
|
222 |
And I press "Continue"
|
|
|
223 |
And I should see "Browse list of users"
|