1 |
efrain |
1 |
@block @block_badges @core_badges @_file_upload @javascript
|
|
|
2 |
Feature: Enable Block Badges in a course
|
|
|
3 |
In order to enable the badges block in a course
|
|
|
4 |
As a teacher
|
|
|
5 |
I can add badges block to a course
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email | idnumber |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | category |
|
|
|
13 |
| Course 1 | C1 | 0 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
And I log in as "teacher1"
|
|
|
18 |
And I am on "Course 1" course homepage
|
|
|
19 |
# Issue badge 1 of 2
|
|
|
20 |
And I navigate to "Badges > Add a new badge" in current page administration
|
|
|
21 |
And I set the following fields to these values:
|
|
|
22 |
| id_name | Badge 1 |
|
|
|
23 |
| id_description | Badge 1 |
|
|
|
24 |
And I upload "blocks/badges/tests/fixtures/badge.png" file to "Image" filemanager
|
|
|
25 |
And I press "Create badge"
|
|
|
26 |
And I select "Manual issue by role" from the "Add badge criteria" singleselect
|
|
|
27 |
And I set the field "Teacher" to "1"
|
|
|
28 |
And I press "Save"
|
|
|
29 |
And I press "Enable access"
|
|
|
30 |
And I press "Continue"
|
|
|
31 |
And I select "Recipients (0)" from the "jump" singleselect
|
|
|
32 |
And I press "Award badge"
|
|
|
33 |
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
|
|
34 |
And I press "Award badge"
|
|
|
35 |
# Issue Badge 2 of 2
|
|
|
36 |
And I am on "Course 1" course homepage
|
|
|
37 |
And I navigate to "Badges > Add a new badge" in current page administration
|
|
|
38 |
And I set the following fields to these values:
|
|
|
39 |
| id_name | Badge 2 |
|
|
|
40 |
| id_description | Badge 2 |
|
|
|
41 |
And I upload "blocks/badges/tests/fixtures/badge.png" file to "Image" filemanager
|
|
|
42 |
And I press "Create badge"
|
|
|
43 |
And I select "Manual issue by role" from the "Add badge criteria" singleselect
|
|
|
44 |
And I set the field "Teacher" to "1"
|
|
|
45 |
And I press "Save"
|
|
|
46 |
And I press "Enable access"
|
|
|
47 |
And I press "Continue"
|
|
|
48 |
And I select "Recipients (0)" from the "jump" singleselect
|
|
|
49 |
And I press "Award badge"
|
|
|
50 |
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
|
|
51 |
And I press "Award badge"
|
|
|
52 |
And I log out
|
|
|
53 |
|
|
|
54 |
Scenario: Add the recent badges block to a course.
|
|
|
55 |
Given I log in as "teacher1"
|
|
|
56 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
57 |
When I add the "Latest badges" block
|
|
|
58 |
Then I should see "Badge 1" in the "Latest badges" "block"
|
|
|
59 |
And I should see "Badge 2" in the "Latest badges" "block"
|
|
|
60 |
|
|
|
61 |
Scenario: Add the recent badges block to a course and limit it to only display 1 badge.
|
|
|
62 |
Given I log in as "teacher1"
|
|
|
63 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
64 |
When I add the "Latest badges" block
|
|
|
65 |
And I configure the "Latest badges" block
|
|
|
66 |
And I set the following fields to these values:
|
|
|
67 |
| Number of latest badges to display | 1 |
|
|
|
68 |
And I press "Save changes"
|
|
|
69 |
Then I should see "Badge 2" in the "Latest badges" "block"
|
|
|
70 |
And I should not see "Badge 1" in the "Latest badges" "block"
|