Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_uploaduser @_file_upload
2
Feature: Upload users
3
  In order to add users to the system
4
  As an admin
5
  I need to upload files containing the users data
6
 
7
  @javascript
8
  Scenario: Upload users enrolling them on courses and groups
9
    Given the following "courses" exist:
10
      | fullname | shortname | category |
11
      | Maths | math102 | 0 |
12
    And the following "groups" exist:
13
      | name | course | idnumber |
14
      | Section 1 | math102 | S1 |
15
      | Section 3 | math102 | S3 |
16
    And I log in as "admin"
17
    And I navigate to "Users > Accounts > Upload users" in site administration
18
    When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager
19
    And I press "Upload users"
20
    Then I should see "Upload users preview"
21
    And I should see "Tom"
22
    And I should see "Jones"
23
    And I should see "verysecret"
24
    And I should see "jonest@example.com"
25
    And I should see "Reznor"
26
    And I should see "course1"
27
    And I should see "math102"
28
    And I should see "group1"
29
    And I should see "Section 1"
30
    And I press "Upload users"
31
    And I press "Continue"
32
    And I navigate to "Users > Accounts > Browse list of users" in site administration
33
    And I should see "Tom Jones"
34
    And I should see "Trent Reznor"
35
    And I should see "reznor@example.com"
36
    And I am on the "Maths" "groups" page
37
    And I set the field "groups" to "Section 1 (1)"
38
    And the "members" select box should contain "Tom Jones (jonest@example.com)"
39
 
40
  @javascript
41
  Scenario: Upload users enrolling them on courses and groups applying defaults
42
    Given the following "courses" exist:
43
      | fullname | shortname | category |
44
      | Maths | math102 | 0 |
45
    And the following "groups" exist:
46
      | name | course | idnumber |
47
      | Section 1 | math102 | S1 |
48
      | Section 3 | math102 | S3 |
49
    And I log in as "admin"
50
    And I navigate to "Users > Accounts > Upload users" in site administration
51
    When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager
52
    And I press "Upload users"
53
    And I should see "Upload users preview"
54
    And I set the following fields to these values:
55
      | City/town  | Brighton   |
56
      | Department | Purchasing |
57
    And I press "Upload users"
58
    And I press "Continue"
59
    And I navigate to "Users > Accounts > Browse list of users" in site administration
60
    And I should see "Tom Jones"
61
    And I follow "Tom Jones"
62
    And I follow "Edit profile"
63
    And the field "City/town" matches value "Brighton"
64
    And the field "Department" matches value "Purchasing"
65
 
66
  @javascript
67
  Scenario: Upload users with custom profile fields
68
    # Create user profile field.
69
    Given the following "custom profile fields" exist:
70
      | datatype | shortname  | name        |
71
      | text     | superfield | Super field |
72
    And I log in as "admin"
73
    # Upload users.
74
    When I navigate to "Users > Accounts > Upload users" in site administration
75
    And I upload "lib/tests/fixtures/upload_users_profile.csv" file to "File" filemanager
76
    And I press "Upload users"
77
    And I should see "Upload users preview"
78
    And I press "Upload users"
79
    # Check that users were created and the superfield is filled.
80
    And I navigate to "Users > Accounts > Browse list of users" in site administration
81
    And I follow "Tom Jones"
82
    And I should see "Super field"
83
    And I should see "The big guy"
84
    And I log out
85
 
86
  @javascript
87
  Scenario: Upload users setting their email stop value
88
    Given I log in as "admin"
89
    And I navigate to "Users > Accounts > Upload users" in site administration
90
    When I upload "lib/tests/fixtures/upload_users_emailstop.csv" file to "File" filemanager
91
    And I press "Upload users"
92
    Then I should see "Upload users preview"
93
    And the following should exist in the "uupreview" table:
94
      | CSV line | username | emailstop |
95
      | 2        | jbloggs  | 1         |
96
      | 3        | fbloggs  | 0         |
97
    And I press "Upload users"
98
    And I should see "Users created: 2"
99
    And I log out
100
 
101
  @javascript
102
  Scenario: Upload users setting their user theme
103
    Given the following "courses" exist:
104
      | fullname | shortname | category |
105
      | Maths    | math102   | 0        |
106
    # We need to do a bit of setup here.
107
    And I change window size to "large"
108
    And I log in as "admin"
109
    And I navigate to "Security > Site security settings" in site administration
110
    And I click on "Password policy" "checkbox"
111
    And I click on "Save changes" "button"
112
    And I navigate to "Appearance > Advanced theme settings" in site administration
113
    And I click on "Allow user themes" "checkbox"
114
    And I click on "Save changes" "button"
115
    # Upload the users.
