Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_badges
2
Feature: Award badges based on cohort
3
  In order to award badges to users based on their cohort membership
4
  As an admin
5
  I need to add cohort criteria to badges in the system
6
 
7
  @javascript
8
  Scenario: Award cohort membership badge for a member of a single cohort.
9
    Given the following "cohorts" exist:
10
      | name       | idnumber |
11
      | One Cohort | CH1      |
12
      | Two Cohort | CH2      |
13
    And the following "users" exist:
14
      | username | firstname | lastname | email           |
15
      | user1    | First     | User     | first@example.com  |
16
      | user2    | Second    | User     | second@example.com |
17
    And the following "cohort members" exist:
18
      | user  | cohort |
19
      | user1 | CH1   |
20
      | user2 | CH2   |
21
    And the following "core_badges > Badge" exists:
22
      | name        | Site Badge                   |
23
      | status      | 0                            |
24
      | description | Site badge description       |
25
      | image       | badges/tests/behat/badge.png |
26
    And I log in as "admin"
27
    And I navigate to "Badges > Manage badges" in site administration
28
    And I press "Edit" action in the "Site Badge" report row
29
    And I select "Criteria" from the "jump" singleselect
30
    And I set the field "type" to "Cohort membership"
31
    And I set the field "id_cohort_cohorts" to "One Cohort"
32
    And I press "Save"
33
    And I press "Enable access"
34
    When I press "Continue"
35
    Then I should see "Recipients (1)"
36
    And I log out
37
    And I log in as "user1"
38
    And I follow "Profile" in the user menu
39
    And I should see "Site Badge"
40
 
41
  @javascript
42
  Scenario: Award cohort membership badge for a member of all required cohorts.
43
    Given the following "cohorts" exist:
44
      | name         | idnumber |
45
      | One Cohort   | CH1      |
46
      | Two Cohort   | CH2      |
47
      | Three Cohort | CH3      |
48
    And the following "users" exist:
49
      | username | firstname | lastname | email           |
50
      | user1    | First     | User     | first@example.com  |
51
      | user2    | Second    | User     | second@example.com |
52
    And the following "cohort members" exist:
53
      | user  | cohort |
54
      | user1 | CH1   |
55
      | user1 | CH2   |
56
      | user2 | CH1   |
57
      | user2 | CH3   |
58
    And the following "core_badges > Badge" exists:
59
      | name        | Site Badge                   |
60
      | status      | 0                            |
61
      | description | Site badge description       |
62
      | image       | badges/tests/behat/badge.png |
63
    And I log in as "admin"
64
    And I navigate to "Badges > Manage badges" in site administration
65
    And I press "Edit" action in the "Site Badge" report row
66
    And I select "Criteria" from the "jump" singleselect
67
    And I set the field "type" to "Cohort membership"
68
    And I expand all fieldsets
69
    And I set the field "id_cohort_cohorts" to "One Cohort,Two Cohort"
70
    And I set the field "id_agg_1" to "1"
71
    And I press "Save"
72
    When I press "Enable access"
73
    And I press "Continue"
74
    Then I should see "Recipients (1)"
75
    And I log out
76
    And I log in as "user1"
77
    And I follow "Profile" in the user menu
78
    And I should see "Site Badge"
79
 
80
  @javascript
81
  Scenario: Award cohort membership badge for a member of any required cohorts.
82
    Given the following "cohorts" exist:
83
      | name         | idnumber |
84
      | One Cohort   | CH1      |
85
      | Two Cohort   | CH2      |
86
      | Three Cohort | CH3      |
87
    And the following "users" exist:
88
      | username | firstname | lastname | email              |
89
      | user1    | First     | User     | first@example.com  |
90
      | user2    | Second    | User     | second@example.com |
91
      | user3    | third     | User     | third@example.com  |
92
    And the following "cohort members" exist:
93
      | user  | cohort |
94
      | user1 | CH1   |
95
      | user1 | CH2   |
96
      | user2 | CH1   |
