Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 27... Línea 27...
27
      | completion                          | 1                       |
27
      | completion                          | 1                       |
28
      | assignsubmission_onlinetext_enabled | 1                       |
28
      | assignsubmission_onlinetext_enabled | 1                       |
Línea 29... Línea 29...
29
 
29
 
30
  @javascript
30
  @javascript
31
  Scenario: Award badge on other badges as criteria
31
  Scenario: Award badge on other badges as criteria
32
    Given I log in as "teacher1"
32
    Given the following "core_badges > Badges" exist:
33
    And I am on "Course 1" course homepage
33
      | name           | course | description                | image                        | status | type |
34
    # Create course badge 1.
34
      | Course Badge 1 | C1     | Course badge 1 description | badges/tests/behat/badge.png | active | 2    |
35
    And I navigate to "Badges > Add a new badge" in current page administration
35
      | Course Badge 2 | C1     | Course badge 2 description | badges/tests/behat/badge.png | 0      | 2    |
36
    And I set the following fields to these values:
36
    And the following "core_badges > Criteria" exists:
37
      | Name | Course Badge 1 |
-
 
38
      | Description | Course badge 1 description |
-
 
39
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
-
 
40
    And I press "Create badge"
-
 
41
    And I set the field "type" to "Manual issue by role"
-
 
42
    And I expand all fieldsets
-
 
43
    # Set to ANY of the roles awards badge.
37
      | badge  | Course Badge 1 |
44
    And I set the field "Teacher" to "1"
-
 
45
    And I set the field "Any of the selected roles awards the badge" to "1"
-
 
46
    And I press "Save"
-
 
47
    And I press "Enable access"
-
 
48
    And I press "Continue"
-
 
49
    # Badge #2
38
      | role   | editingteacher |
50
    And I am on "Course 1" course homepage
39
    And I am on the "Course 1" "course" page logged in as "teacher1"
51
    And I navigate to "Badges > Add a new badge" in current page administration
-
 
52
    And I set the following fields to these values:
40
    And I navigate to "Badges" in current page administration
53
      | Name | Course Badge 2 |
-
 
54
      | Description | Course badge 2 description |
41
    And I follow "Course Badge 2"
55
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
-
 
56
    And I press "Create badge"
42
    And I select "Criteria" from the "jump" singleselect
57
    # Set "course badge 1" as criteria
43
    # Set "course badge 1" as criteria for Badge 2.
58
    And I set the field "type" to "Awarded badges"
44
    And I set the field "type" to "Awarded badges"
59
    And I set the field "id_badge_badges" to "Course Badge 1"
45
    And I set the field "id_badge_badges" to "Course Badge 1"
60
    And I press "Save"
46
    And I press "Save"
61
    And I press "Enable access"
47
    And I press "Enable access"
62
    And I press "Continue"
48
    And I click on "Enable" "button" in the "Confirm" "dialogue"
63
    And I am on "Course 1" course homepage
49
    And I am on "Course 1" course homepage
64
    And I navigate to "Badges > Manage badges" in current page administration
50
    And I navigate to "Badges" in current page administration
65
    And I follow "Course Badge 1"
51
    And I follow "Course Badge 1"
66
    And I select "Recipients (0)" from the "jump" singleselect
52
    And I select "Recipients (0)" from the "jump" singleselect
67
    And I press "Award badge"
53
    And I press "Award badge"
68
    # Award course badge 1 to student 1.
54
    # Award course badge 1 to student 1.
69
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
55
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
70
    When I press "Award badge"
56
    When I press "Award badge"
71
    And I am on "Course 1" course homepage
57
    And I am on "Course 1" course homepage
72
    And I navigate to "Badges > Manage badges" in current page administration
58
    And I navigate to "Badges" in current page administration
73
    And I follow "Course Badge 1"
59
    And I follow "Course Badge 1"
74
    And I select "Recipients (1)" from the "jump" singleselect
60
    And I select "Recipients (1)" from the "jump" singleselect
75
    Then I should see "Recipients (1)"
61
    Then I should see "Recipients (1)"
76
    And I log out
62
    And I log out
Línea 82... Línea 68...
82
    And I should see "Course Badge 2"
68
    And I should see "Course Badge 2"
83
    # Student 1 should have both badges also in the Badges navigation section.
69
    # Student 1 should have both badges also in the Badges navigation section.
84
    When I follow "Badges"
70
    When I follow "Badges"
85
    Then I should see "Course Badge 1"
