1 @core @core_badges @javascript
3 In order to manage badges in the system
5 I need to be able to edit, copy, enable/disable access, delete and award badges
8 Given the following "core_badges > Badge" exists:
13 | description | Test badge description |
14 | image | badges/tests/behat/badge.png |
15 | imageauthorurl | http://author.example.com |
16 | imagecaption | Test caption image |
18 Scenario: Copy a badge
19 Given I log in as "admin"
20 And I navigate to "Badges > Manage badges" in site administration
21 And I press "Copy" action in the "Badge #1" report row
22 And I should see "Copy of Badge #1"
23 And I press "Save changes"
24 And I click on "Back" "button"
25 Then the following should exist in the "reportbuilder-table" table:
26 | Name | Version | Badge status |
27 | Badge #1 | 1.0 | Not available |
28 | Copy of Badge #1 | 1.0 | Not available |
30 Scenario: Edit a badge
31 Given I log in as "admin"
32 And I navigate to "Badges > Manage badges" in site administration
33 And I press "Edit" action in the "Badge #1" report row
34 And I set the following fields to these values:
35 | Name | New Badge #1 |
37 And I press "Save changes"
38 And I click on "Back" "button"
39 Then the following should exist in the "reportbuilder-table" table:
40 | Name | Version | Badge status |
41 | New Badge #1 | 1.1 | Not available |
43 Scenario: Delete a badge
44 Given I log in as "admin"
45 And I navigate to "Badges > Manage badges" in site administration
46 And I press "Delete" action in the "Badge #1" report row
47 And I press "Delete and remove existing issued badges"
48 Then I should see "There are currently no badges available for users to earn"
50 Scenario Outline: Filter managed badges
51 Given the following "core_badges > Badges" exist:
52 | name | status | version |
53 | Badge #2 | 1 | 2.0 |
54 And I log in as "admin"
55 When I navigate to "Badges > Manage badges" in site administration
56 And I click on "Filters" "button"
57 And I set the following fields in the "<filter>" "core_reportbuilder > Filter" to these values:
58 | <filter> operator | Is equal to |
59 | <filter> value | <value> |
60 And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
61 Then I should see "Filters applied"
62 And I should see "Badge #1" in the "Badges" "table"
63 And I should not see "Badge #2" in the "Badges" "table"
68 | Badge status | Not available |
70 Scenario: Enable and disable access to a badge
71 Given I log in as "admin"
72 And I navigate to "Badges > Manage badges" in site administration
73 And I press "Edit" action in the "Badge #1" report row
74 And I select "Criteria" from the "jump" singleselect
75 And I set the field "type" to "Manual issue by role"
76 And I set the field "Manager" to "1"
78 And I navigate to "Badges > Manage badges" in site administration
79 And I press "Enable access" action in the "Badge #1" report row
80 And I should see "Changes in badge access"
81 And I press "Continue"
82 And I should see "Access to the badges was successfully enabled"
83 Then the following should exist in the "reportbuilder-table" table:
84 | Name | Badge status |
85 | Badge #1 | Available |
86 And I press "Disable access" action in the "Badge #1" report row
87 And I should see "Access to the badges was successfully disabled"
88 And the following should exist in the "reportbuilder-table" table:
89 | Name | Badge status |
90 | Badge #1 | Not available |
92 Scenario: Award a badge
93 Given I log in as "admin"
94 And I navigate to "Badges > Manage badges" in site administration
95 And I press "Edit" action in the "Badge #1" report row
96 And I select "Criteria" from the "jump" singleselect
97 And I set the field "type" to "Manual issue by role"
98 And I set the field "Manager" to "1"
100 And I navigate to "Badges > Manage badges" in site administration
101 And I press "Enable access" action in the "Badge #1" report row
102 And I press "Continue"
103 And I press "Award badge" action in the "Badge #1" report row
104 And I set the field "potentialrecipients[]" to "Admin User (moodle@example.com)"
105 And I press "Award badge"
106 And I navigate to "Badges > Manage badges" in site administration
107 Then the following should exist in the "reportbuilder-table" table:
108 | Name | Badge status | Recipients |
109 | Badge #1 | Available | 1 |