upload_users.feature 8.08 KB
Newer Older
1
@tool @tool_uploaduser @_file_upload
David Monllaó's avatar
David Monllaó committed
2
3
Feature: Upload users
  In order to add users to the system
4
  As an admin
David Monllaó's avatar
David Monllaó committed
5
6
7
8
  I need to upload files containing the users data

  @javascript
  Scenario: Upload users enrolling them on courses and groups
9
    Given the following "courses" exist:
David Monllaó's avatar
David Monllaó committed
10
11
      | fullname | shortname | category |
      | Maths | math102 | 0 |
12
    And the following "groups" exist:
David Monllaó's avatar
David Monllaó committed
13
14
15
16
      | name | course | idnumber |
      | Section 1 | math102 | S1 |
      | Section 3 | math102 | S3 |
    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
David Monllaó's avatar
David Monllaó committed
19
20
21
22
23
    And I press "Upload users"
    Then I should see "Upload users preview"
    And I should see "Tom"
    And I should see "Jones"
    And I should see "verysecret"
24
    And I should see "jonest@example.com"
David Monllaó's avatar
David Monllaó committed
25
26
27
28
29
30
31
    And I should see "Reznor"
    And I should see "course1"
    And I should see "math102"
    And I should see "group1"
    And I should see "Section 1"
    And I press "Upload users"
    And I press "Continue"
32
    And I navigate to "Users > Accounts > Browse list of users" in site administration
David Monllaó's avatar
David Monllaó committed
33
34
    And I should see "Tom Jones"
    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
41
42
43
44
45
46
47
48
49
  @javascript
  Scenario: Upload users enrolling them on courses and groups applying defaults
    Given the following "courses" exist:
      | fullname | shortname | category |
      | Maths | math102 | 0 |
    And the following "groups" exist:
      | name | course | idnumber |
      | Section 1 | math102 | S1 |
      | Section 3 | math102 | S3 |
    And I log in as "admin"
50
    And I navigate to "Users > Accounts > Upload users" in site administration
51
52
    When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager
    And I press "Upload users"
53
    And I should see "Upload users preview"
54
55
56
57
58
59
60
61
62
63
64
65
    And I set the following fields to these values:
      | City/town  | Brighton   |
      | Department | Purchasing |
    And I press "Upload users"
    And I press "Continue"
    And I navigate to "Users > Accounts > Browse list of users" in site administration
    And I should see "Tom Jones"
    And I follow "Tom Jones"
    And I follow "Edit profile"
    And the field "City/town" matches value "Brighton"
    And the field "Department" matches value "Purchasing"

66
67
68
69
  @javascript
  Scenario: Upload users with custom profile fields
    # Create user profile field.
    Given I log in as "admin"
70
    And I navigate to "Users > Accounts > User profile fields" in site administration
71
72
    And I click on "Create a new profile field" "link"
    And I click on "Text area" "link"
73
74
75
76
77
    And I set the following fields to these values:
      | Short name | superfield  |
      | Name       | Super field |
    And I click on "Save changes" "button"
    # Upload users.
78
    When I navigate to "Users > Accounts > Upload users" in site administration
79
80
    And I upload "lib/tests/fixtures/upload_users_profile.csv" file to "File" filemanager
    And I press "Upload users"
81
    And I should see "Upload users preview"
82
83
    And I press "Upload users"
    # Check that users were created and the superfield is filled.
84
    And I navigate to "Users > Accounts > Browse list of users" in site administration
85
86
87
88
    And I follow "Tom Jones"
    And I should see "Super field"
    And I should see "The big guy"
    And I log out
