1 |
efrain |
1 |
@core @core_group
|
|
|
2 |
Feature: Organize students into groups
|
|
|
3 |
In order to organize course activities in groups
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to group students
|
|
|
6 |
|
|
|
7 |
@javascript
|
|
|
8 |
Scenario: Assign students to groups
|
|
|
9 |
Given the following "courses" exist:
|
|
|
10 |
| fullname | shortname | category | groupmode |
|
|
|
11 |
| Course 1 | C1 | 0 | 1 |
|
|
|
12 |
And the following "users" exist:
|
|
|
13 |
| username | firstname | lastname | email |
|
|
|
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 |
|
|
|
19 |
And the following "course enrolments" exist:
|
|
|
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 am on the "Course 1" "groups" page
|
|
|
28 |
And I press "Create group"
|
|
|
29 |
And I set the following fields to these values:
|
|
|
30 |
| Group name | Group 1 |
|
|
|
31 |
And I press "Save changes"
|
|
|
32 |
And I press "Create group"
|
|
|
33 |
And I set the following fields to these values:
|
|
|
34 |
| Group name | Group 2 |
|
|
|
35 |
And I press "Save changes"
|
|
|
36 |
When I add "Student 0 (student0@example.com)" user to "Group 1" group members
|
|
|
37 |
And I add "Student 1 (student1@example.com)" user to "Group 1" group members
|
|
|
38 |
And I add "Student 2 (student2@example.com)" user to "Group 2" group members
|
|
|
39 |
And I add "Student 3 (student3@example.com)" user to "Group 2" group members
|
|
|
40 |
Then I set the field "groups" to "Group 1 (2)"
|
|
|
41 |
And the "members" select box should contain "Student 0 (student0@example.com)"
|
|
|
42 |
And the "members" select box should contain "Student 1 (student1@example.com)"
|
|
|
43 |
And the "members" select box should not contain "Student 2 (student2@example.com)"
|
|
|
44 |
And the "members" select box should not contain "Student 3 (student3@example.com)"
|
|
|
45 |
And I set the field "groups" to "Group 2 (2)"
|
|
|
46 |
And the "members" select box should contain "Student 2 (student2@example.com)"
|
|
|
47 |
And the "members" select box should contain "Student 3 (student3@example.com)"
|
|
|
48 |
And the "members" select box should not contain "Student 0 (student0@example.com)"
|
|
|
49 |
And the "members" select box should not contain "Student 1 (student1@example.com)"
|
|
|
50 |
And I navigate to course participants
|
|
|
51 |
And I set the field "type" in the "Filter 1" "fieldset" to "Groups"
|
|
|
52 |
And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Group 1"
|
|
|
53 |
And I click on "Apply filters" "button"
|
|
|
54 |
And I should see "Student 0"
|
|
|
55 |
And I should see "Student 1"
|
|
|
56 |
And I should not see "Student 2"
|
|
|
57 |
And I set the field "Type or select..." in the "Filter 1" "fieldset" to "Group 2"
|
|
|
58 |
And I click on "Apply filters" "button"
|
|
|
59 |
And I should see "Student 2"
|
|
|
60 |
And I should see "Student 3"
|
|
|
61 |
And I should not see "Student 0"
|
|
|
62 |
|
|
|
63 |
@javascript
|
|
|
64 |
Scenario: Assign students to groups with site user identity configured
|
|
|
65 |
Given the following "courses" exist:
|
|
|
66 |
| fullname | shortname | groupmode |
|
|
|
67 |
| Course 1 | C1 | 1 |
|
|
|
68 |
And the following "users" exist:
|
|
|
69 |
| username | firstname | lastname | email | country |
|
|
|
70 |
| teacher | Teacher | 1 | teacher@example.com | GB |
|
|
|
71 |
| student | Student | 1 | student@example.com | DE |
|
|
|
72 |
And the following "course enrolments" exist:
|
|
|
73 |
| user | course | role |
|
|
|
74 |
| teacher | C1 | editingteacher |
|
|
|
75 |
| student | C1 | student |
|
|
|
76 |
And the following config values are set as admin:
|
|
|
77 |
| showuseridentity | email,country |
|
|
|
78 |
And I log in as "teacher"
|
|
|
79 |
And I am on the "Course 1" "groups" page
|
|
|
80 |
And I press "Create group"
|
|
|
81 |
And I set the following fields to these values:
|
|
|
82 |
| Group name | Group 1 |
|
|
|
83 |
And I press "Save changes"
|
|
|
84 |
When I add "Student 1 (student@example.com, DE)" user to "Group 1" group members
|
|
|
85 |
And I set the field "groups" to "Group 1 (1)"
|
|
|
86 |
Then the "members" select box should contain "Student 1 (student@example.com\, DE)"
|
|
|
87 |
# Non-AJAX version of the groups page.
|
|
|
88 |
And I press "Add/remove users"
|
|
|
89 |
And I press "Back to groups"
|
|
|
90 |
And the "members" select box should contain "Student 1 (student@example.com\, DE)"
|
|
|
91 |
|
|
|
92 |
Scenario: Create groups and groupings without the 'moodle/course:changeidnumber' capability
|
|
|
93 |
Given the following "courses" exist:
|
|
|
94 |
| fullname | shortname | category | groupmode |
|
|
|
95 |
| Course 1 | C1 | 0 | 1 |
|
|
|
96 |
And the following "users" exist:
|
|
|
97 |
| username | firstname | lastname | email |
|
|
|
98 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
99 |
And the following "course enrolments" exist:
|
|
|
100 |
| user | course | role |
|
|
|
101 |
| teacher1 | C1 | editingteacher |
|
|
|
102 |
And the following "role capability" exists:
|
|
|
103 |
| role | editingteacher |
|
|
|
104 |
| moodle/course:changeidnumber | prevent |
|
|
|
105 |
And I log in as "teacher1"
|
|
|
106 |
And I am on the "Course 1" "groups" page
|
|
|
107 |
When I press "Create group"
|
|
|
108 |
Then the "idnumber" "field" should be readonly
|
|
|
109 |
And I set the following fields to these values:
|
|
|
110 |
| Group name | The greatest group that never existed |
|
|
|
111 |
And I press "Save changes"
|
|
|
112 |
And I should see "The greatest group that never existed"
|
|
|
113 |
And I am on the "Course 1" "groupings" page
|
|
|
114 |
And I press "Create grouping"
|
|
|
115 |
And the "idnumber" "field" should be readonly
|
|
|
116 |
And I set the following fields to these values:
|
|
|
117 |
| Grouping name | Not the greatest grouping, but it's ok! |
|
|
|
118 |
And I press "Save changes"
|
|
|
119 |
And I should see "Not the greatest grouping, but it's ok!"
|
|
|
120 |
|
|
|
121 |
Scenario: Create groups with enrolment key
|
|
|
122 |
Given the following "courses" exist:
|
|
|
123 |
| fullname | shortname | category | groupmode |
|
|
|
124 |
| Course 1 | C1 | 0 | 1 |
|
|
|
125 |
| Course 2 | C2 | 0 | 1 |
|
|
|
126 |
And I log in as "admin"
|
|
|
127 |
And I am on the "Course 1" "groups" page
|
|
|
128 |
When I press "Create group"
|
|
|
129 |
And I set the following fields to these values:
|
|
|
130 |
| Group name | Group A |
|
|
|
131 |
| Enrolment key | badpasswd |
|
|
|
132 |
And I press "Save changes"
|
|
|
133 |
And I should see "Passwords must have at least 1 digit(s)"
|
|
|
134 |
And I set the following fields to these values:
|
|
|
135 |
| Group name | Group A |
|
|
|
136 |
| Enrolment key | Abcdef-1 |
|
|
|
137 |
And I press "Save changes"
|
|
|
138 |
And I press "Create group"
|
|
|
139 |
And I set the following fields to these values:
|
|
|
140 |
| Group name | Group B |
|
|
|
141 |
| Enrolment key | Abcdef-1 |
|
|
|
142 |
And I press "Save changes"
|
|
|
143 |
Then I should see "This enrolment key is already used for another group."
|
|
|
144 |
And I set the following fields to these values:
|
|
|
145 |
| Enrolment key | Abcdef-2 |
|
|
|
146 |
And I press "Save changes"
|
|
|
147 |
And the "groups" select box should contain "Group B (0)"
|
|
|
148 |
And I am on the "Course 2" "groups" page
|
|
|
149 |
And I press "Create group"
|
|
|
150 |
And I set the following fields to these values:
|
|
|
151 |
| Group name | Group A |
|
|
|
152 |
| Enrolment key | Abcdef-1 |
|
|
|
153 |
And I should not see "This enrolment key is already used for another group."
|