1 |
efrain |
1 |
@tool @tool_uploadcourse @_file_upload
|
|
|
2 |
Feature: An admin can create courses with self enrolments using a CSV file
|
|
|
3 |
In order to create courses using a CSV file with self enrolment
|
|
|
4 |
As an admin
|
|
|
5 |
I need to be able to upload a CSV file and navigate through the import process
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "categories" exist:
|
|
|
9 |
| name | category | idnumber |
|
|
|
10 |
| Cat 0 | 0 | CAT0 |
|
|
|
11 |
| Cat 1 | CAT0 | CAT1 |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | CAT1 |
|
|
|
15 |
And the following "groups" exist:
|
|
|
16 |
| name | course | idnumber | enrolmentkey |
|
|
|
17 |
| group1 | C1 | G1 | test |
|
|
|
18 |
And I log in as "admin"
|
|
|
19 |
And I navigate to "Courses > Upload courses" in site administration
|
|
|
20 |
And I set the field "Upload mode" to "Create new courses, or update existing ones"
|
|
|
21 |
And I set the field "Update mode" to "Update with CSV data only"
|
|
|
22 |
|
|
|
23 |
@javascript
|
|
|
24 |
Scenario: Validation of password for uploaded courses with self enrolments
|
|
|
25 |
# usepasswordpolicy is not set.
|
|
|
26 |
Given I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_self.csv" file to "File" filemanager
|
|
|
27 |
And I click on "Preview" "button"
|
|
|
28 |
And I click on "Upload courses" "button"
|
|
|
29 |
And I should see "Courses created: 2"
|
|
|
30 |
And I should see "Courses updated: 1"
|
|
|
31 |
And I should see "Courses errors: 0"
|
|
|
32 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
33 |
And I click on "Edit" "link" in the "Self enrolment" "table_row"
|
|
|
34 |
And the field "Enrolment key" matches value "test"
|
|
|
35 |
And I press "Cancel"
|
|
|
36 |
And I click on "Delete" "link" in the "Self enrolment" "table_row"
|
|
|
37 |
And I press "Continue"
|
|
|
38 |
And I am on the "Course 2" "enrolment methods" page
|
|
|
39 |
And I click on "Edit" "link" in the "Self enrolment" "table_row"
|
|
|
40 |
And the field "Enrolment key" matches value ""
|
|
|
41 |
And I press "Cancel"
|
|
|
42 |
And I click on "Delete" "link" in the "Self enrolment" "table_row"
|
|
|
43 |
And I press "Continue"
|
|
|
44 |
And I am on the "Course 3" "enrolment methods" page
|
|
|
45 |
And I click on "Edit" "link" in the "Self enrolment" "table_row"
|
|
|
46 |
And the field "Enrolment key" matches value "Test123@"
|
|
|
47 |
And I press "Cancel"
|
|
|
48 |
And I click on "Delete" "link" in the "Self enrolment" "table_row"
|
|
|
49 |
And I press "Continue"
|
|
|
50 |
|
|
|
51 |
# Policy is used, but password not required so it will not be generated if omitted.
|
|
|
52 |
And the following config values are set as admin:
|
|
|
53 |
| config | value | plugin |
|
|
|
54 |
| usepasswordpolicy | 1 | enrol_self |
|
|
|
55 |
And I navigate to "Courses > Upload courses" in site administration
|
|
|
56 |
And I set the field "Upload mode" to "Create new courses, or update existing ones"
|
|
|
57 |
And I set the field "Update mode" to "Update with CSV data only"
|
|
|
58 |
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_self.csv" file to "File" filemanager
|
|
|
59 |
And I click on "Preview" "button"
|
|
|
60 |
And I should see "Passwords must be at least 8 characters long."
|
|
|
61 |
And I should see "Passwords must have at least 1 digit(s)."
|
|
|
62 |
And I should see "Passwords must have at least 1 upper case letter(s)."
|
|
|
63 |
And I should see "The password must have at least 1 special character(s) such as *, -, or #."
|
|
|
64 |
And I click on "Upload courses" "button"
|
|
|
65 |
And I should see "Courses created: 0"
|
|
|
66 |
And I should see "Courses updated: 2"
|
|
|
67 |
And I should see "Courses errors: 1"
|
|
|
68 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
69 |
And "Self enrolment (Student)" "table_row" should not exist
|
|
|
70 |
And I am on the "Course 2" "enrolment methods" page
|
|
|
71 |
And I click on "Edit" "link" in the "Self enrolment" "table_row"
|
|
|
72 |
And the field "Enrolment key" matches value ""
|
|
|
73 |
And I press "Cancel"
|
|
|
74 |
And I click on "Delete" "link" in the "Self enrolment" "table_row"
|
|
|
75 |
And I press "Continue"
|
|
|
76 |
And I am on the "Course 3" "enrolment methods" page
|
|
|
77 |
And I click on "Edit" "link" in the "Self enrolment" "table_row"
|
|
|
78 |
And the field "Enrolment key" matches value "Test123@"
|
|
|
79 |
And I press "Cancel"
|
|
|
80 |
And I click on "Delete" "link" in the "Self enrolment" "table_row"
|
|
|
81 |
And I press "Continue"
|
|
|
82 |
|
|
|
83 |
# Policy is used and password not required so it will be generated if omitted.
|
|
|
84 |
And the following config values are set as admin:
|
|
|
85 |
| config | value | plugin |
|
|
|
86 |
| requirepassword | 1 | enrol_self |
|
|
|
87 |
And I navigate to "Courses > Upload courses" in site administration
|
|
|
88 |
And I set the field "Upload mode" to "Create new courses, or update existing ones"
|
|
|
89 |
And I set the field "Update mode" to "Update with CSV data only"
|
|
|
90 |
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_self.csv" file to "File" filemanager
|
|
|
91 |
And I click on "Preview" "button"
|
|
|
92 |
And I should see "Passwords must be at least 8 characters long."
|
|
|
93 |
And I should see "Passwords must have at least 1 digit(s)."
|
|
|
94 |
And I should see "Passwords must have at least 1 upper case letter(s)."
|
|
|
95 |
And I should see "The password must have at least 1 special character(s) such as *, -, or #."
|
|
|
96 |
And I click on "Upload courses" "button"
|
|
|
97 |
And I should see "Courses created: 0"
|
|
|
98 |
And I should see "Courses updated: 2"
|
|
|
99 |
And I should see "Courses errors: 1"
|
|
|
100 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
101 |
And "Self enrolment (Student)" "table_row" should not exist
|
|
|
102 |
And I am on the "Course 2" "enrolment methods" page
|
|
|
103 |
And I click on "Edit" "link" in the "Self enrolment" "table_row"
|
|
|
104 |
And the field "Enrolment key" does not match value ""
|
|
|
105 |
And I am on the "Course 3" "enrolment methods" page
|
|
|
106 |
And I click on "Edit" "link" in the "Self enrolment" "table_row"
|
|
|
107 |
And the field "Enrolment key" matches value "Test123@"
|
|
|
108 |
|
|
|
109 |
# Use group enrolment keys is set to yes, so the password must be different from group enrolment key.
|
|
|
110 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
111 |
And I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
112 |
| Enrolment key | Abcejfd12@ |
|
|
|
113 |
| Use group enrolment keys | Yes |
|
|
|
114 |
And the following config values are set as admin:
|
|
|
115 |
| config | value | plugin |
|
|
|
116 |
| usepasswordpolicy | 0 | enrol_self |
|
|
|
117 |
And I navigate to "Courses > Upload courses" in site administration
|
|
|
118 |
And I set the field "Upload mode" to "Create new courses, or update existing ones"
|
|
|
119 |
And I set the field "Update mode" to "Update with CSV data only"
|
|
|
120 |
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_self.csv" file to "File" filemanager
|
|
|
121 |
And I click on "Preview" "button"
|
|
|
122 |
And I should see "This enrolment key is already used as a group enrolment key."
|