Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_uploadcourse @_file_upload
2
Feature: An admin can create courses with guest enrolments using a CSV file
3
  In order to create courses using a CSV file with guest 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 I log in as "admin"
16
    And I navigate to "Courses > Upload courses" in site administration
17
    And I set the field "Upload mode" to "Create new courses, or update existing ones"
18
    And I set the field "Update mode" to "Update with CSV data only"
19
 
20
  @javascript
21
  Scenario: Validation of password for uploaded courses with guest enrolments
22
    # usepasswordpolicy is not set.
23
    Given I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_guest.csv" file to "File" filemanager
24
    And I click on "Preview" "button"
25
    And I click on "Upload courses" "button"
26
    And I should see "Courses created: 2"
27
    And I should see "Courses updated: 1"
28
    And I should see "Courses errors: 0"
29
    And I am on the "Course 1" "enrolment methods" page
30
    And I click on "Edit" "link" in the "Guest access" "table_row"
31
    And the field "Password" matches value "test"
32
    And I press "Cancel"
33
    And I click on "Delete" "link" in the "Guest access" "table_row"
34
    And I press "Continue"
35
    And I am on the "Course 2" "enrolment methods" page
36
    And I click on "Edit" "link" in the "Guest access" "table_row"
37
    And the field "Password" matches value ""
38
    And I press "Cancel"
39
    And I click on "Delete" "link" in the "Guest access" "table_row"
40
    And I press "Continue"
41
    And I am on the "Course 3" "enrolment methods" page
42
    And I click on "Edit" "link" in the "Guest access" "table_row"
43
    And the field "Password" matches value "Test123@"
44
    And I press "Cancel"
45
    And I click on "Delete" "link" in the "Guest access" "table_row"
46
    And I press "Continue"
47
 
48
    # Policy is used, but password not required so it will not be generated if omitted.
49
    And the following config values are set as admin:
50
      | config            | value | plugin       |
51
      | usepasswordpolicy | 1     | enrol_guest   |
52
    And I navigate to "Courses > Upload courses" in site administration
53
    And I set the field "Upload mode" to "Create new courses, or update existing ones"
54
    And I set the field "Update mode" to "Update with CSV data only"
55
    And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_guest.csv" file to "File" filemanager
56
    And I click on "Preview" "button"
57
    And I should see "Passwords must be at least 8 characters long."
58
    And I should see "Passwords must have at least 1 digit(s)."
59
    And I should see "Passwords must have at least 1 upper case letter(s)."
60
    And I should see "The password must have at least 1 special character(s) such as *, -, or #."
61
    And I click on "Upload courses" "button"
62
    And I should see "Courses created: 0"
63
    And I should see "Courses updated: 2"
64
    And I should see "Courses errors: 1"
65
    And I am on the "Course 1" "enrolment methods" page
66
    And "Guest access" "table_row" should not exist
67
    And I am on the "Course 2" "enrolment methods" page
68
    And I click on "Edit" "link" in the "Guest access" "table_row"
69
    And the field "Password" matches value ""
70
    And I press "Cancel"
71
    And I click on "Delete" "link" in the "Guest access" "table_row"
72
    And I press "Continue"
73
    And I am on the "Course 3" "enrolment methods" page
74
    And I click on "Edit" "link" in the "Guest access" "table_row"
75
    And the field "Password" matches value "Test123@"
76
    And I press "Cancel"
77
    And I click on "Delete" "link" in the "Guest access" "table_row"
78
    And I press "Continue"
79
 
80
    # Policy is used and password not required so it will be generated if omitted.
81
    And the following config values are set as admin:
82
      | config          | value | plugin       |
83
      | requirepassword | 1     | enrol_guest   |
84
    And I navigate to "Courses > Upload courses" in site administration
85
    And I set the field "Upload mode" to "Create new courses, or update existing ones"
86
    And I set the field "Update mode" to "Update with CSV data only"
87
    And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_guest.csv" file to "File" filemanager
88
    And I click on "Preview" "button"
89
    And I should see "Passwords must be at least 8 characters long."
90
    And I should see "Passwords must have at least 1 digit(s)."
91
    And I should see "Passwords must have at least 1 upper case letter(s)."
92
    And I should see "The password must have at least 1 special character(s) such as *, -, or #."
93
    And I click on "Upload courses" "button"
94
    And I should see "Courses created: 0"
95
    And I should see "Courses updated: 2"
96
    And I should see "Courses errors: 1"
97
    And I am on the "Course 1" "enrolment methods" page
98
    And "Guest access" "table_row" should not exist
99
    And I am on the "Course 2" "enrolment methods" page
100
    And I click on "Edit" "link" in the "Guest access" "table_row"
101
    And the field "Password" does not match value ""
102
    And I am on the "Course 3" "enrolment methods" page
103
    And I click on "Edit" "link" in the "Guest access" "table_row"
104
    And the field "Password" matches value "Test123@"