89

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  @javascript
  Scenario: Upload users setting their email stop value
    Given I log in as "admin"
    And I navigate to "Users > Accounts > Upload users" in site administration
    When I upload "lib/tests/fixtures/upload_users_emailstop.csv" file to "File" filemanager
    And I press "Upload users"
    Then I should see "Upload users preview"
    And the following should exist in the "uupreview" table:
      | CSV line | username | emailstop |
      | 2        | jbloggs  | 1         |
      | 3        | fbloggs  | 0         |
    And I press "Upload users"
    And I should see "Users created: 2"
    And I log out

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
  @javascript
  Scenario: Upload users setting their user theme
    Given the following "courses" exist:
      | fullname | shortname | category |
      | Maths    | math102   | 0        |
    # We need to do a bit of setup here.
    And I change window size to "large"
    And I log in as "admin"
    And I navigate to "Security > Site security settings" in site administration
    And I click on "Password policy" "checkbox"
    And I click on "Save changes" "button"
    And I navigate to "Appearance > Themes > Theme settings" in site administration
    And I click on "Allow user themes" "checkbox"
    And I click on "Save changes" "button"
    # Upload the users.
    And I navigate to "Users > Accounts > Upload users" in site administration
    When I upload "lib/tests/fixtures/upload_users_themes.csv" file to "File" filemanager
    And I press "Upload users"
    Then I should see "Upload users preview"
    And I should see "boost"
    And I should see "classic"
    And I should see "No theme is defined for this user."
    And I should see "Theme \"somefaketheme\" is not installed and will be ignored."
    And I press "Upload users"
    And I should see "Users created: 4"
    And I press "Continue"
    # Boost check.
132
133
134
    And I navigate to "Users > Accounts > Browse list of users" in site administration
    And I click on ".icon[title=Edit]" "css_element" in the "jonest@example.com" "table_row"
    And I should see "Boost"
135
    # Classic check.
136
137
138
    And I navigate to "Users > Accounts > Browse list of users" in site administration
    And I click on ".icon[title=Edit]" "css_element" in the "reznor@example.com" "table_row"
    And I should see "Classic"
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

  @javascript
  Scenario: Upload users setting their user theme when allowuserthemes is false
    Given the following "courses" exist:
      | fullname | shortname | category |
      | Maths    | math102   | 0        |
    # We need to do a bit of setup here.
    And I change window size to "large"
    And I log in as "admin"
    And I navigate to "Security > Site security settings" in site administration
    And I click on "Password policy" "checkbox"
    And I click on "Save changes" "button"
    # Upload the users.
    And I navigate to "Users > Accounts > Upload users" in site administration
    When I upload "lib/tests/fixtures/upload_users_themes.csv" file to "File" filemanager
    And I press "Upload users"
    Then I should see "Upload users preview"
    And I should see "boost"
    And I should see "classic"
    And I press "Upload users"
    And I should see "User themes are not enabled, so any included in the upload users file will be ignored."
    And I should see "Users created: 4"
    And I press "Continue"
    And I log out
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

  @javascript
  Scenario: Upload users setting their enrol date and period
    Given the following "courses" exist:
      | fullname | shortname | category |
      | Maths    | math102   | 0        |
    # Upload the users.
    And I change window size to "large"
    And I log in as "admin"
    And I navigate to "Users > Accounts > Upload users" in site administration
    When I upload "lib/tests/fixtures/upload_users_enrol_date_period.csv" file to "File" filemanager
    And I press "Upload users"
    Then I should see "Upload users preview"
    And I press "Upload users"
    # Check user enrolment start date and period
178
    And I am on "Maths" course homepage
179
180
181
182
    Then I navigate to course participants
    And I click on "Manual enrolments" "link" in the "Student One" "table_row"
    Then I should see "1 January 2019" in the "Enrolment starts" "table_row"
    And I should not see "Enrolment ends"
183
    And I click on "Close" "button" in the "Enrolment details" "dialogue"
184
185
    And I click on "Manual enrolments" "link" in the "Student Two" "table_row"
    Then I should see "2 January 2020" in the "Enrolment starts" "table_row"
186
    And I should see "12 January 2020" in the "Enrolment ends" "table_row"
187
    And I click on "Close" "button" in the "Enrolment details" "dialogue"
188
    And I log out