1 |
efrain |
1 |
@core @core_badges
|
|
|
2 |
Feature: Add badges to the system
|
|
|
3 |
In order to give badges to users for their achievements
|
|
|
4 |
As an admin
|
|
|
5 |
I need to manage badges in the system
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given I am on homepage
|
|
|
9 |
And I log in as "admin"
|
|
|
10 |
|
|
|
11 |
@javascript
|
|
|
12 |
Scenario: Accessing the badges
|
|
|
13 |
And I turn editing mode on
|
|
|
14 |
And the following config values are set as admin:
|
|
|
15 |
| unaddableblocks | | theme_boost|
|
|
|
16 |
# TODO MDL-57120 site "Badges" link not accessible without navigation block.
|
|
|
17 |
And I add the "Navigation" block if not present
|
|
|
18 |
And I click on "Site pages" "list_item" in the "Navigation" "block"
|
|
|
19 |
Given I click on "Site badges" "link" in the "Navigation" "block"
|
1441 |
ariadna |
20 |
Then I should see "There are no matching badges available for users to earn."
|
1 |
efrain |
21 |
|
|
|
22 |
@javascript @_file_upload
|
1441 |
ariadna |
23 |
Scenario: Add a site badge
|
|
|
24 |
Given the following config values are set as admin:
|
|
|
25 |
| badges_defaultissuername | Test Badge Site |
|
|
|
26 |
| badges_defaultissuercontact | testuser@example.com |
|
1 |
efrain |
27 |
And I navigate to "Badges > Add a new badge" in site administration
|
1441 |
ariadna |
28 |
And the field "issuername" matches value "Test Badge Site"
|
|
|
29 |
And the field "Email" matches value "testuser@example.com"
|
1 |
efrain |
30 |
And I set the following fields to these values:
|
1441 |
ariadna |
31 |
| Name | Test badge with 'apostrophe' and other friends (<>&@#) |
|
|
|
32 |
| Version | v1 |
|
|
|
33 |
| Language | English |
|
|
|
34 |
| Description | Test badge description |
|
|
|
35 |
| Image caption | Test caption image |
|
|
|
36 |
| Tags | Math, Physics |
|
|
|
37 |
| Email | issuer@example.com |
|
1 |
efrain |
38 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
39 |
When I press "Create badge"
|
|
|
40 |
Then I should see "Edit details"
|
|
|
41 |
And I should see "Test badge with 'apostrophe' and other friends (&@#)"
|
|
|
42 |
And I should see "Endorsement"
|
|
|
43 |
And I should see "Related badges (0)"
|
|
|
44 |
And I should see "Alignments (0)"
|
|
|
45 |
And I should not see "Create badge"
|
|
|
46 |
And I select "Overview" from the "jump" singleselect
|
|
|
47 |
And I should see "Issuer details"
|
|
|
48 |
And I should see "Test Badge Site"
|
1441 |
ariadna |
49 |
And I should see "issuer@example.com"
|
|
|
50 |
And I should not see "testuser@example.com"
|
1 |
efrain |
51 |
And I should see "Tags"
|
|
|
52 |
And I should see "Math"
|
|
|
53 |
And I should see "Physics"
|
|
|
54 |
And I navigate to "Badges > Manage badges" in site administration
|
1441 |
ariadna |
55 |
And I should not see "There are no matching badges available for users to earn."
|
1 |
efrain |
56 |
|
|
|
57 |
@javascript @_file_upload
|
|
|
58 |
Scenario: Add a badge related
|
|
|
59 |
Given I navigate to "Badges > Add a new badge" in site administration
|
|
|
60 |
And I set the following fields to these values:
|
|
|
61 |
| Name | Test Badge 1 |
|
|
|
62 |
| Version | v1 |
|
|
|
63 |
| Language | French |
|
|
|
64 |
| Description | Test badge related description |
|
|
|
65 |
| Image caption | Test caption image |
|
|
|
66 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
67 |
And I press "Create badge"
|
|
|
68 |
And I wait until the page is ready
|
1441 |
ariadna |
69 |
And I navigate to "Badges > Add a new badge" in site administration
|
1 |
efrain |
70 |
And I set the following fields to these values:
|
|
|
71 |
| Name | Test Badge 2 |
|
|
|
72 |
| Version | v2 |
|
|
|
73 |
| Language | English |
|
|
|
74 |
| Description | Test badge description |
|
|
|
75 |
| Image caption | Test caption image |
|
|
|
76 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
77 |
And I press "Create badge"
|
|
|
78 |
And I select "Related badges (0)" from the "jump" singleselect
|
|
|
79 |
And I should see "This badge does not have any related badges."
|
|
|
80 |
And I press "Add related badge"
|
|
|
81 |
And I follow "Related badges"
|
|
|
82 |
And I wait until the page is ready
|
|
|
83 |
And I follow "Related badges"
|
|
|
84 |
And I set the field "relatedbadgeids[]" to "Test Badge 1 (version: v1, language: French, Site badges)"
|
|
|
85 |
When I press "Save changes"
|
|
|
86 |
Then I should see "Related badges (1)"
|
|
|
87 |
|
|
|
88 |
@javascript @_file_upload
|
|
|
89 |
Scenario: Endorsement for Badge
|
|
|
90 |
Given I navigate to "Badges > Add a new badge" in site administration
|
|
|
91 |
And I set the following fields to these values:
|
|
|
92 |
| Name | Test Badge Enrolment |
|
|
|
93 |
| Version | v1 |
|
|
|
94 |
| Language | English |
|
|
|
95 |
| Description | Test badge description |
|
|
|
96 |
| Image caption | Test caption image |
|
|
|
97 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
98 |
When I press "Create badge"
|
|
|
99 |
Then I should see "Edit details"
|
|
|
100 |
And I should see "Endorsement"
|
|
|
101 |
And I select "Endorsement" from the "jump" singleselect
|
|
|
102 |
And I set the following fields to these values:
|
1441 |
ariadna |
103 |
| Endorser name | Endorser |
|
|
|
104 |
| Email | endorsement@example.com |
|
|
|
105 |
| URL | http://example.com |
|
|
|
106 |
| Claim URL | http://claimurl.example.com |
|
|
|
107 |
| Endorsement comment | Test Endorsement comment |
|
1 |
efrain |
108 |
And I press "Save changes"
|
|
|
109 |
Then I should see "Changes saved"
|
|
|
110 |
|
|
|
111 |
@javascript @_file_upload
|
|
|
112 |
Scenario: Alignments for Badge
|
|
|
113 |
Given I navigate to "Badges > Add a new badge" in site administration
|
|
|
114 |
And I set the following fields to these values:
|
|
|
115 |
| Name | Test Badge |
|
|
|
116 |
| Version | v1 |
|
|
|
117 |
| Language | English |
|
|
|
118 |
| Description | Test badge description |
|
|
|
119 |
| Image caption | Test caption image |
|
|
|
120 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
121 |
When I press "Create badge"
|
|
|
122 |
Then I should see "Test Badge"
|
|
|
123 |
And I should see "Endorsement"
|
|
|
124 |
And I select "Alignments (0)" from the "jump" singleselect
|
|
|
125 |
And I should see "This badge does not have any external skills or standards specified."
|
|
|
126 |
And I press "Add external skill or standard"
|
|
|
127 |
And I set the following fields to these values:
|
|
|
128 |
| Name | Test Badge Alignments |
|
|
|
129 |
| URL | https://alignments.example.com |
|
|
|
130 |
| Description | Test Badge Alignments description |
|
|
|
131 |
When I press "Save changes"
|
|
|
132 |
And I should see "Alignments (1)"
|
|
|
133 |
|
|
|
134 |
@javascript @_file_upload
|
|
|
135 |
Scenario: Add a badge from Site badges section
|
|
|
136 |
Given I turn editing mode on
|
|
|
137 |
And the following config values are set as admin:
|
|
|
138 |
| unaddableblocks | | theme_boost|
|
|
|
139 |
# TODO MDL-57120 site "Badges" link not accessible without navigation block.
|
|
|
140 |
And I add the "Navigation" block if not present
|
|
|
141 |
When I click on "Site pages" "list_item" in the "Navigation" "block"
|
|
|
142 |
And I click on "Site badges" "link" in the "Navigation" "block"
|
|
|
143 |
Then I should see "Add a new badge"
|
|
|
144 |
# Add a badge.
|
|
|
145 |
When I press "Add a new badge"
|
|
|
146 |
And I set the following fields to these values:
|
|
|
147 |
| Name | Test badge with 'apostrophe' and other friends (<>&@#) 2 |
|
|
|
148 |
| Version | v1 |
|
|
|
149 |
| Language | English |
|
|
|
150 |
| Description | Test badge description |
|
|
|
151 |
| Image caption | Test caption image |
|
|
|
152 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
153 |
And I press "Create badge"
|
|
|
154 |
Then I should see "Edit details"
|
|
|
155 |
And I should see "Test badge with 'apostrophe' and other friends (&@#) 2"
|
|
|
156 |
And I should see "Endorsement"
|
|
|
157 |
And I should see "Related badges (0)"
|
|
|
158 |
And I should see "Alignments (0)"
|
|
|
159 |
And I should not see "Create badge"
|
|
|
160 |
And I navigate to "Badges > Manage badges" in site administration
|
1441 |
ariadna |
161 |
And I should not see "There are no matching badges available for users to earn."
|
1 |
efrain |
162 |
# See buttons from the "Site badges" page.
|
|
|
163 |
And I am on homepage
|
|
|
164 |
When I click on "Site pages" "list_item" in the "Navigation" "block"
|
|
|
165 |
And I click on "Site badges" "link" in the "Navigation" "block"
|
1441 |
ariadna |
166 |
Then I should see "Add a new badge"
|
1 |
efrain |
167 |
|
|
|
168 |
@javascript @_file_upload
|
1441 |
ariadna |
169 |
Scenario: Edit a site badge
|
|
|
170 |
Given the following "core_badges > Badge" exists:
|
|
|
171 |
| name | Testing site badge |
|
|
|
172 |
| status | inactive |
|
|
|
173 |
| version | 1 |
|
|
|
174 |
| language | ca |
|
|
|
175 |
| description | Test badge description |
|
|
|
176 |
| image | badges/tests/behat/badge.png |
|
|
|
177 |
| imagecaption | My caption image |
|
|
|
178 |
| issuercontact | testuser@example.com |
|
|
|
179 |
And the following "core_badges > Criterias" exist:
|
|
|
180 |
| badge | role |
|
|
|
181 |
| Testing site badge | editingteacher |
|
|
|
182 |
And I navigate to "Badges > Manage badges" in site administration
|
|
|
183 |
When I press "Edit" action in the "Testing site badge" report row
|
|
|
184 |
And I should see "Testing site badge"
|
|
|
185 |
And the field "Email" matches value "testuser@example.com"
|
1 |
efrain |
186 |
And I set the following fields to these values:
|
1441 |
ariadna |
187 |
| Name | Test badge with 'apostrophe' and other friends (<>&@#) |
|
|
|
188 |
| Version | secondversion |
|
|
|
189 |
| Language | English |
|
|
|
190 |
| Description | Modified test badge description |
|
|
|
191 |
| Image caption | Test caption image |
|
|
|
192 |
| Tags | Math, History |
|
|
|
193 |
| Email | issuer@invalid.cat |
|
1 |
efrain |
194 |
And I press "Save changes"
|
|
|
195 |
And I select "Overview" from the "jump" singleselect
|
1441 |
ariadna |
196 |
And I expand all fieldsets
|
|
|
197 |
Then I should see "Test badge with 'apostrophe' and other friends (&@#)"
|
|
|
198 |
And I should not see "Testing site badge"
|
|
|
199 |
And I should see "secondversion"
|
1 |
efrain |
200 |
And I should not see "firstversion"
|
|
|
201 |
And I should see "Math"
|
|
|
202 |
And I should see "History"
|
1441 |
ariadna |
203 |
And I should see "issuer@invalid.cat"
|
|
|
204 |
And I should not see "testuser@example.com"
|
|
|
205 |
|
|
|
206 |
Scenario: Default value for issuer name
|
|
|
207 |
When I navigate to "Badges > Add a new badge" in site administration
|
|
|
208 |
Then the field "issuername" matches value "Acceptance test site"
|
|
|
209 |
But the following config values are set as admin:
|
|
|
210 |
| badges_defaultissuername | Test Badge Site |
|
|
|
211 |
And I navigate to "Badges > Add a new badge" in site administration
|
|
|
212 |
And the field "issuername" matches value "Test Badge Site"
|