source: moodle/trunk/fuentes/group/tests/behat/groups_import.feature @ 1331

Last change on this file since 1331 was 1331, checked in by jrpelegrina, 3 years ago

Updated to moodle 3.0.3

File size: 4.7 KB
Line 
1@core @core_group @_file_upload
2Feature: 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    And the following "users" exist:
12      | username | firstname | lastname | email |
13      | teacher1 | Teacher | 1 | teacher1@example.com |
14    And the following "course enrolments" exist:
15      | user | course | role |
16      | teacher1 | C1 | editingteacher |
17
18  @javascript
19  Scenario: Import groups and groupings as teacher
20    Given I log in as "teacher1"
21    And I follow "Course 1"
22    And I expand "Users" node
23    And I follow "Groups"
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    And I follow "Groupings"
34    And I should see "Grouping-1"
35    And I should see "Grouping-2"
36    And I should see "Grouping-3"
37    And I should see "group-id-1" in the "Grouping-1" "table_row"
38    And I should see "group-id-2" in the "Grouping-2" "table_row"
39    And I should see "group-noid-2" in the "Grouping-2" "table_row"
40    And I should see "group-id-1-duplicate" in the "Grouping-3" "table_row"
41    And I should see "group-noid-1" in the "Grouping-3" "table_row"
42
43  @javascript
44  Scenario: Import groups with idnumber when the user has proper permissions for the idnumber field
45    Given I log in as "teacher1"
46    And I follow "Course 1"
47    And I expand "Users" node
48    And I follow "Groups"
49    And I press "Import groups"
50    When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
51    And I press "Import groups"
52    Then I should see "Group group-id-1 added successfully"
53    And I should see "Group group-id-2 added successfully"
54    And I should see "group-id-1-duplicate: Group \"group-id-1\" with an idnumber of \"group-id-1\" already exists for this course"
55    And I should see "Group group-id-1-duplicate added successfully"
56    And I should see "Group group-noid-1 added successfully"
57    And I should see "Group group-noid-2 added successfully"
58    And I press "Continue"
59    And I set the field "groups" to "group-id-1"
60    And I press "Edit group settings"
61    And the field "id_idnumber" matches value "group-id-1"
62    And I press "Cancel"
63    And I set the field "groups" to "group-id-2"
64    And I press "Edit group settings"
65    And the field "id_idnumber" matches value "group-id-2"
66    And I press "Cancel"
67    And I set the field "groups" to "group-id-1-duplicate"
68    And I press "Edit group settings"
69    And the field "id_idnumber" matches value ""
70    And I press "Cancel"
71    And I set the field "groups" to "group-noid-1"
72    And I press "Edit group settings"
73    And the field "id_idnumber" matches value ""
74    And I press "Cancel"
75    And I set the field "groups" to "group-noid-2"
76    And I press "Edit group settings"
77    And the field "id_idnumber" matches value ""
78    And I press "Cancel"
79
80  @javascript
81  Scenario: Import groups with idnumber when the user does not have proper permissions for the idnumber field
82    Given I log in as "admin"
83    And I am on site homepage
84    And I follow "Course 1"
85    And I expand "Users" node
86    And I follow "Permissions"
87    And I override the system permissions of "Teacher" role with:
88      | moodle/course:changeidnumber | Prevent |
89    And I log out
90    And I log in as "teacher1"
91    And I follow "Course 1"
92    And I expand "Users" node
93    And I follow "Groups"
94    And I press "Import groups"
95    When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
96    And I press "Import groups"
97    And I press "Continue"
98    Then I set the field "groups" to "group-id-1"
99    And I press "Edit group settings"
100    And the field "id_idnumber" matches value ""
101    And I press "Cancel"
102    And I set the field "groups" to "group-id-2"
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-1-duplicate"
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-noid-1"
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-2"
115    And I press "Edit group settings"
116    And the field "id_idnumber" matches value ""
117    And I press "Cancel"
Note: See TracBrowser for help on using the repository browser.