1 |
efrain |
1 |
@core @core_group
|
|
|
2 |
Feature: Automatic creation of groups
|
|
|
3 |
In order to quickly create groups
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to create groups automatically and allocate them in groupings if necessary
|
|
|
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 |
| student1 | Student | 1 | student1@example.com |
|
|
|
15 |
| student2 | Student | 2 | student2@example.com |
|
|
|
16 |
| student3 | Student | 3 | student3@example.com |
|
|
|
17 |
| student4 | Student | 4 | student4@example.com |
|
|
|
18 |
| student5 | Student | 5 | student5@example.com |
|
|
|
19 |
| student6 | Student | 6 | student6@example.com |
|
|
|
20 |
| student7 | Student | 7 | student7@example.com |
|
|
|
21 |
| student8 | Student | 8 | student8@example.com |
|
|
|
22 |
| student9 | Student | 9 | student9@example.com |
|
|
|
23 |
| student10 | Student | 10 | student10@example.com |
|
|
|
24 |
| suspendedstudent11 | Suspended student | 11 | suspendedstudent11@example.com |
|
|
|
25 |
And the following "course enrolments" exist:
|
|
|
26 |
| user | course | role | status |
|
|
|
27 |
| teacher1 | C1 | editingteacher | 0 |
|
|
|
28 |
| student1 | C1 | student | 0 |
|
|
|
29 |
| student2 | C1 | student | 0 |
|
|
|
30 |
| student3 | C1 | student | 0 |
|
|
|
31 |
| student4 | C1 | student | 0 |
|
|
|
32 |
| student5 | C1 | student | 0 |
|
|
|
33 |
| student6 | C1 | student | 0 |
|
|
|
34 |
| student7 | C1 | student | 0 |
|
|
|
35 |
| student8 | C1 | student | 0 |
|
|
|
36 |
| student9 | C1 | student | 0 |
|
|
|
37 |
| student10 | C1 | student | 0 |
|
|
|
38 |
| suspendedstudent11 | C1 | student | 1 |
|
|
|
39 |
And I log in as "teacher1"
|
|
|
40 |
And I am on the "Course 1" "groups" page
|
|
|
41 |
When I press "Auto-create groups"
|
|
|
42 |
And I expand all fieldsets
|
|
|
43 |
|
|
|
44 |
@javascript
|
|
|
45 |
Scenario: Split automatically the course users in groups and add the groups to a new grouping
|
|
|
46 |
Given I set the following fields to these values:
|
|
|
47 |
| Auto create based on | Number of groups |
|
|
|
48 |
| Group/member count | 2 |
|
|
|
49 |
| Grouping of auto-created groups | New grouping |
|
|
|
50 |
| Grouping name | Grouping name |
|
|
|
51 |
And I press "Preview"
|
|
|
52 |
Then I should see "Group members"
|
|
|
53 |
And I should see "User count"
|
|
|
54 |
And I should see "Group A"
|
|
|
55 |
And I should see "Group B"
|
|
|
56 |
And I press "Submit"
|
|
|
57 |
And the "groups" select box should contain "Group A (5)"
|
|
|
58 |
And the "groups" select box should contain "Group B (5)"
|
|
|
59 |
# Check that group messaging is not enabled for the auto-created groups.
|
|
|
60 |
And I set the field "groups" to "Group A"
|
|
|
61 |
And I press "Edit group settings"
|
|
|
62 |
And I should see "No" in the "Group messaging" "select"
|
|
|
63 |
And I press "Cancel"
|
|
|
64 |
And I set the field "groups" to "Group B"
|
|
|
65 |
And I press "Edit group settings"
|
|
|
66 |
And I should see "No" in the "Group messaging" "select"
|
|
|
67 |
And I press "Cancel"
|
|
|
68 |
# Check groupings.
|
|
|
69 |
And I set the field "Participants tertiary navigation" to "Groupings"
|
|
|
70 |
And I should see "Grouping name"
|
|
|
71 |
And I click on "Show groups in grouping" "link" in the "Grouping name" "table_row"
|
|
|
72 |
And the "removeselect" select box should contain "Group A"
|
|
|
73 |
And the "removeselect" select box should contain "Group B"
|
|
|
74 |
|
|
|
75 |
@javascript
|
|
|
76 |
Scenario: Split automatically the course users in groups based on group member count
|
|
|
77 |
Given I set the following fields to these values:
|
|
|
78 |
| Auto create based on | Members per group |
|
|
|
79 |
| Group/member count | 4 |
|
|
|
80 |
| Grouping of auto-created groups | New grouping |
|
|
|
81 |
| Grouping name | Grouping name |
|
|
|
82 |
| Allocate members | Alphabetically by last name, first name |
|
|
|
83 |
And I press "Preview"
|
|
|
84 |
Then the following should exist in the "generaltable" table:
|
|
|
85 |
| Groups (3) | Group members | User count (10) |
|
|
|
86 |
| Group A | Student 1 (student1@example.com) | 4 |
|
|
|
87 |
| Group B | Student 5 (student5@example.com) | 4 |
|
|
|
88 |
| Group C | Student 9 (student9@example.com) | 2 |
|
|
|
89 |
And I set the field "Prevent last small group" to "1"
|
|
|
90 |
And I press "Preview"
|
|
|
91 |
And I should see "Group A" in the ".generaltable" "css_element"
|
|
|
92 |
And I should see "Group B" in the ".generaltable" "css_element"
|
|
|
93 |
And I should see "5" in the "Group A" "table_row"
|
|
|
94 |
And I should see "5" in the "Group B" "table_row"
|
|
|
95 |
|
|
|
96 |
@javascript
|
|
|
97 |
Scenario: Split automatically the course users in groups that are not in groups
|
|
|
98 |
Given I press "Cancel"
|
|
|
99 |
And I press "Create group"
|
|
|
100 |
And I set the following fields to these values:
|
|
|
101 |
| Group name | Group 1 |
|
|
|
102 |
And I press "Save changes"
|
|
|
103 |
And I press "Create group"
|
|
|
104 |
And I set the following fields to these values:
|
|
|
105 |
| Group name | Group 2 |
|
|
|
106 |
And I press "Save changes"
|
|
|
107 |
When I add "Student 1" user to "Group 1" group members
|
|
|
108 |
And I add "Student 2" user to "Group 1" group members
|
|
|
109 |
And I add "Student 3" user to "Group 2" group members
|
|
|
110 |
And I add "Student 4" user to "Group 2" group members
|
|
|
111 |
And I press "Auto-create groups"
|
|
|
112 |
And I expand all fieldsets
|
|
|
113 |
And I set the field "Auto create based on" to "Number of groups"
|
|
|
114 |
And I set the field "Group/member count" to "2"
|
|
|
115 |
And I set the field "Grouping of auto-created groups" to "No grouping"
|
|
|
116 |
And I set the field "Ignore users in groups" to "1"
|
|
|
117 |
And I press "Submit"
|
|
|
118 |
And the "groups" select box should contain "Group A (3)"
|
|
|
119 |
And the "groups" select box should contain "Group B (3)"
|
|
|
120 |
|
|
|
121 |
@javascript
|
|
|
122 |
Scenario: Split users into groups based on existing groups or groupings
|
|
|
123 |
Given I set the following fields to these values:
|
|
|
124 |
| Naming scheme | Group @ |
|
|
|
125 |
| Auto create based on | Number of groups |
|
|
|
126 |
| Group/member count | 2 |
|
|
|
127 |
| Grouping of auto-created groups | No grouping |
|
|
|
128 |
And I press "Submit"
|
|
|
129 |
And I press "Auto-create groups"
|
|
|
130 |
And I set the following fields to these values:
|
|
|
131 |
| Naming scheme | Test @ |
|
|
|
132 |
| Auto create based on | Number of groups |
|
|
|
133 |
| Group/member count | 2 |
|
|
|
134 |
| groupid | Group A |
|
|
|
135 |
| Grouping of auto-created groups | New grouping |
|
|
|
136 |
| Grouping name | Sub Grouping |
|
|
|
137 |
And I press "Submit"
|
|
|
138 |
And the "groups" select box should contain "Test A (3)"
|
|
|
139 |
And the "groups" select box should contain "Test B (2)"
|
|
|
140 |
And I press "Auto-create groups"
|
|
|
141 |
And I set the following fields to these values:
|
|
|
142 |
| Naming scheme | Test # |
|
|
|
143 |
| Auto create based on | Number of groups |
|
|
|
144 |
| Group/member count | 2 |
|
|
|
145 |
| Select members from grouping | Sub Grouping |
|
|
|
146 |
| Grouping of auto-created groups | No grouping |
|
|
|
147 |
And I press "Submit"
|
|
|
148 |
And the "groups" select box should contain "Test 1 (3)"
|
|
|
149 |
And the "groups" select box should contain "Test 2 (2)"
|
|
|
150 |
|
|
|
151 |
Scenario: Exclude suspended users when auto-creating groups
|
|
|
152 |
Given I set the field "Include only active enrolments" to "1"
|
|
|
153 |
And I set the field "Auto create based on" to "Members per group"
|
|
|
154 |
When I set the field "Group/member count" to "11"
|
|
|
155 |
And I press "Preview"
|
|
|
156 |
Then I should not see "Suspended Student 11"
|
|
|
157 |
|
|
|
158 |
Scenario: Include suspended users when auto-creating groups
|
|
|
159 |
Given I set the field "Include only active enrolments" to "0"
|
|
|
160 |
And I set the field "Auto create based on" to "Members per group"
|
|
|
161 |
When I set the field "Group/member count" to "11"
|
|
|
162 |
And I press "Preview"
|
|
|
163 |
Then I should see "Suspended student 11 (suspendedstudent11@example.com)"
|
|
|
164 |
|
|
|
165 |
Scenario: Do not display 'Include only active enrolments' if user does not have the 'moodle/course:viewsuspendedusers' capability
|
|
|
166 |
Given I log out
|
|
|
167 |
And the following "role capability" exists:
|
|
|
168 |
| role | editingteacher |
|
|
|
169 |
| moodle/course:viewsuspendedusers | prevent |
|
|
|
170 |
And I log in as "teacher1"
|
|
|
171 |
And I am on the "Course 1" "groups" page
|
|
|
172 |
When I press "Auto-create groups"
|
|
|
173 |
Then I should not see "Include only active enrolments"
|
|
|
174 |
And I set the field "Group/member count" to "11"
|
|
|
175 |
And I press "Preview"
|
|
|
176 |
And I should not see "Suspended Student 11"
|
|
|
177 |
|
|
|
178 |
@javascript
|
|
|
179 |
Scenario: Auto-create groups with group messaging
|
|
|
180 |
Given I set the following fields to these values:
|
|
|
181 |
| Naming scheme | Group @ |
|
|
|
182 |
| Auto create based on | Number of groups |
|
|
|
183 |
| Group/member count | 2 |
|
|
|
184 |
| Grouping of auto-created groups | No grouping |
|
|
|
185 |
| Group messaging | Yes |
|
|
|
186 |
And I press "Submit"
|
|
|
187 |
And I set the field "groups" to "Group A"
|
|
|
188 |
When I press "Edit group settings"
|
|
|
189 |
Then I should see "Yes" in the "Group messaging" "select"
|
|
|
190 |
And I press "Cancel"
|
|
|
191 |
And I set the field "groups" to "Group B"
|
|
|
192 |
And I press "Edit group settings"
|
|
|
193 |
And I should see "Yes" in the "Group messaging" "select"
|