71
    Then I should see "Course Badge 1"
86
    And I should see "Course Badge 2"
72
    And I should see "Course Badge 2"
87
    And I should not see "Manage badges"
-
 
88
    And I should not see "Add a new badge"
73
    And I should not see "Add a new badge"
-
 
74
    # Student 1 should have both badges in the course too.
-
 
75
    And I am on "Course 1" course homepage
-
 
76
    And I follow "Badges"
-
 
77
    And I should see "Course Badge 1"
-
 
78
    And I should see "Course Badge 2"
-
 
79
    And I should not see "Course badge 1 description"
-
 
80
    And I should not see "Course badge 2 description"
-
 
81
    And I should not see "Recipients"
-
 
82
    And I should not see "Badge status"
-
 
83
    And I follow "Course Badge 1"
-
 
84
    And I should see "Course badge 1 description"
-
 
85
    And I should not see "Course badge 2 description"
89
    And I log out
86
    And I log out
90
    # Teacher 1 should have access to manage/create badges in the Badges navigation section.
87
    # Teacher 1 should have access to manage/create badges in the Badges navigation section.
91
    When I log in as "teacher1"
88
    When I log in as "teacher1"
92
    And I am on "Course 1" course homepage
89
    And I am on "Course 1" course homepage
93
    And I navigate to "Badges > Manage badges" in current page administration
90
    And I navigate to "Badges" in current page administration
94
    Then I should see "Course Badge 1"
91
    Then I should see "Course Badge 1"
95
    And I should see "Course Badge 2"
92
    And I should see "Course Badge 2"
96
    And I should see "Manage badges"
-
 
97
    And I should see "Add a new badge"
93
    And I should see "Add a new badge"
98
    # Teacher 1 should NOT have access to manage/create site badges in the Site badges section.
94
    # Teacher 1 should NOT have access to manage/create site badges in the Site badges section.
99
    When I am on homepage
95
    When I am on homepage
100
    And I turn editing mode on
96
    And I turn editing mode on
101
    And the following config values are set as admin:
97
    And the following config values are set as admin:
102
      | unaddableblocks | | theme_boost|
98
      | unaddableblocks | | theme_boost|
103
   # TODO MDL-57120 site "Badges" link not accessible without navigation block.
99
   # TODO MDL-57120 site "Badges" link not accessible without navigation block.
104
    And I add the "Navigation" block if not present
100
    And I add the "Navigation" block if not present
105
    And I click on "Site pages" "list_item" in the "Navigation" "block"
101
    And I click on "Site pages" "list_item" in the "Navigation" "block"
106
    And I click on "Site badges" "link" in the "Navigation" "block"
102
    And I click on "Site badges" "link" in the "Navigation" "block"
107
    Then I should see "There are currently no badges available for users to earn."
103
    Then I should see "There are no matching badges available for users to earn."
108
    And I should not see "Manage badges"
-
 
109
    And I should not see "Add a new badge"
104
    And I should not see "Add a new badge"
Línea 110... Línea 105...
110
 
105
 
111
  @javascript
106
  @javascript
-
 
107
  Scenario: Award profile badge
-
 
108
    Given the following "core_badges > Badge" exists:
-
 
109
      | name        | Profile Badge                |
-
 
110
      | description | Test badge description       |
-
 
111
      | image       | badges/tests/behat/badge.png |
-
 
112
      | status      | 0                            |
112
  Scenario: Award profile badge
113
      | type        | 1                            |
113
    Given I log in as "admin"
114
    Given I log in as "admin"
114
    And I navigate to "Badges > Add a new badge" in site administration
-
 
115
    And I set the following fields to these values:
115
    And I navigate to "Badges > Manage badges" in site administration
116
      | Name | Profile Badge |
-
 
117
      | Description | Test badge description |
116
    And I follow "Profile Badge"
118
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
-
 
119
    And I press "Create badge"
117
    And I select "Criteria" from the "jump" singleselect
120
    And I set the field "type" to "Profile completion"
118
    And I set the field "type" to "Profile completion"
121
    And I expand all fieldsets
119
    And I expand all fieldsets
122
    And I set the field "First name" to "1"
120
    And I set the field "First name" to "1"
123
    And I set the field "Email address" to "1"
121
    And I set the field "Email address" to "1"
Línea 129... Línea 127...
129
    And I should see "Email address"
127
    And I should see "Email address"
130
    And I should see "Phone"
128
    And I should see "Phone"
