Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_cohort @_file_upload
2
Feature: A privileged user can create cohorts using a CSV file
3
  In order to create cohorts using a CSV file
4
  As an admin
5
  I need to be able to upload a CSV file and navigate through the upload process
6
 
7
  Background:
8
    Given the following "categories" exist:
9
      | name  | category | idnumber |
10
      | Cat 1 | 0        | CAT1     |
11
      | Cat 2 | 0        | CAT2     |
12
      | Cat 3 | CAT1     | CAT3     |
13
 
14
  @javascript
15
  Scenario: Upload cohorts with default System context as admin
16
    When I log in as "admin"
17
    And I navigate to "Users > Accounts >Cohorts" in site administration
18
    And I follow "Upload cohorts"
19
    And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
20
    And I click on "Preview" "button"
21
    Then the following should exist in the "previewuploadedcohorts" table:
22
      | name          | idnumber  | description       | Context       | visible | Status |
23
      | cohort name 1 | cohortid1 | first description | System        | 1       |        |
24
      | cohort name 2 | cohortid2 |                   | System        | 1       |        |
25
      | cohort name 3 | cohortid3 |                   | Category 1    | 0       |        |
26
      | cohort name 4 | cohortid4 |                   | Cat 1         | 1       |        |
27
      | cohort name 5 | cohortid5 |                   | Cat 2         | 0       |        |
28
      | cohort name 6 | cohortid6 |                   | Cat 3         | 1       |        |
29
    And I press "Upload cohorts"
30
    And I should see "Uploaded 6 cohorts"
31
    And I press "Continue"
32
    And the following should exist in the "reportbuilder-table" table:
33
      | Name          | Cohort ID | Description | Cohort size | Source           |
34
      | cohort name 1 | cohortid1 | first description | 0           | Created manually |
35
      | cohort name 2 | cohortid2 |             | 0           | Created manually |
36
    And I follow "All cohorts"
37
    And the following should exist in the "reportbuilder-table" table:
38
      | Category      | Name          | Cohort ID | Description       | Cohort size | Source           |
39
      | System        | cohort name 1 | cohortid1 | first description | 0           | Created manually |
40
      | System        | cohort name 2 | cohortid2 |                   | 0           | Created manually |
41
      | Category 1    | cohort name 3 | cohortid3 |                   | 0           | Created manually |
42
      | Cat 1         | cohort name 4 | cohortid4 |                   | 0           | Created manually |
43
      | Cat 2         | cohort name 5 | cohortid5 |                   | 0           | Created manually |
44
      | Cat 3         | cohort name 6 | cohortid6 |                   | 0           | Created manually |
45
    And ".text-muted" "css_element" should not exist in the "cohort name 1" "table_row"
46
    And ".text-muted" "css_element" should not exist in the "cohort name 2" "table_row"
47
    And ".text-muted" "css_element" should exist in the "cohort name 3" "table_row"
48
    And the "class" attribute of "cohort name 3" "table_row" should contain "text-muted"
49
    And ".text-muted" "css_element" should not exist in the "cohort name 4" "table_row"
50
    And the "class" attribute of "cohort name 5" "table_row" should contain "text-muted"
51
    And ".text-muted" "css_element" should not exist in the "cohort name 6" "table_row"
52
 
53
  @javascript @_file_upload
54
  Scenario: Upload cohorts with default category context as admin
55
    When I log in as "admin"
56
    And I navigate to "Users > Accounts >Cohorts" in site administration
57
    And I follow "Upload cohorts"
58
    And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
59
    And I set the field "Default context" to "Cat 1 / Cat 3"
60
    And I click on "Preview" "button"
61
    Then the following should exist in the "previewuploadedcohorts" table:
62
      | name          | idnumber  | description       | Context                 | Status |
63
      | cohort name 1 | cohortid1 | first description | Cat 3         |        |
64
      | cohort name 2 | cohortid2 |                   | Cat 3         |        |
65
      | cohort name 3 | cohortid3 |                   | Category 1    |        |
66
      | cohort name 4 | cohortid4 |                   | Cat 1         |        |
