Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_group @_file_upload
2
Feature: Importing of groups and groupings
3
  In order to import groups and grouping
4
  As a teacher
5
  I need to upload a file and verify groups and groupings can be imported
6
 
7
  Background:
8
    Given the following "courses" exist:
9
      | fullname | shortname | category |
10
      | Course 1 | C1 | 0 |
11
      | Course 2 | C2 | 0 |
12
    And the following "users" exist:
13
      | username | firstname | lastname | email |
14
      | teacher1 | Teacher | 1 | teacher1@example.com |
15
    And the following "course enrolments" exist:
16
      | user | course | role |
17
      | teacher1 | C1 | editingteacher |
18
      | teacher1 | C2 | editingteacher |
19
 
20
  @javascript
21
  Scenario: Import groups and groupings as teacher
22
    Given I log in as "teacher1"
23
    And I am on the "Course 1" "groups" page
24
    And I press "Import groups"
25
    When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
26
    And I press "Import groups"
27
    And I press "Continue"
28
    Then I should see "group-id-1"
29
    And I should see "group-id-2"
30
    And I should see "group-id-1-duplicate"
31
    And I should see "group-noid-1"
32
    And I should see "group-noid-2"
33
    # Group messaging should have been enabled for group-id-1.
34
    And I set the field "groups" to "group-id-1"
35
    And I press "Edit group settings"
36
    And I should see "Yes" in the "Group messaging" "select"
37
    And I press "Cancel"
38
     # Group messaging should not have been enabled for group-id-2.
39
    And I set the field "groups" to "group-id-2"
40
    And I press "Edit group settings"
41
    And I should see "No" in the "Group messaging" "select"
42
    And I press "Cancel"
43
    # Check groupings
44
    And I set the field "Participants tertiary navigation" to "Groupings"
45
    And I should see "Grouping-1"
46
    And I should see "Grouping-2"
47
    And I should see "Grouping-3"
48
    And I should see "group-id-1" in the "Grouping-1" "table_row"
49
    And I should see "group-id-2" in the "Grouping-2" "table_row"
50
    And I should see "group-noid-2" in the "Grouping-2" "table_row"
51
    And I should see "group-id-1-duplicate" in the "Grouping-3" "table_row"
52
    And I should see "group-noid-1" in the "Grouping-3" "table_row"
53
 
54
  @javascript
55
  Scenario: Import groups with idnumber when the user has proper permissions for the idnumber field
56
    Given I log in as "teacher1"
57
    And I am on the "Course 1" "groups" page
58
    And I press "Import groups"
59
    When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
60
    And I press "Import groups"
61
    Then I should see "Group group-id-1 added successfully"
62
    And I should see "Group group-id-2 added successfully"
63
    And I should see "group-id-1-duplicate: Group \"group-id-1\" with an idnumber of \"group-id-1\" already exists for this course"
64
    And I should see "Group group-id-1-duplicate added successfully"
65
    And I should see "Group group-noid-1 added successfully"
66
    And I should see "Group group-noid-2 added successfully"
67
    And I press "Continue"
68
    And I set the field "groups" to "group-id-1"
69
    And I press "Edit group settings"
70
    And the field "id_idnumber" matches value "group-id-1"
71
    And I press "Cancel"
72
    And I set the field "groups" to "group-id-2"
73
    And I press "Edit group settings"
74
    And the field "id_idnumber" matches value "group-id-2"
75
    And I press "Cancel"
76
    And I set the field "groups" to "group-id-1-duplicate"
77
    And I press "Edit group settings"
78
    And the field "id_idnumber" matches value ""
79
    And I press "Cancel"
80
    And I set the field "groups" to "group-noid-1"
81
    And I press "Edit group settings"
82
    And the field "id_idnumber" matches value ""
83
    And I press "Cancel"
84
    And I set the field "groups" to "group-noid-2"
85
    And I press "Edit group settings"
86
    And the field "id_idnumber" matches value ""
87
    And I press "Cancel"
88
 
89
  @javascript
90
  Scenario: Import groups with idnumber when the user does not have proper permissions for the idnumber field