131
    And I should see "Criterion description"
129
    And I should see "Criterion description"
132
    And I should not see "Criteria for this badge have not been set up yet."
130
    And I should not see "Criteria for this badge have not been set up yet."
133
    And I press "Enable access"
131
    And I press "Enable access"
134
    And I press "Continue"
132
    And I click on "Enable" "button" in the "Confirm" "dialogue"
135
    And I open my profile in edit mode
133
    And I open my profile in edit mode
136
    And I expand all fieldsets
134
    And I expand all fieldsets
137
    And I set the field "Phone" to "123456789"
135
    And I set the field "Phone" to "123456789"
138
    And I press "Update profile"
136
    And I press "Update profile"
139
    And I follow "Profile" in the user menu
137
    And I follow "Profile" in the user menu
140
    Then I should see "Profile Badge"
138
    Then I should see "Profile Badge"
141
    And I should not see "There are currently no badges available for users to earn."
139
    And I should not see "There are no matching badges available for users to earn."
Línea 142... Línea 140...
142
 
140
 
143
  @javascript
141
  @javascript
144
  Scenario: Award site badge
142
  Scenario: Award site badge
145
    Given I log in as "admin"
143
    Given the following "core_badges > Badge" exists:
146
    And I navigate to "Badges > Add a new badge" in site administration
144
      | name        | Site Badge                   |
147
    And I set the following fields to these values:
145
      | description | Site badge description       |
148
      | Name | Site Badge |
146
      | image       | badges/tests/behat/badge.png |
149
      | Description | Site badge description |
147
      | status      | active                       |
150
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
148
      | type        | 1                            |
151
    And I press "Create badge"
149
    And the following "core_badges > Criteria" exists:
152
    And I set the field "type" to "Manual issue by role"
150
      | badge  | Site Badge     |
153
    And I set the field "Teacher" to "1"
151
      | role   | editingteacher |
154
    And I press "Save"
152
    And I log in as "admin"
155
    And I press "Enable access"
153
    And I navigate to "Badges > Manage badges" in site administration
156
    And I press "Continue"
154
    And I follow "Site Badge"
157
    And I select "Recipients (0)" from the "jump" singleselect
155
    And I select "Recipients (0)" from the "jump" singleselect
158
    And I press "Award badge"
156
    And I press "Award badge"
159
    And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
157
    And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
160
    And I press "Award badge"
158
    And I press "Award badge"
Línea 168... Línea 166...
168
    And I follow "Profile" in the user menu
166
    And I follow "Profile" in the user menu
169
    Then I should see "Site Badge"
167
    Then I should see "Site Badge"
Línea 170... Línea 168...
170
 
168
 
171
  @javascript
169
  @javascript
172
  Scenario: Award course badge
170
  Scenario: Award course badge
173
    Given I log in as "teacher1"
171
    Given the following "core_badges > Badge" exists:
174
    And I am on "Course 1" course homepage
172
      | name        | Course Badge                 |
175
    And I navigate to "Badges > Add a new badge" in current page administration
173
      | course      | C1                           |
176
    And I set the following fields to these values:
174
      | description | Course badge description     |
177
      | Name | Course Badge |
175
      | image       | badges/tests/behat/badge.png |
178
      | Description | Course badge description |
176
      | status      | active                       |
179
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
177
      | type        | 2                            |
180
    And I press "Create badge"
178
    And the following "core_badges > Criteria" exists:
181
    And I set the field "type" to "Manual issue by role"
179
      | badge  | Course Badge   |
182
    And I set the field "Teacher" to "1"
180
      | role   | editingteacher |
183
    And I press "Save"
181
    And I am on the "Course 1" "course" page logged in as "teacher1"
184
    And I press "Enable access"
182
    And I navigate to "Badges" in current page administration
185
    And I press "Continue"
183
    And I follow "Course Badge"
186
    And I select "Recipients (0)" from the "jump" singleselect
184
    And I select "Recipients (0)" from the "jump" singleselect
187
    And I press "Award badge"
185
    And I press "Award badge"
188
    And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
186
    And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
189
    And I press "Award badge"
187
    And I press "Award badge"
190
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
188
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
191
    When I press "Award badge"
189
    When I press "Award badge"
192
    And I am on "Course 1" course homepage
190
    And I am on "Course 1" course homepage
193
    And I navigate to "Badges > Manage badges" in current page administration
191
    And I navigate to "Badges" in current page administration
194
    And I follow "Course Badge"
