forked from moodle-an-hochschulen/moodle-local_bulkenrol
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlocal_bulkenrol_groups.feature
165 lines (160 loc) · 8.25 KB
/
local_bulkenrol_groups.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@local @local_bulkenrol @local_bulkenrol_groups @javascript
Feature: Using the local_bulkenrol plugin for group management
In order to manage groups in the course
As user with the appropriate rights
I need to be able to use the plugin local_bulkenrol
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | [email protected] |
| student1 | Student | 1 | [email protected] |
| student2 | Student | 2 | [email protected] |
| student3 | Student | 3 | [email protected] |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following config values are set as admin:
| config | value | plugin |
| enrolplugin | manual | local_bulkenrol |
| navigation | navpart | local_bulkenrol |
Given I log in as "admin"
And I navigate to "Plugins > Enrolments > User bulk enrolment" in site administration
And I set the following fields to these values:
| Role | Student |
And I press "Save changes"
And I set the following system permissions of "Teacher" role:
| capability | permission |
| local/bulkenrol:enrolusers | Allow |
And I log out
Scenario: Bulk enrol students into the course and into (existing) groups
Given the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | CG1 |
| Group 2 | C1 | CG2 |
| Group 3 | C1 | CG3 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > User bulk enrolment" in current page administration
And I set the field "List of users identified by your chosen field" to multiline:
"""
# Group 1
# Group 2
# Group 3
"""
And I click on "Enrol users" "button"
Then the following should exist in the "localbulkenrol_groupinfos" table:
| Group name | Group status |
| Group 1 | Group already exists |
| Group 2 | Group already exists |
| Group 3 | Group already exists |
And the following should exist in the "localbulkenrol_enrolusers" table:
| Email address | First name | Last name | User enrolment | Group membership | Group membership |
| [email protected] | Student | 1 | User will be enrolled | Group 1 | User will be added to group |
| [email protected] | Student | 2 | User will be enrolled | Group 2 | User will be added to group |
| [email protected] | Student | 3 | User will be enrolled | Group 3 | User will be added to group |
And I click on "Enrol users" "button"
Then the following should exist in the "participants" table:
| Email address | First name | Last name | Roles | Groups |
| [email protected] | Student | 1 | Student | Group 1 |
| [email protected] | Student | 2 | Student | Group 2 |
| [email protected] | Student | 3 | Student | Group 3 |
Scenario: Bulk enrol students into the course with students already enrolled and who only have to be added to (existing) groups
Given the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | CG1 |
| Group 2 | C1 | CG2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > User bulk enrolment" in current page administration
And I set the field "List of users identified by your chosen field" to multiline:
"""
# Group 1
# Group 2
"""
And I click on "Enrol users" "button"
Then the following should exist in the "localbulkenrol_groupinfos" table:
| Group name | Group status |
| Group 1 | Group already exists |
| Group 2 | Group already exists |
And the following should exist in the "localbulkenrol_enrolusers" table:
| Email address | First name | Last name | User enrolment | Group membership | Group membership |
| [email protected] | Student | 1 | User is already enrolled | Group 1 | User will be added to group |
| [email protected] | Student | 2 | User is already enrolled | Group 2 | User will be added to group |
And I click on "Enrol users" "button"
Then the following should exist in the "participants" table:
| Email address | First name | Last name | Roles | Groups |
| [email protected] | Student | 1 | Student | Group 1 |
| [email protected] | Student | 2 | Student | Group 2 |
Scenario: Bulk enrol students into the course with students already enrolled and who are also a member of the given (existing) groups
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | CG1 |
| Group 2 | C1 | CG2 |
And the following "group members" exist:
| group | user |
| CG1 | student1 |
| CG2 | student2 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > User bulk enrolment" in current page administration
And I set the field "List of users identified by your chosen field" to multiline:
"""
# Group 1
# Group 2
"""
And I click on "Enrol users" "button"
Then the following should exist in the "localbulkenrol_groupinfos" table:
| Group name | Group status |
| Group 1 | Group already exists |
| Group 2 | Group already exists |
And the following should exist in the "localbulkenrol_enrolusers" table:
| Email address | First name | Last name | User enrolment | Group membership | Group membership |
| [email protected] | Student | 1 | User is already enrolled | Group 1 | User is already group member |
| [email protected] | Student | 2 | User is already enrolled | Group 2 | User is already group member |
And I click on "Enrol users" "button"
Then the following should exist in the "participants" table:
| Email address | First name | Last name | Roles | Groups |
| [email protected] | Student | 1 | Student | Group 1 |
| [email protected] | Student | 2 | Student | Group 2 |
Scenario: Bulk enrol students into the course and create groups if needed
Given the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | CG1 |
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > User bulk enrolment" in current page administration
And I set the field "List of users identified by your chosen field" to multiline:
"""
# Group 1
# Group 2
"""
And I click on "Enrol users" "button"
Then the following should exist in the "localbulkenrol_groupinfos" table:
| Group name | Group status |
| Group 1 | Group already exists |
| Group 2 | Group will be created |
And I click on "Enrol users" "button"
Then the following should exist in the "participants" table:
| Email address | First name | Last name | Roles | Groups |
| [email protected] | Student | 1 | Student | Group 1 |
| [email protected] | Student | 2 | Student | Group 2 |