97
      | user2 | CH3   |
98
      | user3 | CH2   |
99
      | user3 | CH3   |
100
    And the following "core_badges > Badge" exists:
101
      | name        | Site Badge                   |
102
      | status      | 0                            |
103
      | description | Site badge description       |
104
      | image       | badges/tests/behat/badge.png |
105
    And I log in as "admin"
106
    And I navigate to "Badges > Manage badges" in site administration
107
    And I press "Edit" action in the "Site Badge" report row
108
    And I select "Criteria" from the "jump" singleselect
109
    And I set the field "type" to "Cohort membership"
110
    And I set the field "id_cohort_cohorts" to "One Cohort"
111
    And I press "Save"
112
    When I press "Enable access"
113
    And I press "Continue"
114
    Then I should see "Recipients (2)"
115
    And I log out
116
    And I log in as "user1"
117
    And I follow "Profile" in the user menu
118
    And I should see "Site Badge"
119
    And I log out
120
    And I log in as "user2"
121
    And I follow "Profile" in the user menu
122
    And I should see "Site Badge"
123
 
124
  @javascript
125
  Scenario: Award badge based on a single cohort membership and other criteria.
126
    Given the following "cohorts" exist:
127
      | name       | idnumber |
128
      | One Cohort | CH1      |
129
      | Two Cohort | CH2      |
130
    And the following "users" exist:
131
      | username | firstname | lastname | email           |
132
      | user1    | First     | User     | first@example.com  |
133
      | user2    | Second    | User     | second@example.com |
134
    And the following "cohort members" exist:
135
      | user  | cohort |
136
      | user1 | CH1   |
137
      | user2 | CH2   |
138
    And the following "core_badges > Badge" exists:
139
      | name        | Site Badge                   |
140
      | status      | 0                            |
141
      | description | Site badge description       |
142
      | image       | badges/tests/behat/badge.png |
143
    And I log in as "admin"
144
    And I navigate to "Badges > Manage badges" in site administration
145
    And I press "Edit" action in the "Site Badge" report row
146
    And I select "Criteria" from the "jump" singleselect
147
    And I set the field "type" to "Cohort membership"
148
    And I set the field "id_cohort_cohorts" to "One Cohort"
149
    And I press "Save"
150
    And I set the field "type" to "Manual issue by role"
151
    And I expand all fieldsets
152
    And I set the field "Manager" to "1"
153
    And I set the field "Any of the selected roles awards the badge" to "1"
154
    And I press "Save"
155
    When I press "Enable access"
156
    And I press "Continue"
157
    And I select "Recipients (0)" from the "jump" singleselect
158
    And I press "Award badge"
159
    And I set the field "potentialrecipients[]" to "First User (first@example.com)"
160
    And I press "Award badge"
161
    And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
162
    And I press "Award badge"
163
    And I navigate to "Badges > Manage badges" in site administration
164
    And I follow "Site Badge"
165
    Then I should see "Recipients (1)"
166
    And I log out
167
    And I log in as "user1"
168
    And I follow "Profile" in the user menu
169
    And I should see "Site Badge"
170
    And I log out
171
    And I log in as "user2"
172
    And I follow "Profile" in the user menu
173
    And I should not see "Site Badge"
174
 
175
  @javascript
176
  Scenario: Award badge based on a single cohort membership or other criteria.
177
    Given the following "cohorts" exist:
178
      | name       | idnumber |
179
      | One Cohort | CH1      |
180
      | Two Cohort | CH2      |
181
    And the following "users" exist:
182
      | username | firstname | lastname | email              |
183
      | user1    | First     | User     | first@example.com  |
184
      | user2    | Second    | User     | second@example.com |
185
      | user3    | Third     | User     | third@example.com  |
186
    And the following "cohort members" exist:
187
      | user  | cohort |
188
      | user1 | CH1   |
189
      | user2 | CH2   |
190
      | user3 | CH2   |
191
    And the following "core_badges > Badge" exists:
