1 |
efrain |
1 |
@block @block_messageteacher @javascript
|
|
|
2 |
Feature: List Teachers
|
|
|
3 |
In order to easily message my teacher
|
|
|
4 |
As a student
|
|
|
5 |
I need to see a list of my teachers in a block on my course page
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | email | firstname | lastname |
|
|
|
10 |
| teststudent | teststudent@example.com | Test | Student |
|
|
|
11 |
| testteacher1 | testteacher1@example.com | Test | Teacher1 |
|
|
|
12 |
| testteacher2 | testteacher2@example.com | Test | Teacher2 |
|
|
|
13 |
| testteacher3 | testteacher3@example.com | Test | Teacher3 |
|
|
|
14 |
And the following "categories" exist:
|
|
|
15 |
| name | category | idnumber |
|
|
|
16 |
| Category 1 | 0 | CAT1 |
|
|
|
17 |
And the following "courses" exist:
|
|
|
18 |
| fullname | shortname | category | format |
|
|
|
19 |
| Course 1 | course1 | CAT1 | topics |
|
|
|
20 |
| Course 2 | course2 | CAT1 | topics |
|
|
|
21 |
|
|
|
22 |
Scenario: There are no teachers on the course
|
|
|
23 |
Given the following "course enrolments" exist:
|
|
|
24 |
| user | course | role | enrol |
|
|
|
25 |
| teststudent | course1 | student | manual |
|
|
|
26 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
27 |
And the following "blocks" exist:
|
|
|
28 |
| blockname | contextlevel | reference |
|
|
|
29 |
| messageteacher | Course | course1 |
|
|
|
30 |
And the following config values are set as admin:
|
|
|
31 |
| roles | 3 | block_messageteacher |
|
|
|
32 |
And I log in as "teststudent"
|
|
|
33 |
When I am on "Course 1" course homepage
|
|
|
34 |
Then I should not see "Message My Teacher"
|
|
|
35 |
|
|
|
36 |
Scenario: There is one teacher on the course
|
|
|
37 |
Given the following "course enrolments" exist:
|
|
|
38 |
| user | course | role | enrol |
|
|
|
39 |
| teststudent | course1 | student | manual |
|
|
|
40 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
41 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
42 |
And the following "blocks" exist:
|
|
|
43 |
| blockname | contextlevel | reference |
|
|
|
44 |
| messageteacher | Course | course1 |
|
|
|
45 |
And the following config values are set as admin:
|
|
|
46 |
| roles | 3 | block_messageteacher |
|
|
|
47 |
And I log in as "teststudent"
|
|
|
48 |
When I am on "Course 1" course homepage
|
|
|
49 |
Then I should see "Message My Teacher"
|
|
|
50 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
51 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
52 |
|
|
|
53 |
Scenario: There is are two teachers on the course
|
|
|
54 |
Given the following "course enrolments" exist:
|
|
|
55 |
| user | course | role | enrol |
|
|
|
56 |
| teststudent | course1 | student | manual |
|
|
|
57 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
58 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
59 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
60 |
And the following "blocks" exist:
|
|
|
61 |
| blockname | contextlevel | reference |
|
|
|
62 |
| messageteacher | Course | course1 |
|
|
|
63 |
And the following config values are set as admin:
|
|
|
64 |
| roles | 3 | block_messageteacher |
|
|
|
65 |
And I log in as "teststudent"
|
|
|
66 |
When I am on "Course 1" course homepage
|
|
|
67 |
Then I should see "Message My Teacher"
|
|
|
68 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
69 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
70 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
71 |
|
|
|
72 |
Scenario: There is more than one teacher role, and a teacher exist with each role
|
|
|
73 |
Given the following "course enrolments" exist:
|
|
|
74 |
| user | course | role | enrol |
|
|
|
75 |
| teststudent | course1 | student | manual |
|
|
|
76 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
77 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
78 |
| testteacher3 | course1 | teacher | manual |
|
|
|
79 |
And the following "blocks" exist:
|
|
|
80 |
| blockname | contextlevel | reference |
|
|
|
81 |
| messageteacher | Course | course1 |
|
|
|
82 |
And the following config values are set as admin:
|
|
|
83 |
| roles | 3,4 | block_messageteacher |
|
|
|
84 |
And I log in as "teststudent"
|
|
|
85 |
When I am on "Course 1" course homepage
|
|
|
86 |
Then I should see "Message My Teacher"
|
|
|
87 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
88 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
89 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
90 |
|
|
|
91 |
@block_messageteacher_grouping
|
|
|
92 |
Scenario: Grouping is enabled, but the course has no groups
|
|
|
93 |
Given the following "course enrolments" exist:
|
|
|
94 |
| user | course | role | enrol |
|
|
|
95 |
| teststudent | course1 | student | manual |
|
|
|
96 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
97 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
98 |
And the following "blocks" exist:
|
|
|
99 |
| blockname | contextlevel | reference |
|
|
|
100 |
| messageteacher | Course | course1 |
|
|
|
101 |
And the following config values are set as admin:
|
|
|
102 |
| roles | 3 | block_messageteacher |
|
|
|
103 |
| groups | 1 | block_messageteacher |
|
|
|
104 |
And I log in as "teststudent"
|
|
|
105 |
When I am on "Course 1" course homepage
|
|
|
106 |
Then I should see "Message My Teacher"
|
|
|
107 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
108 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
109 |
|
|
|
110 |
@block_messageteacher_grouping
|
|
|
111 |
Scenario: Grouping is enabled, but the student isn't part of a group
|
|
|
112 |
Given the following "course enrolments" exist:
|
|
|
113 |
| user | course | role | enrol |
|
|
|
114 |
| teststudent | course1 | student | manual |
|
|
|
115 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
116 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
117 |
And the following "groups" exist:
|
|
|
118 |
| name | description | course | idnumber |
|
|
|
119 |
| Group 1 | Anything | course1 | group1 |
|
|
|
120 |
And the following "group members" exist:
|
|
|
121 |
| user | group |
|
|
|
122 |
| testteacher2 | group1 |
|
|
|
123 |
And the following "blocks" exist:
|
|
|
124 |
| blockname | contextlevel | reference |
|
|
|
125 |
| messageteacher | Course | course1 |
|
|
|
126 |
And the following config values are set as admin:
|
|
|
127 |
| roles | 3 | block_messageteacher |
|
|
|
128 |
| groups | 1 | block_messageteacher |
|
|
|
129 |
And I log in as "teststudent"
|
|
|
130 |
When I am on "Course 1" course homepage
|
|
|
131 |
Then I should see "Message My Teacher"
|
|
|
132 |
And I should see "You're not a member of any group" in the ".block_messageteacher" "css_element"
|
|
|
133 |
But I should not see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
134 |
|
|
|
135 |
@block_messageteacher_grouping
|
|
|
136 |
Scenario: Grouping is enabled, and the student is part of a group, but the teachers aren't in the group
|
|
|
137 |
Given the following "course enrolments" exist:
|
|
|
138 |
| user | course | role | enrol |
|
|
|
139 |
| teststudent | course1 | student | manual |
|
|
|
140 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
141 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
142 |
And the following "groups" exist:
|
|
|
143 |
| name | description | course | idnumber |
|
|
|
144 |
| Group 1 | Anything | course1 | group1 |
|
|
|
145 |
And the following "group members" exist:
|
|
|
146 |
| user | group |
|
|
|
147 |
| teststudent | group1 |
|
|
|
148 |
And the following "blocks" exist:
|
|
|
149 |
| blockname | contextlevel | reference |
|
|
|
150 |
| messageteacher | Course | course1 |
|
|
|
151 |
And the following config values are set as admin:
|
|
|
152 |
| roles | 3 | block_messageteacher |
|
|
|
153 |
| groups | 1 | block_messageteacher |
|
|
|
154 |
And I log in as "teststudent"
|
|
|
155 |
When I am on "Course 1" course homepage
|
|
|
156 |
Then I should see "Message My Teacher"
|
|
|
157 |
And I should see "Teacher not yet assigned to your group" in the ".block_messageteacher" "css_element"
|
|
|
158 |
But I should not see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
159 |
|
|
|
160 |
@block_messageteacher_grouping
|
|
|
161 |
Scenario: Grouping is enabled, and the student is part of a group, and one teacher is in the group, the other teacher is in a different group
|
|
|
162 |
Given the following "course enrolments" exist:
|
|
|
163 |
| user | course | role | enrol |
|
|
|
164 |
| teststudent | course1 | student | manual |
|
|
|
165 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
166 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
167 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
168 |
And the following "groups" exist:
|
|
|
169 |
| name | description | course | idnumber |
|
|
|
170 |
| Group 1 | Anything | course1 | group1 |
|
|
|
171 |
| Group 2 | Anything | course1 | group2 |
|
|
|
172 |
And the following "group members" exist:
|
|
|
173 |
| user | group |
|
|
|
174 |
| teststudent | group1 |
|
|
|
175 |
| testteacher2 | group1 |
|
|
|
176 |
| testteacher3 | group2 |
|
|
|
177 |
And the following "blocks" exist:
|
|
|
178 |
| blockname | contextlevel | reference |
|
|
|
179 |
| messageteacher | Course | course1 |
|
|
|
180 |
And the following config values are set as admin:
|
|
|
181 |
| roles | 3 | block_messageteacher |
|
|
|
182 |
| groups | 1 | block_messageteacher |
|
|
|
183 |
And I log in as "teststudent"
|
|
|
184 |
When I am on "Course 1" course homepage
|
|
|
185 |
Then I should see "Message My Teacher"
|
|
|
186 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
187 |
But I should not see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
188 |
And I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
189 |
|
|
|
190 |
@block_messageteacher_grouping
|
|
|
191 |
Scenario: Grouping is enabled, and the student is part of a group, and both teachers are in the group
|
|
|
192 |
Given the following "course enrolments" exist:
|
|
|
193 |
| user | course | role | enrol |
|
|
|
194 |
| teststudent | course1 | student | manual |
|
|
|
195 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
196 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
197 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
198 |
And the following "groups" exist:
|
|
|
199 |
| name | description | course | idnumber |
|
|
|
200 |
| Group 1 | Anything | course1 | group1 |
|
|
|
201 |
| Group 2 | Anything | course1 | group2 |
|
|
|
202 |
And the following "group members" exist:
|
|
|
203 |
| user | group |
|
|
|
204 |
| teststudent | group1 |
|
|
|
205 |
| testteacher2 | group1 |
|
|
|
206 |
| testteacher3 | group1 |
|
|
|
207 |
And the following "blocks" exist:
|
|
|
208 |
| blockname | contextlevel | reference |
|
|
|
209 |
| messageteacher | Course | course1 |
|
|
|
210 |
And the following config values are set as admin:
|
|
|
211 |
| roles | 3 | block_messageteacher |
|
|
|
212 |
| groups | 1 | block_messageteacher |
|
|
|
213 |
And I log in as "teststudent"
|
|
|
214 |
When I am on "Course 1" course homepage
|
|
|
215 |
Then I should see "Message My Teacher"
|
|
|
216 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
217 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
218 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
219 |
|
|
|
220 |
@block_messageteacher_grouping
|
|
|
221 |
Scenario: Grouping is disabled, and the student is part of a group, and one teacher is in the group, the other teacher is in a different group
|
|
|
222 |
Given the following "course enrolments" exist:
|
|
|
223 |
| user | course | role | enrol |
|
|
|
224 |
| teststudent | course1 | student | manual |
|
|
|
225 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
226 |
| testteacher2 | course1 | editingteacher | manual |
|
|
|
227 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
228 |
And the following "groups" exist:
|
|
|
229 |
| name | description | course | idnumber |
|
|
|
230 |
| Group 1 | Anything | course1 | group1 |
|
|
|
231 |
| Group 2 | Anything | course1 | group2 |
|
|
|
232 |
And the following "group members" exist:
|
|
|
233 |
| user | group |
|
|
|
234 |
| teststudent | group1 |
|
|
|
235 |
| testteacher2 | group1 |
|
|
|
236 |
| testteacher3 | group2 |
|
|
|
237 |
And the following "blocks" exist:
|
|
|
238 |
| blockname | contextlevel | reference |
|
|
|
239 |
| messageteacher | Course | course1 |
|
|
|
240 |
And the following config values are set as admin:
|
|
|
241 |
| roles | 3 | block_messageteacher |
|
|
|
242 |
| groups | 0 | block_messageteacher |
|
|
|
243 |
And I log in as "teststudent"
|
|
|
244 |
When I am on "Course 1" course homepage
|
|
|
245 |
Then I should see "Message My Teacher"
|
|
|
246 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
247 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
248 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
249 |
|
|
|
250 |
@block_messageteacher_categories
|
|
|
251 |
Scenario: Category teachers are enabled, but there are no teachers in the category or on the course
|
|
|
252 |
Given the following "course enrolments" exist:
|
|
|
253 |
| user | course | role | enrol |
|
|
|
254 |
| teststudent | course1 | student | manual |
|
|
|
255 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
256 |
And the following "blocks" exist:
|
|
|
257 |
| blockname | contextlevel | reference |
|
|
|
258 |
| messageteacher | Course | course1 |
|
|
|
259 |
And the following config values are set as admin:
|
|
|
260 |
| roles | 3 | block_messageteacher |
|
|
|
261 |
| includecoursecat | 1 | block_messageteacher |
|
|
|
262 |
And I log in as "teststudent"
|
|
|
263 |
When I am on "Course 1" course homepage
|
|
|
264 |
Then I should not see "Message My Teacher"
|
|
|
265 |
|
|
|
266 |
@block_messageteacher_categories
|
|
|
267 |
Scenario: Category teachers are enabled, and there is one teacher in the category but none on the course
|
|
|
268 |
Given the following "course enrolments" exist:
|
|
|
269 |
| user | course | role | enrol |
|
|
|
270 |
| teststudent | course1 | student | manual |
|
|
|
271 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
272 |
And the following "role assigns" exist:
|
|
|
273 |
| user | role | contextlevel | reference |
|
|
|
274 |
| testteacher2 | editingteacher | Category | CAT1 |
|
|
|
275 |
And the following "blocks" exist:
|
|
|
276 |
| blockname | contextlevel | reference |
|
|
|
277 |
| messageteacher | Course | course1 |
|
|
|
278 |
And the following config values are set as admin:
|
|
|
279 |
| roles | 3 | block_messageteacher |
|
|
|
280 |
| includecoursecat | 1 | block_messageteacher |
|
|
|
281 |
And I log in as "teststudent"
|
|
|
282 |
When I am on "Course 1" course homepage
|
|
|
283 |
Then I should see "Message My Teacher"
|
|
|
284 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
285 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
286 |
And I should not see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
287 |
|
|
|
288 |
@block_messageteacher_categories
|
|
|
289 |
Scenario: Category teachers are enabled, and there is one teacher on the course but none in the category
|
|
|
290 |
Given the following "course enrolments" exist:
|
|
|
291 |
| user | course | role | enrol |
|
|
|
292 |
| teststudent | course1 | student | manual |
|
|
|
293 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
294 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
295 |
And the following "blocks" exist:
|
|
|
296 |
| blockname | contextlevel | reference |
|
|
|
297 |
| messageteacher | Course | course1 |
|
|
|
298 |
And the following config values are set as admin:
|
|
|
299 |
| roles | 3 | block_messageteacher |
|
|
|
300 |
| includecoursecat | 1 | block_messageteacher |
|
|
|
301 |
And I log in as "teststudent"
|
|
|
302 |
When I am on "Course 1" course homepage
|
|
|
303 |
Then I should see "Message My Teacher"
|
|
|
304 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
305 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
306 |
And I should not see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
307 |
|
|
|
308 |
@block_messageteacher_categories
|
|
|
309 |
Scenario: Category teachers are enabled, and there is one teacher on the course and one in the category
|
|
|
310 |
Given the following "course enrolments" exist:
|
|
|
311 |
| user | course | role | enrol |
|
|
|
312 |
| teststudent | course1 | student | manual |
|
|
|
313 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
314 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
315 |
And the following "role assigns" exist:
|
|
|
316 |
| user | role | contextlevel | reference |
|
|
|
317 |
| testteacher2 | editingteacher | Category | CAT1 |
|
|
|
318 |
And the following "blocks" exist:
|
|
|
319 |
| blockname | contextlevel | reference |
|
|
|
320 |
| messageteacher | Course | course1 |
|
|
|
321 |
And the following config values are set as admin:
|
|
|
322 |
| roles | 3 | block_messageteacher |
|
|
|
323 |
| includecoursecat | 1 | block_messageteacher |
|
|
|
324 |
And I log in as "teststudent"
|
|
|
325 |
When I am on "Course 1" course homepage
|
|
|
326 |
Then I should see "Message My Teacher"
|
|
|
327 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
328 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
329 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
330 |
|
|
|
331 |
@block_messageteacher_categories
|
|
|
332 |
Scenario: Category teachers are enabled, and there is one teacher on the course and one in the category, with different roles
|
|
|
333 |
Given the following "course enrolments" exist:
|
|
|
334 |
| user | course | role | enrol |
|
|
|
335 |
| teststudent | course1 | student | manual |
|
|
|
336 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
337 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
338 |
And the following "role assigns" exist:
|
|
|
339 |
| user | role | contextlevel | reference |
|
|
|
340 |
| testteacher2 | teacher | Category | CAT1 |
|
|
|
341 |
And the following "blocks" exist:
|
|
|
342 |
| blockname | contextlevel | reference |
|
|
|
343 |
| messageteacher | Course | course1 |
|
|
|
344 |
And the following config values are set as admin:
|
|
|
345 |
| roles | 3,4 | block_messageteacher |
|
|
|
346 |
| includecoursecat | 1 | block_messageteacher |
|
|
|
347 |
And I log in as "teststudent"
|
|
|
348 |
When I am on "Course 1" course homepage
|
|
|
349 |
Then I should see "Message My Teacher"
|
|
|
350 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
351 |
And I should see "Test Teacher2" in the ".block_messageteacher" "css_element"
|
|
|
352 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
353 |
|
|
|
354 |
@block_messageteacher_categories
|
|
|
355 |
Scenario: Category teachers are disabled, and there is one teacher on the course and one in the category
|
|
|
356 |
Given the following "course enrolments" exist:
|
|
|
357 |
| user | course | role | enrol |
|
|
|
358 |
| teststudent | course1 | student | manual |
|
|
|
359 |
| testteacher1 | course2 | editingteacher | manual |
|
|
|
360 |
| testteacher3 | course1 | editingteacher | manual |
|
|
|
361 |
And the following "role assigns" exist:
|
|
|
362 |
| user | role | contextlevel | reference |
|
|
|
363 |
| testteacher2 | editingteacher | Category | CAT1 |
|
|
|
364 |
And the following "blocks" exist:
|
|
|
365 |
| blockname | contextlevel | reference |
|
|
|
366 |
| messageteacher | Course | course1 |
|
|
|
367 |
And the following config values are set as admin:
|
|
|
368 |
| roles | 3 | block_messageteacher |
|
|
|
369 |
| includecoursecat | 0 | block_messageteacher |
|
|
|
370 |
And I log in as "teststudent"
|
|
|
371 |
When I am on "Course 1" course homepage
|
|
|
372 |
Then I should see "Message My Teacher"
|
|
|
373 |
And I should see "Test Teacher3" in the ".block_messageteacher" "css_element"
|
|
|
374 |
But I should not see "Test Teacher1" in the ".block_messageteacher" "css_element"
|
|
|
375 |
And I should not see "Test Teacher2" in the ".block_messageteacher" "css_element"
|