192
    And I follow "Course Badge"
195
    Then I should see "Recipients (2)"
193
    Then I should see "Recipients (2)"
196
    And I log out
194
    And I log out
197
    And I log in as "student1"
195
    And I log in as "student1"
Línea 200... Línea 198...
200
    And I click on "Course Badge" "link"
198
    And I click on "Course Badge" "link"
201
    And I should see "Course: Course 1"
199
    And I should see "Course: Course 1"
Línea 202... Línea 200...
202
 
200
 
203
  @javascript
201
  @javascript
204
  Scenario: Award badge on activity completion
202
  Scenario: Award badge on activity completion
205
    Given I log in as "teacher1"
203
    Given the following "core_badges > Badge" exists:
-
 
204
      | name        | Course Badge                 |
206
    And I am on "Course 1" course homepage
205
      | course      | C1                           |
207
    And I change window size to "large"
206
      | description | Course badge description     |
208
    And I navigate to "Badges > Add a new badge" in current page administration
207
      | image       | badges/tests/behat/badge.png |
209
    And I set the following fields to these values:
208
      | status      | 0                            |
210
      | Name | Course Badge |
209
      | type        | 2                            |
211
      | Description | Course badge description |
210
    And I am on the "Course 1" "course" page logged in as "teacher1"
212
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
211
    And I navigate to "Badges" in current page administration
-
 
212
    And I follow "Course Badge"
213
    And I press "Create badge"
213
    And I select "Criteria" from the "jump" singleselect
214
    And I set the field "type" to "Activity completion"
214
    And I set the field "type" to "Activity completion"
215
    And I set the field "Test assignment name" to "1"
215
    And I set the field "Test assignment name" to "1"
216
    And I press "Save"
216
    And I press "Save"
217
    And I press "Enable access"
217
    And I press "Enable access"
218
    When I press "Continue"
218
    And I click on "Enable" "button" in the "Confirm" "dialogue"
219
    And I log out
219
    And I log out
220
    And I log in as "student1"
220
    And I log in as "student1"
221
    And I follow "Profile" in the user menu
221
    And I follow "Profile" in the user menu
222
    And I click on "Course 1" "link" in the "region-main" "region"
222
    And I click on "Course 1" "link" in the "region-main" "region"
Línea 234... Línea 234...
234
      | course         | C1            |
234
      | course         | C1            |
235
      | name           | Music history |
235
      | name           | Music history |
236
      | section        | 1             |
236
      | section        | 1             |
237
      | completion     | 2             |
237
      | completion     | 2             |
238
      | completionview | 1             |
238
      | completionview | 1             |
239
    And I log in as "teacher1"
239
    Given the following "core_badges > Badge" exists:
-
 
240
      | name        | Course Badge                 |
-
 
241
      | course      | C1                           |
-
 
242
      | description | Course badge description     |
-
 
243
      | image       | badges/tests/behat/badge.png |
-
 
244
      | status      | 0                            |
-
 
245
      | type        | 2                            |
240
    And I am on "Course 1" course homepage
246
    And I am on the "Course 1" "course" page logged in as "teacher1"
241
    And I navigate to "Course completion" in current page administration
247
    And I navigate to "Course completion" in current page administration
242
    And I set the field "id_overall_aggregation" to "2"
248
    And I set the field "id_overall_aggregation" to "2"
243
    And I click on "Condition: Activity completion" "link"
249
    And I click on "Condition: Activity completion" "link"
244
    And I set the field "Assignment - Music history" to "1"
250
    And I set the field "Assignment - Music history" to "1"
245
    And I press "Save changes"
251
    And I press "Save changes"
246
    And I am on "Course 1" course homepage
252
    And I am on "Course 1" course homepage
247
    And I navigate to "Badges > Add a new badge" in current page administration
253
    And I navigate to "Badges" in current page administration
248
    And I set the following fields to these values:
-
 
249
      | Name | Course Badge |
254
    And I follow "Course Badge"
250
      | Description | Course badge description |
-
 
251
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
255
    And I select "Criteria" from the "jump" singleselect
252
    And I press "Create badge"
-
 
253
    And I set the field "type" to "Course completion"
256
    And I set the field "type" to "Course completion"
254
    And I set the field with xpath ".//*[contains(., 'Minimum grade required')]/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]//input[1]" to "0"
257
    And I set the field with xpath ".//*[contains(., 'Minimum grade required')]/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]//input[1]" to "0"
255
    And I press "Save"