91
    Given I log in as "admin"
92
    And I am on the "Course 1" "permissions" page
93
    And I override the system permissions of "Teacher" role with:
94
      | moodle/course:changeidnumber | Prevent |
95
    And I log out
96
    And I log in as "teacher1"
97
    And I am on the "Course 1" "groups" page
98
    And I press "Import groups"
99
    When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
100
    And I press "Import groups"
101
    And I press "Continue"
102
    Then I set the field "groups" to "group-id-1"
103
    And I press "Edit group settings"
104
    And the field "id_idnumber" matches value ""
105
    And I press "Cancel"
106
    And I set the field "groups" to "group-id-2"
107
    And I press "Edit group settings"
108
    And the field "id_idnumber" matches value ""
109
    And I press "Cancel"
110
    And I set the field "groups" to "group-id-1-duplicate"
111
    And I press "Edit group settings"
112
    And the field "id_idnumber" matches value ""
113
    And I press "Cancel"
114
    And I set the field "groups" to "group-noid-1"
115
    And I press "Edit group settings"
116
    And the field "id_idnumber" matches value ""
117
    And I press "Cancel"
118
    And I set the field "groups" to "group-noid-2"
119
    And I press "Edit group settings"
120
    And the field "id_idnumber" matches value ""
121
    And I press "Cancel"
122
 
123
  @javascript
124
  Scenario: Import groups into multiple courses as a teacher
125
    Given I log in as "teacher1"
126
    And I am on the "Course 1" "groups" page
127
    And I press "Import groups"
128
    When I upload "group/tests/fixtures/groups_import_multicourse.csv" file to "Import" filemanager
129
    And I press "Import groups"
130
    Then I should see "Group group7 added successfully"
131
    And I should see "Unknown course named \"C-non-existing\""
132
    And I should see "Group group8 added successfully"
133
    And I should not see "group-will-not-be-created"
134
    And I should see "Group group9 added successfully"
135
    And I should see "Group group10 added successfully"
136
    And I press "Continue"
137
    And I should see "group10"
138
    And I should see "group7"
139
    And I should see "group8"
140
    And I should not see "group9"
141
    And I should not see "group-will-not-be-created"
142
    And I am on the "Course 2" "groups" page
143
    And I should see "group9"
144
    And I should not see "group-will-not-be-created"
145
    And I should not see "group7"
146
    And I should not see "group8"
147
    And I should not see "group10"
148
    And I log out
149
 
150
  @javascript
151
  Scenario: Import groups with custom field
152
    Given the following "custom field categories" exist:
153
      | name                   | component  | area     | itemid |
154
      | Category for group1    | core_group | group    | 0      |
155
      | Category for grouping1 | core_group | grouping | 0      |
156
    And the following "custom fields" exist:
157
      | name        | category               | type | shortname      |
158
      | Test Field1 | Category for group1    | text | groupfield1    |
159
      | Test Field2 | Category for grouping1 | text | groupingfield1 |
160
    And I log in as "teacher1"
161
    And I am on the "Course 1" "groups" page
162
    And I press "Import groups"
163
    When I upload "group/tests/fixtures/groups_import_with_customfield.csv" file to "Import" filemanager
164
    And I press "Import groups"
165
    Then I should see "Group Group1 added successfully"
166
    And I should see "Group Group2 added successfully"
167
    And I should see "Grouping Grouping1 added successfully"
168
    And I press "Continue"
169
    And I set the field "groups" to "Group1 (0)"
170
    And I press "Edit group settings"
171
    And the field "Test Field1" matches value "Group1-Custom"
172
    And I press "Cancel"
173
    And I set the field "groups" to "Group2 (0)"
174
    And I press "Edit group settings"
175
    And the field "Test Field1" matches value "Group2-Custom"
176
    And I press "Cancel"
177
    And I am on the "Course 1" "groupings" page
178
    Then I should see "Grouping1"
179
    And I click on "Edit" "link" in the "Grouping1" "table_row"
180
    And the field "Test Field2" matches value "Grouping1-Custom"