MDL-45579 group: Prevent duplicate enrolment keys in course groups
[moodle.git] / group / tests / behat / create_groups.feature
CommitLineData
550d842e 1@core @core_group
e613fd90
DM
2Feature: Organize students into groups
3 In order to organize course activities in groups
5d7b6307 4 As a teacher
e613fd90
DM
5 I need to group students
6
7 @javascript
8 Scenario: Assign students to groups
759b323e 9 Given the following "courses" exist:
e613fd90
DM
10 | fullname | shortname | category | groupmode |
11 | Course 1 | C1 | 0 | 1 |
759b323e 12 And the following "users" exist:
e613fd90
DM
13 | username | firstname | lastname | email |
14 | teacher1 | Teacher | 1 | teacher1@asd.com |
15 | student0 | Student | 0 | student0@asd.com |
16 | student1 | Student | 1 | student1@asd.com |
17 | student2 | Student | 2 | student2@asd.com |
18 | student3 | Student | 3 | student3@asd.com |
759b323e 19 And the following "course enrolments" exist:
e613fd90
DM
20 | user | course | role |
21 | teacher1 | C1 | editingteacher |
22 | student0 | C1 | student |
23 | student1 | C1 | student |
24 | student2 | C1 | student |
25 | student3 | C1 | student |
26 And I log in as "teacher1"
27 And I follow "Course 1"
28 And I expand "Users" node
29 And I follow "Groups"
30 And I press "Create group"
f083d614 31 And I set the following fields to these values:
e613fd90
DM
32 | Group name | Group 1 |
33 And I press "Save changes"
34 And I press "Create group"
f083d614 35 And I set the following fields to these values:
e613fd90
DM
36 | Group name | Group 2 |
37 And I press "Save changes"
50edfdca
DM
38 When I add "Student 0 (student0@asd.com)" user to "Group 1" group members
39 And I add "Student 1 (student1@asd.com)" user to "Group 1" group members
40 And I add "Student 2 (student2@asd.com)" user to "Group 2" group members
41 And I add "Student 3 (student3@asd.com)" user to "Group 2" group members
f083d614 42 Then I set the field "groups" to "Group 1 (2)"
e613fd90
DM
43 And the "members" select box should contain "Student 0"
44 And the "members" select box should contain "Student 1"
45 And the "members" select box should not contain "Student 2"
f083d614 46 And I set the field "groups" to "Group 2 (2)"
e613fd90
DM
47 And the "members" select box should contain "Student 2"
48 And the "members" select box should contain "Student 3"
49 And the "members" select box should not contain "Student 0"
50 And I follow "Participants"
f083d614 51 And I set the field "Separate groups" to "Group 1"
e613fd90
DM
52 And I should see "Student 0"
53 And I should see "Student 1"
54 And I should not see "Student 2"
f083d614 55 And I set the field "Separate groups" to "Group 2"
e613fd90
DM
56 And I should see "Student 2"
57 And I should see "Student 3"
58 And I should not see "Student 0"
a2d3e3b6
MN
59
60 @javascript
61 Scenario: Create groups and groupings without the 'moodle/course:changeidnumber' capability
759b323e 62 Given the following "courses" exist:
a2d3e3b6
MN
63 | fullname | shortname | category | groupmode |
64 | Course 1 | C1 | 0 | 1 |
759b323e 65 And the following "users" exist:
a2d3e3b6
MN
66 | username | firstname | lastname | email |
67 | teacher1 | Teacher | 1 | teacher1@asd.com |
759b323e 68 And the following "course enrolments" exist:
a2d3e3b6
MN
69 | user | course | role |
70 | teacher1 | C1 | editingteacher |
71 And I log in as "admin"
72 And I set the following system permissions of "Teacher" role:
73 | moodle/course:changeidnumber | Prevent |
74 And I log out
75 And I log in as "teacher1"
76 And I follow "Course 1"
77 And I expand "Users" node
78 And I follow "Groups"
79 When I press "Create group"
80 Then the "idnumber" "field" should be readonly
f083d614 81 And I set the following fields to these values:
a2d3e3b6
MN
82 | Group name | The greatest group that never existed |
83 And I press "Save changes"
84 And I should see "The greatest group that never existed"
85 And I follow "Groupings"
86 And I press "Create grouping"
87 And the "idnumber" "field" should be readonly
f083d614 88 And I set the following fields to these values:
a2d3e3b6
MN
89 | Grouping name | Not the greatest grouping, but it's ok! |
90 And I press "Save changes"
91 And I should see "Not the greatest grouping, but it's ok!"