1 |
efrain |
1 |
@mod @mod_customcert
|
|
|
2 |
Feature: Being able to manage elements in a certificate template
|
|
|
3 |
In order to ensure managing elements in a certificate template works as expected
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to manage elements in a certificate template
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category |
|
|
|
10 |
| Course 1 | C1 | 0 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
14 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| teacher2 | C1 | editingteacher |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | name | intro | course | idnumber |
|
|
|
21 |
| assign | Assignment 1 | Assignment 1 intro | C1 | assign1 |
|
|
|
22 |
| assign | Assignment 2 | Assignment 2 intro | C1 | assign2 |
|
|
|
23 |
| customcert | Custom certificate 1 | Custom certificate 1 intro | C1 | customcert1 |
|
|
|
24 |
And I log in as "teacher1"
|
|
|
25 |
And I am on "Course 1" course homepage
|
|
|
26 |
And I follow "Custom certificate 1"
|
|
|
27 |
And I navigate to "Edit certificate" in current page administration
|
|
|
28 |
|
|
|
29 |
Scenario: Add and edit elements in a certificate template
|
|
|
30 |
# Background image.
|
|
|
31 |
And I add the element "Background image" to page "1" of the "Custom certificate 1" certificate template
|
|
|
32 |
And I press "Save changes"
|
|
|
33 |
And I should see "Background image" in the "elementstable" "table"
|
|
|
34 |
# Border.
|
|
|
35 |
And I add the element "Border" to page "1" of the "Custom certificate 1" certificate template
|
|
|
36 |
And I set the following fields to these values:
|
|
|
37 |
| Width | 2 |
|
|
|
38 |
| Colour | #045ECD |
|
|
|
39 |
And I press "Save changes"
|
|
|
40 |
And I should see "Border" in the "elementstable" "table"
|
|
|
41 |
And I click on ".edit-icon" "css_element" in the "Border" "table_row"
|
|
|
42 |
And the following fields match these values:
|
|
|
43 |
| Width | 2 |
|
|
|
44 |
| Colour | #045ECD |
|
|
|
45 |
And I press "Save changes"
|
|
|
46 |
# Category name.
|
|
|
47 |
And I add the element "Category name" to page "1" of the "Custom certificate 1" certificate template
|
|
|
48 |
And I set the following fields to these values:
|
|
|
49 |
| Font | Helvetica |
|
|
|
50 |
| Size | 20 |
|
|
|
51 |
| Colour | #045ECD |
|
|
|
52 |
| Width | 20 |
|
|
|
53 |
| Reference point location | Top left |
|
|
|
54 |
And I press "Save changes"
|
|
|
55 |
And I should see "Category name" in the "elementstable" "table"
|
|
|
56 |
And I click on ".edit-icon" "css_element" in the "Category name" "table_row"
|
|
|
57 |
And the following fields match these values:
|
|
|
58 |
| Font | Helvetica |
|
|
|
59 |
| Size | 20 |
|
|
|
60 |
| Colour | #045ECD |
|
|
|
61 |
| Width | 20 |
|
|
|
62 |
| Reference point location | Top left |
|
|
|
63 |
And I press "Save changes"
|
|
|
64 |
# Code.
|
|
|
65 |
And I add the element "Code" to page "1" of the "Custom certificate 1" certificate template
|
|
|
66 |
And I set the following fields to these values:
|
|
|
67 |
| Font | Helvetica |
|
|
|
68 |
| Size | 20 |
|
|
|
69 |
| Colour | #045ECD |
|
|
|
70 |
| Width | 20 |
|
|
|
71 |
| Reference point location | Top left |
|
|
|
72 |
And I press "Save changes"
|
|
|
73 |
And I should see "Code" in the "elementstable" "table"
|
|
|
74 |
And I click on ".edit-icon" "css_element" in the "Code" "table_row"
|
|
|
75 |
And the following fields match these values:
|
|
|
76 |
| Font | Helvetica |
|
|
|
77 |
| Size | 20 |
|
|
|
78 |
| Colour | #045ECD |
|
|
|
79 |
| Width | 20 |
|
|
|
80 |
| Reference point location | Top left |
|
|
|
81 |
And I press "Save changes"
|
|
|
82 |
# Course field.
|
|
|
83 |
And I add the element "Course field" to page "1" of the "Custom certificate 1" certificate template
|
|
|
84 |
And I set the following fields to these values:
|
|
|
85 |
| Font | Helvetica |
|
|
|
86 |
| Size | 20 |
|
|
|
87 |
| Colour | #045ECD |
|
|
|
88 |
| Width | 20 |
|
|
|
89 |
| Reference point location | Top left |
|
|
|
90 |
And I press "Save changes"
|
|
|
91 |
And I should see "Course field" in the "elementstable" "table"
|
|
|
92 |
And I click on ".edit-icon" "css_element" in the "Course field" "table_row"
|
|
|
93 |
And the following fields match these values:
|
|
|
94 |
| Font | Helvetica |
|
|
|
95 |
| Size | 20 |
|
|
|
96 |
| Colour | #045ECD |
|
|
|
97 |
| Width | 20 |
|
|
|
98 |
| Reference point location | Top left |
|
|
|
99 |
And I press "Save changes"
|
|
|
100 |
# Course name.
|
|
|
101 |
And I add the element "Course name" to page "1" of the "Custom certificate 1" certificate template
|
|
|
102 |
And I set the following fields to these values:
|
|
|
103 |
| Font | Helvetica |
|
|
|
104 |
| Type | Short name |
|
|
|
105 |
| Size | 20 |
|
|
|
106 |
| Colour | #045ECD |
|
|
|
107 |
| Width | 20 |
|
|
|
108 |
| Reference point location | Top left |
|
|
|
109 |
And I press "Save changes"
|
|
|
110 |
And I should see "Course name" in the "elementstable" "table"
|
|
|
111 |
And I click on ".edit-icon" "css_element" in the "Course name" "table_row"
|
|
|
112 |
And the following fields match these values:
|
|
|
113 |
| Font | Helvetica |
|
|
|
114 |
| Type | Short name |
|
|
|
115 |
| Size | 20 |
|
|
|
116 |
| Colour | #045ECD |
|
|
|
117 |
| Width | 20 |
|
|
|
118 |
| Reference point location | Top left |
|
|
|
119 |
And I press "Save changes"
|
|
|
120 |
# Date.
|
|
|
121 |
And I add the element "Date" to page "1" of the "Custom certificate 1" certificate template
|
|
|
122 |
And I set the following fields to these values:
|
|
|
123 |
| Date item | Course start date |
|
|
|
124 |
| Date format | 2 |
|
|
|
125 |
| Font | Helvetica |
|
|
|
126 |
| Size | 20 |
|
|
|
127 |
| Colour | #045ECD |
|
|
|
128 |
| Width | 20 |
|
|
|
129 |
| Reference point location | Top left |
|
|
|
130 |
And I press "Save changes"
|
|
|
131 |
And I should see "Date" in the "elementstable" "table"
|
|
|
132 |
And I click on ".edit-icon" "css_element" in the "Date" "table_row"
|
|
|
133 |
And the following fields match these values:
|
|
|
134 |
| Date item | Course start date |
|
|
|
135 |
| Date format | 2 |
|
|
|
136 |
| Font | Helvetica |
|
|
|
137 |
| Size | 20 |
|
|
|
138 |
| Colour | #045ECD |
|
|
|
139 |
| Width | 20 |
|
|
|
140 |
| Reference point location | Top left |
|
|
|
141 |
And I press "Save changes"
|
|
|
142 |
# Date range.
|
|
|
143 |
And I add the element "Date range" to page "1" of the "Custom certificate 1" certificate template
|
|
|
144 |
And I set the following fields to these values:
|
|
|
145 |
| Date item | Course start date |
|
|
|
146 |
| Font | Helvetica |
|
|
|
147 |
| Size | 20 |
|
|
|
148 |
| Colour | #045ECD |
|
|
|
149 |
| Width | 20 |
|
|
|
150 |
| Reference point location | Top left |
|
|
|
151 |
| Fallback string | {{range_first_year}} |
|
|
|
152 |
| id_startdate_0_day | 24 |
|
|
|
153 |
| id_startdate_0_month | October |
|
|
|
154 |
| id_startdate_0_year | 2015 |
|
|
|
155 |
| id_enddate_0_day | 21 |
|
|
|
156 |
| id_enddate_0_month | March |
|
|
|
157 |
| id_enddate_0_year | 2016 |
|
|
|
158 |
| String | Oct to March |
|
|
|
159 |
And I press "Save changes"
|
|
|
160 |
And I should see "Date range" in the "elementstable" "table"
|
|
|
161 |
And I click on ".edit-icon" "css_element" in the "Date range" "table_row"
|
|
|
162 |
And the following fields match these values:
|
|
|
163 |
| Date item | Course start date |
|
|
|
164 |
| Font | Helvetica |
|
|
|
165 |
| Size | 20 |
|
|
|
166 |
| Colour | #045ECD |
|
|
|
167 |
| Width | 20 |
|
|
|
168 |
| Reference point location | Top left |
|
|
|
169 |
| Fallback string | {{range_first_year}} |
|
|
|
170 |
| id_startdate_0_day | 24 |
|
|
|
171 |
| id_startdate_0_month | October |
|
|
|
172 |
| id_startdate_0_year | 2015 |
|
|
|
173 |
| id_enddate_0_day | 21 |
|
|
|
174 |
| id_enddate_0_month | March |
|
|
|
175 |
| id_enddate_0_year | 2016 |
|
|
|
176 |
| String | Oct to March |
|
|
|
177 |
And I press "Save changes"
|
|
|
178 |
# Digital signature.
|
|
|
179 |
And I add the element "Digital signature" to page "1" of the "Custom certificate 1" certificate template
|
|
|
180 |
And I set the following fields to these values:
|
|
|
181 |
| Signature name | This is the signature name |
|
|
|
182 |
| Signature password | Some awesome password |
|
|
|
183 |
| Signature location | Mordor |
|
|
|
184 |
| Signature reason | Meh, felt like it. |
|
|
|
185 |
| Signature contact info | Sauron |
|
|
|
186 |
| Width | 25 |
|
|
|
187 |
| Height | 15 |
|
|
|
188 |
And I press "Save changes"
|
|
|
189 |
And I should see "Digital signature" in the "elementstable" "table"
|
|
|
190 |
And I click on ".edit-icon" "css_element" in the "Digital signature" "table_row"
|
|
|
191 |
And the following fields match these values:
|
|
|
192 |
| Signature name | This is the signature name |
|
|
|
193 |
| Signature password | Some awesome password |
|
|
|
194 |
| Signature location | Mordor |
|
|
|
195 |
| Signature reason | Meh, felt like it. |
|
|
|
196 |
| Signature contact info | Sauron |
|
|
|
197 |
| Width | 25 |
|
|
|
198 |
| Height | 15 |
|
|
|
199 |
And I press "Save changes"
|
|
|
200 |
# Grade.
|
|
|
201 |
And I add the element "Grade" to page "1" of the "Custom certificate 1" certificate template
|
|
|
202 |
And I set the following fields to these values:
|
|
|
203 |
| Grade item | Activity : Assignment 1 |
|
|
|
204 |
| Grade format | Percentage |
|
|
|
205 |
| Font | Helvetica |
|
|
|
206 |
| Size | 20 |
|
|
|
207 |
| Colour | #045ECD |
|
|
|
208 |
| Width | 20 |
|
|
|
209 |
| Reference point location | Top left |
|
|
|
210 |
And I press "Save changes"
|
|
|
211 |
And I should see "Grade" in the "elementstable" "table"
|
|
|
212 |
And I click on ".edit-icon" "css_element" in the "Grade" "table_row"
|
|
|
213 |
And the following fields match these values:
|
|
|
214 |
| Grade item | Activity : Assignment 1 |
|
|
|
215 |
| Grade format | Percentage |
|
|
|
216 |
| Font | Helvetica |
|
|
|
217 |
| Size | 20 |
|
|
|
218 |
| Colour | #045ECD |
|
|
|
219 |
| Width | 20 |
|
|
|
220 |
| Reference point location | Top left |
|
|
|
221 |
And I press "Save changes"
|
|
|
222 |
# Grade item name.
|
|
|
223 |
And I add the element "Grade item name" to page "1" of the "Custom certificate 1" certificate template
|
|
|
224 |
And I set the following fields to these values:
|
|
|
225 |
| Grade item | Activity : Assignment 2 |
|
|
|
226 |
| Font | Helvetica |
|
|
|
227 |
| Size | 20 |
|
|
|
228 |
| Colour | #045ECD |
|
|
|
229 |
| Width | 20 |
|
|
|
230 |
| Reference point location | Top left |
|
|
|
231 |
And I press "Save changes"
|
|
|
232 |
And I should see "Grade item name" in the "elementstable" "table"
|
|
|
233 |
And I click on ".edit-icon" "css_element" in the "Grade item name" "table_row"
|
|
|
234 |
And the following fields match these values:
|
|
|
235 |
| Grade item | Activity : Assignment 2 |
|
|
|
236 |
| Font | Helvetica |
|
|
|
237 |
| Size | 20 |
|
|
|
238 |
| Colour | #045ECD |
|
|
|
239 |
| Width | 20 |
|
|
|
240 |
| Reference point location | Top left |
|
|
|
241 |
And I press "Save changes"
|
|
|
242 |
# Image.
|
|
|
243 |
And I add the element "Image" to page "1" of the "Custom certificate 1" certificate template
|
|
|
244 |
And I set the following fields to these values:
|
|
|
245 |
| Width | 25 |
|
|
|
246 |
| Height | 15 |
|
|
|
247 |
| Alpha channel | 0.7 |
|
|
|
248 |
And I press "Save changes"
|
|
|
249 |
And I should see "Image" in the "elementstable" "table"
|
|
|
250 |
And I click on ".edit-icon" "css_element" in the "Image" "table_row"
|
|
|
251 |
And the following fields match these values:
|
|
|
252 |
| Width | 25 |
|
|
|
253 |
| Height | 15 |
|
|
|
254 |
| Alpha channel | 0.7 |
|
|
|
255 |
And I press "Save changes"
|
|
|
256 |
# Student name.
|
|
|
257 |
And I add the element "Student name" to page "1" of the "Custom certificate 1" certificate template
|
|
|
258 |
And I set the following fields to these values:
|
|
|
259 |
| Font | Helvetica |
|
|
|
260 |
| Size | 20 |
|
|
|
261 |
| Colour | #045ECD |
|
|
|
262 |
| Width | 20 |
|
|
|
263 |
| Reference point location | Top left |
|
|
|
264 |
And I press "Save changes"
|
|
|
265 |
And I should see "Student name" in the "elementstable" "table"
|
|
|
266 |
And I click on ".edit-icon" "css_element" in the "Student name" "table_row"
|
|
|
267 |
And the following fields match these values:
|
|
|
268 |
| Font | Helvetica |
|
|
|
269 |
| Size | 20 |
|
|
|
270 |
| Colour | #045ECD |
|
|
|
271 |
| Width | 20 |
|
|
|
272 |
| Reference point location | Top left |
|
|
|
273 |
And I press "Save changes"
|
|
|
274 |
# Teacher name.
|
|
|
275 |
And I add the element "Teacher name" to page "1" of the "Custom certificate 1" certificate template
|
|
|
276 |
And I set the following fields to these values:
|
|
|
277 |
| Teacher | Teacher 2 |
|
|
|
278 |
| Font | Helvetica |
|
|
|
279 |
| Size | 20 |
|
|
|
280 |
| Colour | #045ECD |
|
|
|
281 |
| Width | 20 |
|
|
|
282 |
| Reference point location | Top left |
|
|
|
283 |
And I press "Save changes"
|
|
|
284 |
And I should see "Teacher name" in the "elementstable" "table"
|
|
|
285 |
And I click on ".edit-icon" "css_element" in the "Teacher name" "table_row"
|
|
|
286 |
And the following fields match these values:
|
|
|
287 |
| Teacher | Teacher 2 |
|
|
|
288 |
| Font | Helvetica |
|
|
|
289 |
| Size | 20 |
|
|
|
290 |
| Colour | #045ECD |
|
|
|
291 |
| Width | 20 |
|
|
|
292 |
| Reference point location | Top left |
|
|
|
293 |
And I press "Save changes"
|
|
|
294 |
# Text.
|
|
|
295 |
And I add the element "Text" to page "1" of the "Custom certificate 1" certificate template
|
|
|
296 |
And I set the following fields to these values:
|
|
|
297 |
| Text | Test this |
|
|
|
298 |
| Font | Helvetica |
|
|
|
299 |
| Size | 20 |
|
|
|
300 |
| Colour | #045ECD |
|
|
|
301 |
| Width | 20 |
|
|
|
302 |
| Reference point location | Top left |
|
|
|
303 |
And I press "Save changes"
|
|
|
304 |
And I should see "Text" in the "elementstable" "table"
|
|
|
305 |
And I click on ".edit-icon" "css_element" in the "Text" "table_row"
|
|
|
306 |
And the following fields match these values:
|
|
|
307 |
| Text | Test this |
|
|
|
308 |
| Font | Helvetica |
|
|
|
309 |
| Size | 20 |
|
|
|
310 |
| Colour | #045ECD |
|
|
|
311 |
| Width | 20 |
|
|
|
312 |
| Reference point location | Top left |
|
|
|
313 |
And I press "Save changes"
|
|
|
314 |
# User field.
|
|
|
315 |
And I add the element "User field" to page "1" of the "Custom certificate 1" certificate template
|
|
|
316 |
And I set the following fields to these values:
|
|
|
317 |
| User field | Country |
|
|
|
318 |
| Font | Helvetica |
|
|
|
319 |
| Size | 20 |
|
|
|
320 |
| Colour | #045ECD |
|
|
|
321 |
| Width | 20 |
|
|
|
322 |
| Reference point location | Top left |
|
|
|
323 |
And I press "Save changes"
|
|
|
324 |
And I should see "User field" in the "elementstable" "table"
|
|
|
325 |
And I click on ".edit-icon" "css_element" in the "User field" "table_row"
|
|
|
326 |
And the following fields match these values:
|
|
|
327 |
| User field | Country |
|
|
|
328 |
| Font | Helvetica |
|
|
|
329 |
| Size | 20 |
|
|
|
330 |
| Colour | #045ECD |
|
|
|
331 |
| Width | 20 |
|
|
|
332 |
| Reference point location | Top left |
|
|
|
333 |
And I press "Save changes"
|
|
|
334 |
# User picture.
|
|
|
335 |
And I add the element "User picture" to page "1" of the "Custom certificate 1" certificate template
|
|
|
336 |
And I set the following fields to these values:
|
|
|
337 |
| Width | 10 |
|
|
|
338 |
| Height | 10 |
|
|
|
339 |
And I press "Save changes"
|
|
|
340 |
And I should see "User picture" in the "elementstable" "table"
|
|
|
341 |
And I click on ".edit-icon" "css_element" in the "User picture" "table_row"
|
|
|
342 |
And the following fields match these values:
|
|
|
343 |
| Width | 10 |
|
|
|
344 |
| Height | 10 |
|
|
|
345 |
And I press "Save changes"
|
|
|
346 |
# QR Code.
|
|
|
347 |
And I add the element "QR code" to page "1" of the "Custom certificate 1" certificate template
|
|
|
348 |
And I set the following fields to these values:
|
|
|
349 |
| Width | 25 |
|
|
|
350 |
| Height | 15 |
|
|
|
351 |
And I press "Save changes"
|
|
|
352 |
And I should see "QR code" in the "elementstable" "table"
|
|
|
353 |
And I click on ".edit-icon" "css_element" in the "QR code" "table_row"
|
|
|
354 |
And the following fields match these values:
|
|
|
355 |
| Width | 25 |
|
|
|
356 |
| Height | 15 |
|
|
|
357 |
And I press "Save changes"
|
|
|
358 |
# Just to test there are no exceptions being thrown.
|
|
|
359 |
And I follow "Reposition elements"
|
|
|
360 |
And I press "Save and close"
|
|
|
361 |
And I press "Save changes and preview"
|
|
|
362 |
|
|
|
363 |
Scenario: Delete an element from a certificate template
|
|
|
364 |
And I add the element "Background image" to page "1" of the "Custom certificate 1" certificate template
|
|
|
365 |
And I press "Save changes"
|
|
|
366 |
And I should see "Background image" in the "elementstable" "table"
|
|
|
367 |
And I add the element "Student name" to page "1" of the "Custom certificate 1" certificate template
|
|
|
368 |
And I press "Save changes"
|
|
|
369 |
And I should see "Student name" in the "elementstable" "table"
|
|
|
370 |
And I click on ".delete-icon" "css_element" in the "Student name" "table_row"
|
|
|
371 |
And I press "Cancel"
|
|
|
372 |
And I should see "Background image" in the "elementstable" "table"
|
|
|
373 |
And I should see "Student name" in the "elementstable" "table"
|
|
|
374 |
And I click on ".delete-icon" "css_element" in the "Student name" "table_row"
|
|
|
375 |
And I press "Continue"
|
|
|
376 |
And I should see "Background image" in the "elementstable" "table"
|
|
|
377 |
And I should not see "Student name" in the "elementstable" "table"
|