67
      | cohort name 5 | cohortid5 |                   | Cat 2         |        |
68
      | cohort name 6 | cohortid6 |                   | Cat 3         |        |
69
    And I press "Upload cohorts"
70
    And I should see "Uploaded 6 cohorts"
71
    And I press "Continue"
72
    And I should see "Cat 3"
73
    And I navigate to "Users > Accounts >Cohorts" in site administration
74
    And I follow "All cohorts"
75
    And the following should exist in the "reportbuilder-table" table:
76
      | Category      | Name          | Cohort ID | Description       | Cohort size | Source           |
77
      | Cat 3         | cohort name 1 | cohortid1 | first description | 0           | Created manually |
78
      | Cat 3         | cohort name 2 | cohortid2 |                   | 0           | Created manually |
79
      | Category 1    | cohort name 3 | cohortid3 |                   | 0           | Created manually |
80
      | Cat 1         | cohort name 4 | cohortid4 |                   | 0           | Created manually |
81
      | Cat 2         | cohort name 5 | cohortid5 |                   | 0           | Created manually |
82
      | Cat 3         | cohort name 6 | cohortid6 |                   | 0           | Created manually |
83
 
84
  @javascript @_file_upload
85
  Scenario: Upload cohorts with default category context as manager
86
    Given the following "users" exist:
87
      | username | firstname | lastname | email                  |
88
      | user1    | User      | 1        | user1@example.com |
89
    And the following "role assigns" exist:
90
      | user  | role    | contextlevel | reference |
91
      | user1 | manager | Category     | CAT1      |
92
    When I log in as "user1"
93
    And I am on course index
94
    And I follow "Cat 1"
95
    And I navigate to "Cohorts" in current page administration
96
    And I follow "Upload cohorts"
97
    And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
98
    And I click on "Preview" "button"
99
    Then the following should exist in the "previewuploadedcohorts" table:
100
      | name          | idnumber  | description       | Context | Status |
101
      | cohort name 1 | cohortid1 | first description | Cat 1   |        |
102
      | cohort name 2 | cohortid2 |                   | Cat 1   |        |
103
      | cohort name 3 | cohortid3 |                   | Cat 1   | Category Category 1 not found or you don't have permission to create a cohort there. The default context will be used. |
104
      | cohort name 4 | cohortid4 |                   | Cat 1   |        |
105
      | cohort name 5 | cohortid5 |                   | Cat 1   | Category CAT2 not found or you don't have permission to create a cohort there. The default context will be used. |
106
      | cohort name 6 | cohortid6 |                   | Cat 3   |        |
107
    And I press "Upload cohorts"
108
    And I should see "Uploaded 6 cohorts"
109
 
110
  @javascript @_file_upload
111
  Scenario: Upload cohorts with conflicting id number
112
    Given the following "cohorts" exist:
113
      | name   | idnumber  |
114
      | Cohort | cohortid2 |
115
    When I log in as "admin"
116
    And I navigate to "Users > Accounts >Cohorts" in site administration
117
    And I follow "Upload cohorts"
118
    And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
119
    And I click on "Preview" "button"
120
    Then I should see "Errors were found in CSV data. See details below."
121
    Then the following should exist in the "previewuploadedcohorts" table:
122
      | name | idnumber | description | Context | Status |
123
      | cohort name 1 | cohortid1 | first description | System |  |
124
      | cohort name 2 | cohortid2 |  | System | Cohort with the same ID number already exists |
125
      | cohort name 3 | cohortid3 |  | Category 1 |  |
126
      | cohort name 4 | cohortid4 |  | Cat 1 |  |
127
      | cohort name 5 | cohortid5 |  | Cat 2 |  |
128
      | cohort name 6 | cohortid6 |  | Cat 3 |  |
129
    And "Upload cohorts" "button" should not exist
130
 
131
  @javascript @_file_upload
132
  Scenario: Upload cohorts with different ways of specifying context
133
    When I log in as "admin"
134
    And I navigate to "Users > Accounts >Cohorts" in site administration
135
    And I follow "Upload cohorts"