192
      | name        | Site Badge                   |
193
      | status      | 0                            |
194
      | description | Site badge description       |
195
      | image       | badges/tests/behat/badge.png |
196
    And I log in as "admin"
197
    And I navigate to "Badges > Manage badges" in site administration
198
    And I press "Edit" action in the "Site Badge" report row
199
    And I select "Criteria" from the "jump" singleselect
200
    And I set the field "type" to "Cohort membership"
201
    And I set the field "id_cohort_cohorts" to "One Cohort"
202
    And I press "Save"
203
    And I set the field "type" to "Manual issue by role"
204
    And I expand all fieldsets
205
    And I set the field "Manager" to "1"
206
    And I set the field "Any of the selected roles awards the badge" to "1"
207
    And I press "Save"
208
    And I set the field "update" to "Any"
209
    When I press "Enable access"
210
    And I press "Continue"
211
    And I select "Recipients (1)" from the "jump" singleselect
212
    And I press "Award badge"
213
    And I set the field "potentialrecipients[]" to "First User (first@example.com)"
214
    And I press "Award badge"
215
    And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
216
    And I press "Award badge"
217
    And I navigate to "Badges > Manage badges" in site administration
218
    And I follow "Site Badge"
219
    Then I should see "Recipients (2)"
220
    And I log out
221
    And I log in as "user1"
222
    And I follow "Profile" in the user menu
223
    And I should see "Site Badge"
224
    And I log out
225
    And I log in as "user2"
226
    And I follow "Profile" in the user menu
227
    And I should see "Site Badge"
228
    And I log out
229
    And I log in as "user3"
230
    And I follow "Profile" in the user menu
231
    And I should not see "Site Badge"
232
 
233
  @javascript
234
  Scenario: Award badge based on a multiple cohort membership or other criteria.
235
    Given the following "cohorts" exist:
236
      | name       | idnumber |
237
      | One Cohort | CH1      |
238
      | Two Cohort | CH2      |
239
    And the following "users" exist:
240
      | username | firstname | lastname | email           |
241
      | user1    | First     | User     | first@example.com  |
242
      | user2    | Second    | User     | second@example.com |
243
      | user3    | third     | User     | third@example.com  |
244
    And the following "cohort members" exist:
245
      | user  | cohort |
246
      | user1 | CH1   |
247
      | user1 | CH2   |
248
      | user2 | CH2   |
249
      | user2 | CH2   |
250
    And the following "core_badges > Badge" exists:
251
      | name        | Site Badge                   |
252
      | status      | 0                            |
253
      | description | Site badge description       |
254
      | image       | badges/tests/behat/badge.png |
255
    And I log in as "admin"
256
    And I navigate to "Badges > Manage badges" in site administration
257
    And I press "Edit" action in the "Site Badge" report row
258
    And I select "Criteria" from the "jump" singleselect
259
    And I set the field "type" to "Cohort membership"
260
    And I set the field "id_cohort_cohorts" to "One Cohort"
261
    And I press "Save"
262
    And I set the field "type" to "Manual issue by role"
263
    And I expand all fieldsets
264
    And I set the field "Manager" to "1"
265
    And I set the field "Any of the selected roles awards the badge" to "1"
266
    And I press "Save"
267
    And I set the field "update" to "Any"
268
    When I press "Enable access"
269
    And I press "Continue"
270
    And I select "Recipients (1)" from the "jump" singleselect
271
    And I press "Award badge"
272
    And I set the field "potentialrecipients[]" to "First User (first@example.com)"
273
    And I press "Award badge"
274
    And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
275
    And I press "Award badge"
276
    And I navigate to "Badges > Manage badges" in site administration
277
    And I follow "Site Badge"
278
    Then I should see "Recipients (2)"
279
    And I log out
280
    And I log in as "user1"
281
    And I follow "Profile" in the user menu
282
    And I should see "Site Badge"
283
    And I log out
284
    And I log in as "user2"
285
    And I follow "Profile" in the user menu