116
    And I navigate to "Users > Accounts > Upload users" in site administration
117
    When I upload "lib/tests/fixtures/upload_users_themes.csv" file to "File" filemanager
118
    And I press "Upload users"
119
    Then I should see "Upload users preview"
120
    And I should see "boost"
121
    And I should see "classic"
122
    And I should see "No theme is defined for this user."
123
    And I should see "Theme \"somefaketheme\" is not installed and will be ignored."
124
    And I press "Upload users"
125
    And I should see "Users created: 4"
126
    And I press "Continue"
127
    # Boost check.
128
    And I am on the "jonest@example.com" "user > editing" page
129
    And I should see "Boost"
130
    # Classic check.
131
    And I am on the "reznor@example.com" "user > editing" page
132
    And I should see "Classic"
133
 
134
  @javascript
135
  Scenario: Upload users setting their user theme when allowuserthemes is false
136
    Given the following "courses" exist:
137
      | fullname | shortname | category |
138
      | Maths    | math102   | 0        |
139
    # We need to do a bit of setup here.
140
    And I change window size to "large"
141
    And I log in as "admin"
142
    And I navigate to "Security > Site security settings" in site administration
143
    And I click on "Password policy" "checkbox"
144
    And I click on "Save changes" "button"
145
    # Upload the users.
146
    And I navigate to "Users > Accounts > Upload users" in site administration
147
    When I upload "lib/tests/fixtures/upload_users_themes.csv" file to "File" filemanager
148
    And I press "Upload users"
149
    Then I should see "Upload users preview"
150
    And I should see "boost"
151
    And I should see "classic"
152
    And I press "Upload users"
153
    And I should see "User themes are not enabled, so any included in the upload users file will be ignored."
154
    And I should see "Users created: 4"
155
    And I press "Continue"
156
    And I log out
157
 
158
  @javascript
159
  Scenario: Upload users setting their enrol date and period
160
    Given the following "courses" exist:
161
      | fullname | shortname | category |
162
      | Maths    | math102   | 0        |
163
    # Upload the users.
164
    And I change window size to "large"
165
    And I log in as "admin"
166
    And I navigate to "Users > Accounts > Upload users" in site administration
167
    When I upload "lib/tests/fixtures/upload_users_enrol_date_period.csv" file to "File" filemanager
168
    And I press "Upload users"
169
    Then I should see "Upload users preview"
170
    And I press "Upload users"
171
    # Check user enrolment start date and period
172
    And I am on "Maths" course homepage
173
    Then I navigate to course participants
174
    And I click on "Manual enrolments" "link" in the "Student One" "table_row"
175
    Then I should see "1 January 2019" in the "Enrolment starts" "table_row"
176
    And I should not see "Enrolment ends"
177
    And I click on "Close" "button" in the "Enrolment details" "dialogue"
178
    And I click on "Manual enrolments" "link" in the "Student Two" "table_row"
179
    Then I should see "2 January 2020" in the "Enrolment starts" "table_row"
180
    And I should see "12 January 2020" in the "Enrolment ends" "table_row"
181
    And I click on "Close" "button" in the "Enrolment details" "dialogue"
182
    And I log out
183
 
184
  @javascript
185
  Scenario: Upload users enrolling them on courses and assign category roles
186
    Given the following "courses" exist:
187
      | fullname | shortname |
188
      | management1 | management1 |
189
      | film1 | film1 |
190
    And the following "categories" exist:
191
      | name | idnumber |
192
      | MGMT | MGMT |
193
      | Film | Film |
194
    And I log in as "admin"
195
    And I navigate to "Users > Accounts > Upload users" in site administration
196
    When I upload "lib/tests/fixtures/upload_users_category.csv" file to "File" filemanager
197
    And I press "Upload users"
198
    Then I should see "Upload users preview"
199
    And I should see "Tom"
200
    And I should see "Jones"
201
    And I should see "Trent"
202
    And I should see "Reznor"
203
    And I should see "Aurora"
204
    And I should see "Jiang"
205
    And I should see "Federico"
206
    And I should see "Fellini"
207
    And I should see "Ivan"
208
    And I should see "Ivanov"
209
    And I should see "John"
210
    And I should see "Smith"
211
    And I should see "Warm"
212
    And I should see "Cool"
213
    And I should see "James"
214
    And I should see "Bond"
215
    And I should see "MGMT"
216
    And I should see "Film"
217
    And I should see "manager"
218
    And I should see "student"
219
    And I should see "coursecreator"
220
    And I should see "management1"
221
    And I should see "film1"
222
    And I press "Upload users"
223
    And I should see "Unknown category with category ID number \"Movie\""
224
    And I should see "Unknown course named \"movie1\""