136
    And I upload "cohort/tests/fixtures/uploadcohorts2.csv" file to "File" filemanager
137
    And I click on "Preview" "button"
138
    Then the following should exist in the "previewuploadedcohorts" table:
139
      | name                         | idnumber  | description | Context       | Status |
140
      | Specify category as name     | cohortid1 |             | Category 1 |        |
141
      | Specify category as idnumber | cohortid2 |             | Cat 1         |        |
142
      | Specify category as id       | cohortid3 |             | Category 1 |        |
143
      | Specify category as path     | cohortid4 |             | Cat 3         |        |
144
      | Specify category_id          | cohortid5 |             | Category 1 |        |
145
      | Specify category_idnumber    | cohortid6 |             | Cat 1         |        |
146
      | Specify category_path        | cohortid7 |             | Cat 3         |        |
147
    And I should not see "not found or you"
148
    And I press "Upload cohorts"
149
    And I should see "Uploaded 7 cohorts"
150
    And I press "Continue"
151
    And I follow "Upload cohorts"
152
    And I upload "cohort/tests/fixtures/uploadcohorts3.csv" file to "File" filemanager
153
    And I click on "Preview" "button"
154
    And the following should exist in the "previewuploadedcohorts" table:
155
      | name                                         | idnumber   | description | Context | Status |
156
      | Specify context as id (system)               | cohortid8  |             | System  |        |
157
      | Specify context as name (system)             | cohortid9  |             | System  |        |
158
      | Specify context as category name only        | cohortid10 |             | Cat 1   |        |
159
      | Specify context as category path             | cohortid12 |             | Cat 3   |        |
160
      | Specify context as category idnumber         | cohortid13 |             | Cat 2   |        |
161
    And I should not see "not found or you"
162
    And I press "Upload cohorts"
163
    And I should see "Uploaded 5 cohorts"
164
 
165
  @javascript @_file_upload
166
  Scenario: Upload cohorts with theme
167
    When I log in as "admin"
168
    And I navigate to "Users > Accounts >Cohorts" in site administration
169
    And I follow "Upload cohorts"
170
    And I upload "cohort/tests/fixtures/uploadcohorts4.csv" file to "File" filemanager
171
    And I click on "Preview" "button"
172
    Then the following should exist in the "previewuploadedcohorts" table:
173
      | name          | idnumber  | description       | Context       | visible | theme    | Status |
174
      | cohort name 1 | cohortid1 | first description | System        | 1       | boost    |        |
175
      | cohort name 2 | cohortid2 |                   | System        | 1       |          |        |
176
      | cohort name 3 | cohortid3 |                   | Category 1    | 0       | boost    |        |
177
      | cohort name 4 | cohortid4 |                   | Cat 1         | 1       | classic  |        |
178
      | cohort name 5 | cohortid5 |                   | Cat 2         | 0       |          |        |
179
      | cohort name 6 | cohortid6 |                   | Cat 3         | 1       | classic  |        |
180
    And I press "Upload cohorts"
181
    And I should see "Uploaded 6 cohorts"
182
    And I press "Continue"
183
    And the following should exist in the "reportbuilder-table" table:
184
      | Name          | Cohort ID | Description | Cohort size | Source           |
185
      | cohort name 1 | cohortid1 | first description | 0           | Created manually |
186
      | cohort name 2 | cohortid2 |             | 0           | Created manually |
187
    And I follow "All cohorts"
188
    And the following should exist in the "reportbuilder-table" table:
189
      | Category      | Name          | Cohort ID | Description       | Cohort size | Source           |
190
      | System        | cohort name 1 | cohortid1 | first description | 0           | Created manually |
191
      | System        | cohort name 2 | cohortid2 |                   | 0           | Created manually |
192
      | Category 1    | cohort name 3 | cohortid3 |                   | 0           | Created manually |
193
      | Cat 1         | cohort name 4 | cohortid4 |                   | 0           | Created manually |
194
      | Cat 2         | cohort name 5 | cohortid5 |                   | 0           | Created manually |
195
      | Cat 3         | cohort name 6 | cohortid6 |                   | 0           | Created manually |