286
    And I should see "Site Badge"
287
    And I log out
288
    And I log in as "user3"
289
    And I follow "Profile" in the user menu
290
    And I should not see "Site Badge"
291
 
292
  @javascript
293
  Scenario: Award badge based on a multiple cohort membership and other criteria.
294
    Given the following "cohorts" exist:
295
      | name       | idnumber |
296
      | One Cohort | CH1      |
297
      | Two Cohort | CH2      |
298
    And the following "users" exist:
299
      | username | firstname | lastname | email              |
300
      | user1    | First     | User     | first@example.com  |
301
      | user2    | Second    | User     | second@example.com |
302
      | user3    | Third     | User     | third@example.com  |
303
    And the following "cohort members" exist:
304
      | user  | cohort |
305
      | user1 | CH1   |
306
      | user1 | CH2   |
307
      | user2 | CH1   |
308
      | user3 | CH2   |
309
    And the following "core_badges > Badge" exists:
310
      | name        | Site Badge                   |
311
      | status      | 0                            |
312
      | description | Site badge description       |
313
      | image       | badges/tests/behat/badge.png |
314
    And I log in as "admin"
315
    And I navigate to "Badges > Manage badges" in site administration
316
    And I press "Edit" action in the "Site Badge" report row
317
    And I select "Criteria" from the "jump" singleselect
318
    And I set the field "type" to "Cohort membership"
319
    And I expand all fieldsets
320
    And I set the field "id_cohort_cohorts" to "One Cohort,Two Cohort"
321
    And I set the field "id_agg_1" to "1"
322
    And I press "Save"
323
    And I set the field "type" to "Manual issue by role"
324
    And I expand all fieldsets
325
    And I set the field "Manager" to "1"
326
    And I set the field "Any of the selected roles awards the badge" to "1"
327
    And I press "Save"
328
    And I set the field "update" to "All"
329
    When I press "Enable access"
330
    And I press "Continue"
331
    And I select "Recipients (0)" from the "jump" singleselect
332
    And I press "Award badge"
333
    And I set the field "potentialrecipients[]" to "First User (first@example.com)"
334
    And I press "Award badge"
335
    And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
336
    And I press "Award badge"
337
    And I navigate to "Badges > Manage badges" in site administration
338
    And I follow "Site Badge"
339
    Then I should see "Recipients (1)"
340
    And I log out
341
    And I log in as "user1"
342
    And I follow "Profile" in the user menu
343
    And I should see "Site Badge"
344
    And I log out
345
    And I log in as "user2"
346
    And I follow "Profile" in the user menu
347
    And I should not see "Site Badge"
348
    And I log out
349
    And I log in as "user3"
350
    And I follow "Profile" in the user menu
351
    And I should not see "Site Badge"
352
 
353
  @javascript
354
  Scenario: Award multiple badges based on single cohort membership
355
    Given the following "cohorts" exist:
356
      | name       | idnumber |
357
      | One Cohort | CH1      |
358
      | Two Cohort | CH2      |
359
    And the following "users" exist:
360
      | username | firstname | lastname | email              |
361
      | user1    | First     | User     | first@example.com  |
362
      | user2    | Second    | User     | second@example.com |
363
      | user3    | Third     | User     | third@example.com  |
364
    And the following "cohort members" exist:
365
      | user  | cohort |
366
      | user1 | CH1   |
367
      | user1 | CH2   |
368
      | user2 | CH2   |
369
    And the following "core_badges > Badges" exist:
370
      | name         | status | description            | image                        |
371
      | Site Badge 1 | 0      | Site badge description | badges/tests/behat/badge.png |
372
      | Site Badge 2 | 0      | Site badge description | badges/tests/behat/badge.png |
373
    And I log in as "admin"
374
    And I navigate to "Badges > Manage badges" in site administration
375
    And I press "Edit" action in the "Site Badge" report row
376
    And I select "Criteria" from the "jump" singleselect
377
    And I set the field "type" to "Cohort membership"