225
    And I should see "Unknown role \"notcoursecreator\""
226
    And I should see "Could not assign role to user: missing role for category"
227
    And I press "Continue"
228
    And I navigate to "Users > Accounts > Browse list of users" in site administration
229
    And I should see "Tom Jones"
230
    And I should see "Trent Reznor"
231
    And I should see "reznor@example.com"
232
    And I am on the "management1" "enrolled users" page
233
    And I should see "Tom Jones"
234
    And I should see "Trent Reznor"
235
    And I should see "Aurora Jiang"
236
    And I should see "Student"
237
    And I am on the "film1" "enrolled users" page
238
    And I should see "Federico Fellini"
239
    And I should see "Student"
240
    And I am on site homepage
241
    And I navigate to "Courses > Manage courses and categories" in site administration
242
    And I click on "permissions" action for "MGMT" in management category listing
243
    And I set the field "Participants tertiary navigation" to "Assign roles"
244
    And I should see "Manager"
245
    And I should see "Tom Jones"
246
    And I should see "Trent Reznor"
247
    And I should see "Course creator"
248
    And I should see "Aurora Jiang"
249
    And I am on site homepage
250
    And I navigate to "Courses > Manage courses and categories" in site administration
251
    And I click on "permissions" action for "Film" in management category listing
252
    And I set the field "Participants tertiary navigation" to "Assign roles"
253
    And I should see "Course creator"
254
    And I should see "Federico Fellini"
255
 
256
  @javascript
257
  Scenario: Update existing users matching them on email
258
    Given the following "users" exist:
259
      | username | firstname | lastname | email              |
260
      | bilbob   | Blasbo    | Blabbins | bilbo@example.com |
261
      | frodob   | Frodeo    | Baspins  | frodo@example.com |
262
    And I log in as "admin"
263
    And I navigate to "Users > Accounts >Upload users" in site administration
264
    When I upload "lib/tests/fixtures/upload_users_email_matching.csv" file to "File" filemanager
265
    And I press "Upload users"
266
    Then I should see "Upload users preview"
267
    And I set the following fields to these values:
268
      | Upload type  | Update existing users only |
269
      | Existing user details | Override with file |
270
      | Match on email address | Yes |
271
    And I press "Upload users"
272
    And I press "Continue"
273
    And I navigate to "Users > Accounts > Browse list of users" in site administration
274
    And I should see "Bilbo Baggins"
275
    And I should see "Frodo Baggins"
276
 
277
  @javascript
278
  Scenario: Update existing users matching them on email where one email address is associated with multiple users
279
    Given the following "users" exist:
280
      | username | firstname | lastname | email              |
281
      | bilbob   | Blasbo    | Blabbins | bilbo@example.com |
282
      | frodob   | Frodeo    | Baspins  | frodo@example.com |
283
      | fredob   | Fredoo    | Baspins  | frodo@example.com |
284
    And I log in as "admin"
285
    And I navigate to "Users > Accounts > Upload users" in site administration
286
    When I upload "lib/tests/fixtures/upload_users_email_matching.csv" file to "File" filemanager
287
    And I press "Upload users"
288
    Then I should see "Upload users preview"
289
    And I set the following fields to these values:
290
      | Upload type  | Update existing users only |
291
      | Existing user details | Override with file |
292
      | Match on email address | Yes |
293
    And I press "Upload users"
294
    And I should see "Multiple users with email frodo@example.com detected"
295
    And I press "Continue"
296
    And I navigate to "Users > Accounts > Browse list of users" in site administration
297
    And I should see "Bilbo Baggins"
298
    And I should not see "Frodo Baggins"
299
 
300
  @javascript
301
  Scenario: Create a new user when matching them on email where where the username already exists
302
    Given the following "users" exist:
303
      | username | firstname | lastname | email               |
304
      | bilbob   | Samwise   | Gamgee   | samwise@example.com |
305
      | frodob   | Frodeo    | Baspins  | frodo@example.com   |
306
    And I log in as "admin"
307
    And I navigate to "Users > Accounts > Upload users" in site administration
308
    When I upload "lib/tests/fixtures/upload_users_email_matching.csv" file to "File" filemanager
309
    And I press "Upload users"
310
    Then I should see "Upload users preview"
311
    And I set the following fields to these values:
312
      | Upload type            | Add new and update existing users |
313
      | Existing user details  | Override with file                |
314
      | Match on email address | Yes                               |
315
    And I press "Upload users"
316
    And I should see "User not added - username already exists under a different email"
317
    And I press "Continue"
318
    And I navigate to "Users > Accounts > Browse list of users" in site administration
319
    And I should see "Samwise Gamgee"
320
    And I should see "Frodo Baggins"