258
    And I press "Save"
256
    And I press "Enable access"
259
    And I press "Enable access"
257
    When I press "Continue"
260
    And I click on "Enable" "button" in the "Confirm" "dialogue"
258
    And I log out
261
    And I log out
259
    And I log in as "student1"
262
    And I log in as "student1"
260
    And I follow "Profile" in the user menu
263
    And I follow "Profile" in the user menu
261
    And I click on "Course 1" "link" in the "region-main" "region"
264
    And I click on "Course 1" "link" in the "region-main" "region"
262
    Then I should not see "badges"
265
    Then I should not see "badges"
Línea 274... Línea 277...
274
    And I click on "Course 1" "link" in the "region-main" "region"
277
    And I click on "Course 1" "link" in the "region-main" "region"
275
    Then I should see "Course Badge"
278
    Then I should see "Course Badge"
Línea 276... Línea 279...
276
 
279
 
277
  @javascript
280
  @javascript
278
  Scenario: All of the selected roles can award badges
281
  Scenario: All of the selected roles can award badges
279
    Given I log in as "teacher1"
282
    Given the following "core_badges > Badge" exists:
280
    And I am on "Course 1" course homepage
-
 
281
    # Create course badge 1.
-
 
282
    And I navigate to "Badges > Add a new badge" in current page administration
283
      | name        | Course Badge 1               |
283
    And I set the following fields to these values:
-
 
284
      | Name | Course Badge 1 |
284
      | course      | C1                           |
285
      | Description | Course badge description |
285
      | description | Course badge description     |
286
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
286
      | image       | badges/tests/behat/badge.png |
287
    And I press "Create badge"
287
      | status      | active                       |
288
    And I set the field "type" to "Manual issue by role"
288
      | type        | 2                            |
289
    And I expand all fieldsets
289
    And the following "core_badges > Criteria" exists:
290
    # Set to ANY of the roles awards badge.
290
      | badge  | Course Badge 1 |
291
    And I set the field "Teacher" to "1"
291
      | role   | editingteacher |
292
    And I set the field "Any of the selected roles awards the badge" to "1"
-
 
293
    And I press "Save"
292
    And I am on the "Course 1" "course" page logged in as "teacher1"
294
    And I press "Enable access"
293
    And I navigate to "Badges" in current page administration
295
    And I press "Continue"
294
    And I follow "Course Badge 1"
296
    And I select "Recipients (0)" from the "jump" singleselect
295
    And I select "Recipients (0)" from the "jump" singleselect
297
    And I press "Award badge"
296
    And I press "Award badge"
298
    # Award course badge 1 to student 1.
297
    # Award course badge 1 to student 1.
299
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
298
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
300
    When I press "Award badge"
299
    When I press "Award badge"
301
    And I am on "Course 1" course homepage
300
    And I am on "Course 1" course homepage
302
    And I navigate to "Badges > Manage badges" in current page administration
301
    And I navigate to "Badges" in current page administration
303
    And I follow "Course Badge 1"
302
    And I follow "Course Badge 1"
304
    And I select "Recipients (1)" from the "jump" singleselect
303
    And I select "Recipients (1)" from the "jump" singleselect
305
    Then I should see "Recipients (1)"
304
    Then I should see "Recipients (1)"
306
    # Add course badge 2.
305
    # Add course badge 2.
307
    And I am on "Course 1" course homepage
306
    Given the following "core_badges > Badge" exists:
308
    And I navigate to "Badges > Add a new badge" in current page administration
307
      | name        | Course Badge 2               |
309
    And I set the following fields to these values:
308
      | course      | C1                           |
310
      | Name | Course Badge 2 |
309
      | description | Course badge description     |
-
 
310
      | image       | badges/tests/behat/badge.png |
-
 
311
      | status      | 0                            |
311
      | Description | Course badge description |
312
      | type        | 2                            |
312
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
313
    And I navigate to "Badges" in current page administration
-
 
314
    And I follow "Course Badge 2"
313
    And I press "Create badge"
315
    And I select "Criteria" from the "jump" singleselect
314
    And I set the field "type" to "Manual issue by role"
316
    And I set the field "type" to "Manual issue by role"
315
    And I expand all fieldsets
317
    And I expand all fieldsets
316
    # Set to ALL of the selected roles award badge.
318
    # Set to ALL of the selected roles award badge.
317
    And I set the field "Teacher" to "1"
319
    And I set the field "Teacher" to "1"
