MDL-59726 behat: Fix Behat tests affected by the new participants filter
[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 13 | username | firstname | lastname | email |
0fe86bbd
RT
14 | teacher1 | Teacher | 1 | teacher1@example.com |
15 | student0 | Student | 0 | student0@example.com |
16 | student1 | Student | 1 | student1@example.com |
17 | student2 | Student | 2 | student2@example.com |
18 | student3 | Student | 3 | student3@example.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"
fdeeaff9 27 And I am on "Course 1" course homepage
9bad658a 28 And I navigate to "Users > Groups" in current page administration
e613fd90 29 And I press "Create group"
f083d614 30 And I set the following fields to these values:
e613fd90
DM
31 | Group name | Group 1 |
32 And I press "Save changes"
33 And I press "Create group"
f083d614 34 And I set the following fields to these values:
e613fd90
DM
35 | Group name | Group 2 |
36 And I press "Save changes"
0fe86bbd
RT
37 When I add "Student 0 (student0@example.com)" user to "Group 1" group members
38 And I add "Student 1 (student1@example.com)" user to "Group 1" group members
39 And I add "Student 2 (student2@example.com)" user to "Group 2" group members
40 And I add "Student 3 (student3@example.com)" user to "Group 2" group members
f083d614 41 Then I set the field "groups" to "Group 1 (2)"
e613fd90
DM
42 And the "members" select box should contain "Student 0"
43 And the "members" select box should contain "Student 1"
44 And the "members" select box should not contain "Student 2"
f083d614 45 And I set the field "groups" to "Group 2 (2)"
e613fd90
DM
46 And the "members" select box should contain "Student 2"
47 And the "members" select box should contain "Student 3"
48 And the "members" select box should not contain "Student 0"
e5287f9b 49 And I navigate to course participants
f156e3dd
JP
50 And I open the autocomplete suggestions list
51 And I click on "Group: Group 1" item in the autocomplete list
52 And I press "Filter"
e613fd90
DM
53 And I should see "Student 0"
54 And I should see "Student 1"
55 And I should not see "Student 2"
f156e3dd
JP
56 And I click on "Group: Group 1" "text" in the ".form-autocomplete-selection" "css_element"
57 And I open the autocomplete suggestions list
58 And I click on "Group: Group 2" item in the autocomplete list
59 And I press "Filter"
e613fd90
DM
60 And I should see "Student 2"
61 And I should see "Student 3"
62 And I should not see "Student 0"
a2d3e3b6 63
a2d3e3b6 64 Scenario: Create groups and groupings without the 'moodle/course:changeidnumber' capability
759b323e 65 Given the following "courses" exist:
a2d3e3b6
MN
66 | fullname | shortname | category | groupmode |
67 | Course 1 | C1 | 0 | 1 |
759b323e 68 And the following "users" exist:
a2d3e3b6 69 | username | firstname | lastname | email |
0fe86bbd 70 | teacher1 | Teacher | 1 | teacher1@example.com |
759b323e 71 And the following "course enrolments" exist:
a2d3e3b6
MN
72 | user | course | role |
73 | teacher1 | C1 | editingteacher |
74 And I log in as "admin"
75 And I set the following system permissions of "Teacher" role:
76 | moodle/course:changeidnumber | Prevent |
77 And I log out
78 And I log in as "teacher1"
fdeeaff9 79 And I am on "Course 1" course homepage
9bad658a 80 And I navigate to "Users > Groups" in current page administration
a2d3e3b6
MN
81 When I press "Create group"
82 Then the "idnumber" "field" should be readonly
f083d614 83 And I set the following fields to these values:
a2d3e3b6
MN
84 | Group name | The greatest group that never existed |
85 And I press "Save changes"
86 And I should see "The greatest group that never existed"
87 And I follow "Groupings"
88 And I press "Create grouping"
89 And the "idnumber" "field" should be readonly
f083d614 90 And I set the following fields to these values:
a2d3e3b6
MN
91 | Grouping name | Not the greatest grouping, but it's ok! |
92 And I press "Save changes"
93 And I should see "Not the greatest grouping, but it's ok!"
6685e048
FM
94
95 Scenario: Create groups with enrolment key
96 Given the following "courses" exist:
97 | fullname | shortname | category | groupmode |
98 | Course 1 | C1 | 0 | 1 |
99 | Course 2 | C2 | 0 | 1 |
100 And I log in as "admin"
fdeeaff9 101 And I am on "Course 1" course homepage
9bad658a 102 And I navigate to "Users > Groups" in current page administration
6685e048 103 When I press "Create group"
9d4762c9
FM
104 And I set the following fields to these values:
105 | Group name | Group A |
106 | Enrolment key | badpasswd |
107 And I press "Save changes"
108 And I should see "Passwords must have at least 1 digit(s)"
6685e048
FM
109 And I set the following fields to these values:
110 | Group name | Group A |
111 | Enrolment key | Abcdef-1 |
112 And I press "Save changes"
113 And I press "Create group"
114 And I set the following fields to these values:
115 | Group name | Group B |
116 | Enrolment key | Abcdef-1 |
117 And I press "Save changes"
118 Then I should see "This enrolment key is already used for another group."
119 And I set the following fields to these values:
120 | Enrolment key | Abcdef-2 |
121 And I press "Save changes"
122 And the "groups" select box should contain "Group B (0)"
fdeeaff9 123 And I am on "Course 2" course homepage
9bad658a 124 And I navigate to "Users > Groups" in current page administration
6685e048
FM
125 And I press "Create group"
126 And I set the following fields to these values:
127 | Group name | Group A |
128 | Enrolment key | Abcdef-1 |
129 And I should not see "This enrolment key is already used for another group."