378
    And I set the field "id_cohort_cohorts" to "One Cohort"
379
    And I press "Save"
380
    And I press "Enable access"
381
    When I press "Continue"
382
    And I should see "Recipients (1)"
383
    And I navigate to "Badges > Manage badges" in site administration
384
    And I press "Edit" action in the "Site Badge 2" report row
385
    And I select "Criteria" from the "jump" singleselect
386
    And I set the field "type" to "Cohort membership"
387
    And I set the field "id_cohort_cohorts" to "Two Cohort"
388
    And I press "Save"
389
    And I press "Enable access"
390
    And I press "Continue"
391
    Then I should see "Recipients (2)"
392
    And I log out
393
    And I log in as "user1"
394
    And I follow "Profile" in the user menu
395
    And I should see "Site Badge 1"
396
    And I should see "Site Badge 2"
397
    And I log out
398
    And I log in as "user2"
399
    And I follow "Profile" in the user menu
400
    And I should not see "Site Badge 1"
401
    And I should see "Site Badge 2"
402
    And I log out
403
    And I log in as "user3"
404
    And I follow "Profile" in the user menu
405
    And I should not see "Site Badge 1"
406
    And I should not see "Site Badge 2"
407
 
408
  @javascript
409
  Scenario: Award multiple badges based on multiple cohort memberships
410
    Given the following "cohorts" exist:
411
      | name         | idnumber |
412
      | One Cohort   | CH1      |
413
      | Two Cohort   | CH2      |
414
      | Three Cohort | CH3      |
415
    And the following "users" exist:
416
      | username | firstname | lastname | email              |
417
      | user1    | First     | User     | first@example.com  |
418
      | user2    | Second    | User     | second@example.com |
419
      | user3    | Third     | User     | third@example.com  |
420
    And the following "cohort members" exist:
421
      | user  | cohort |
422
      | user1 | CH1    |
423
      | user1 | CH2    |
424
      | user2 | CH2    |
425
      | user2 | CH3    |
426
    And the following "core_badges > Badges" exist:
427
      | name         | status | description            | image                        |
428
      | Site Badge 1 | 0      | Site badge description | badges/tests/behat/badge.png |
429
      | Site Badge 2 | 0      | Site badge description | badges/tests/behat/badge.png |
430
    And I log in as "admin"
431
    And I navigate to "Badges > Manage badges" in site administration
432
    And I press "Edit" action in the "Site Badge" report row
433
    And I select "Criteria" from the "jump" singleselect
434
    And I set the field "type" to "Cohort membership"
435
    And I expand all fieldsets
436
    And I set the field "id_cohort_cohorts" to "One Cohort,Two Cohort"
437
    And I set the field "id_agg_1" to "1"
438
    And I press "Save"
439
    And I press "Enable access"
440
    When I press "Continue"
441
    And I should see "Recipients (1)"
442
    And I navigate to "Badges > Manage badges" in site administration
443
    And I press "Edit" action in the "Site Badge 2" report row
444
    And I select "Criteria" from the "jump" singleselect
445
    And I set the field "type" to "Cohort membership"
446
    And I expand all fieldsets
447
    And I set the field "id_cohort_cohorts" to "Three Cohort,Two Cohort"
448
    And I set the field "id_agg_1" to "1"
449
    And I press "Save"
450
    And I press "Enable access"
451
    And I press "Continue"
452
    And I should see "Recipients (1)"
453
    And I log out
454
    And I log in as "user1"
455
    And I follow "Profile" in the user menu
456
    And I should see "Site Badge 1"
457
    And I should not see "Site Badge 2"
458
    And I log out
459
    And I log in as "user2"
460
    And I follow "Profile" in the user menu
461
    And I should not see "Site Badge 1"
462
    And I should see "Site Badge 2"
463
    And I log out
464
    And I log in as "user3"
465
    And I follow "Profile" in the user menu
466
    And I should not see "Site Badge 1"
467
    And I should not see "Site Badge 2"