318
    And I set the field "All of the selected roles award the badge" to "1"
320
    And I set the field "All of the selected roles award the badge" to "1"
319
    And I press "Save"
321
    And I press "Save"
320
    And I press "Enable access"
322
    And I press "Enable access"
321
    And I press "Continue"
323
    And I click on "Enable" "button" in the "Confirm" "dialogue"
322
    And I select "Recipients (0)" from the "jump" singleselect
324
    And I select "Recipients (0)" from the "jump" singleselect
323
    And I press "Award badge"
325
    And I press "Award badge"
324
    # Award course badge 2 to student 2.
326
    # Award course badge 2 to student 2.
325
    And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
327
    And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
326
    When I press "Award badge"
328
    When I press "Award badge"
327
    And I am on "Course 1" course homepage
329
    And I am on "Course 1" course homepage
328
    And I navigate to "Badges > Manage badges" in current page administration
330
    And I navigate to "Badges" in current page administration
329
    And I follow "Course Badge 2"
331
    And I follow "Course Badge 2"
330
    And I select "Recipients (1)" from the "jump" singleselect
332
    And I select "Recipients (1)" from the "jump" singleselect
331
    Then I should see "Recipients (1)"
333
    Then I should see "Recipients (1)"
332
    And I log out
334
    And I log out
Línea 345... Línea 347...
345
    Then I should see "Course Badge 2"
347
    Then I should see "Course Badge 2"
346
    Then I should not see "Course Badge 1"
348
    Then I should not see "Course Badge 1"
Línea 347... Línea 349...
347
 
349
 
348
  @javascript
350
  @javascript
349
  Scenario: Revoke badge
351
  Scenario: Revoke badge
350
    Given I log in as "teacher1"
352
    Given the following "core_badges > Badge" exists:
351
    And I am on "Course 1" course homepage
353
      | name        | Course Badge                 |
352
    And I navigate to "Badges > Add a new badge" in current page administration
354
      | course      | C1                           |
353
    And I set the following fields to these values:
355
      | description | Course badge description     |
354
      | Name | Course Badge |
356
      | image       | badges/tests/behat/badge.png |
355
      | Description | Course badge description |
357
      | status      | active                       |
356
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
358
      | type        | 2                            |
357
    And I press "Create badge"
359
    And the following "core_badges > Criteria" exists:
358
    And I set the field "type" to "Manual issue by role"
360
      | badge  | Course Badge   |
359
    And I set the field "Teacher" to "1"
361
      | role   | editingteacher |
360
    And I press "Save"
362
    And I am on the "Course 1" "course" page logged in as "teacher1"
361
    And I press "Enable access"
363
    And I navigate to "Badges" in current page administration
362
    And I press "Continue"
364
    And I follow "Course Badge"
363
    And I select "Recipients (0)" from the "jump" singleselect
365
    And I select "Recipients (0)" from the "jump" singleselect
364
    And I press "Award badge"
366
    And I press "Award badge"
365
    And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
367
    And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
366
    And I press "Award badge"
368
    And I press "Award badge"
367
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
369
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
368
    When I press "Award badge"
370
    When I press "Award badge"
369
    And I am on "Course 1" course homepage
371
    And I am on "Course 1" course homepage
370
    And I navigate to "Badges > Manage badges" in current page administration
372
    And I navigate to "Badges" in current page administration
371
    And I follow "Course Badge"
373
    And I follow "Course Badge"
372
    Then I should see "Recipients (2)"
374
    Then I should see "Recipients (2)"
373
    And I select "Recipients (2)" from the "jump" singleselect
375
    And I select "Recipients (2)" from the "jump" singleselect
374
    And I press "Award badge"
376
    And I press "Award badge"
375
    And I set the field "existingrecipients[]" to "Student 2 (student2@example.com)"
377
    And I set the field "existingrecipients[]" to "Student 2 (student2@example.com)"
376
    And I press "Revoke badge"
378
    And I press "Revoke badge"
377
    And I set the field "existingrecipients[]" to "Student 1 (student1@example.com)"
379
    And I set the field "existingrecipients[]" to "Student 1 (student1@example.com)"
378
    When I press "Revoke badge"
380
    When I press "Revoke badge"
379
    And I am on "Course 1" course homepage
381
    And I am on "Course 1" course homepage
380
    And I navigate to "Badges > Manage badges" in current page administration
382
    And I navigate to "Badges" in current page administration
381
    And I follow "Course Badge"
383
    And I follow "Course Badge"