Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_badges
2
Feature: Backpack badges
3
  Test the settings to add/update a backpack for a site and user.
4
  I need to verify display backpack in the my profile
5
 
6
  Background:
7
    Given the following "badge external backpacks" exist:
8
      | backpackapiurl                               | backpackweburl           | apiversion | sortorder |
9
      | https://dc.imsglobal.org/obchost/ims/ob/v2p1 | https://dc.imsglobal.org | 2.1        | 2         |
10
      | https://test.com/                            | https://test.com/        | 2          | 3         |
11
    And the following "users" exist:
12
      | username | firstname | lastname | email                |
13
      | student1 | Student   | 1        | student1@example.com |
14
    And I log in as "admin"
15
    And I navigate to "Badges > Badges settings" in site administration
16
    And I set the field "Badge issuer name" to "Test Badge Site"
17
    And I set the field "Badge issuer email address" to "testuser@example.com"
18
    And I log out
19
 
20
  @javascript
21
  Scenario: If external backpack connection is disabled, backpack settings should not be displayed
22
    Given I am on homepage
23
    And I log in as "admin"
24
    And I navigate to "Badges > Badges settings" in site administration
25
    And I set the following fields to these values:
26
      | External backpack connection | 0                        |
27
    And I press "Save changes"
28
    When I navigate to "Badges" in site administration
29
    Then I should not see "Manage backpacks"
30
    And I navigate to "Badges > Badges settings" in site administration
31
    And I set the following fields to these values:
32
      | External backpack connection | 1                        |
33
    And I press "Save changes"
34
    And I am on homepage
35
    And I navigate to "Badges" in site administration
36
    And I should see "Manage backpacks"
37
 
38
  @javascript
39
  Scenario: Verify backback settings
40
    Given the following "core_badges > Badge" exists:
41
      | name           | Test badge verify backpack       |
42
      | version        | 1                                |
43
      | language       | en                               |
44
      | description    | Test badge description           |
45
      | image          | badges/tests/behat/badge.png     |
46
      | imagecaption   | Test caption image               |
47
    And the following "core_badges > Criteria" exists:
48
      | badge          | Test badge verify backpack       |
49
      | role           | editingteacher                   |
50
    And the following "core_badges > Issued badge" exists:
51
      | badge          | Test badge verify backpack       |
52
      | user           | student1                         |
53
    When I log in as "student1"
54
    And I follow "Preferences" in the user menu
55
    And I follow "Backpack settings"
56
    Then I should see "Choose..." in the "Backpack provider" "select"
57
 
58
  @javascript
59
  Scenario: User has been connected backpack
60
    Given I am on homepage
61
    And I log in as "admin"
62
    And I navigate to "Badges > Badges settings" in site administration
63
    And I set the following fields to these values:
64
      | External backpack connection | 1                        |
65
    And I press "Save changes"
66
    And I navigate to "Badges > Manage backpacks" in site administration
67
    And I click on "Move up" "link" in the "https://dc.imsglobal.org" "table_row"
68
    And the following "core_badges > Badge" exists:
69
      | name           | Test badge verify backpack       |
70
      | version        | 1                                |
71
      | language       | en                               |
72
      | description    | Test badge description           |
73
      | image          | badges/tests/behat/badge.png     |
74
      | imagecaption   | Test caption image               |
75
    And the following "core_badges > Criteria" exists:
76
      | badge          | Test badge verify backpack       |
77
      | role           | editingteacher                   |
78
    And the following "core_badges > Issued badge" exists:
79
      | badge          | Test badge verify backpack       |
80
      | user           | student1                         |
81
    And the following "setup backpack connected" exist:
82
      | user     | externalbackpack         |
83
      | student1 | https://dc.imsglobal.org |
84
    When I log in as "student1"
85
    And I follow "Preferences" in the user menu
86
    And I follow "Backpack settings"
87
    Then I should see "Connected"
88
    And I follow "Preferences" in the user menu
89
    And I follow "Manage badges"
90
    And I should see "Test badge verify backpack"
91
    And "Add to backpack" "link" should exist
92
 
93
  @javascript
1441 ariadna 94
  Scenario: Add a new site OBv2.1 backpack
1 efrain 95
    Given I am on homepage
96
    And I log in as "admin"
97
    And I navigate to "Badges > Manage backpacks" in site administration
98
    When I press "Add a new backpack"
1441 ariadna 99
    And I set the field "apiversion" to "2.1"
100
    And I should see "Backpack URL"
101
    And I set the field "backpackweburlv2p1" to "http://backpackweburl.cat"
102
    And I should not see "Backpack API URL"
103
    Then "Connect to backpack provider account" "checkbox" should not be visible
104
    And "Connect to a Canvas Credentials issuer account" "checkbox" should not be visible
105
    And I should not see "Email"
106
    And I should not see "Password"
107
 
108
  @javascript
109
  Scenario: Add a new site OBv2.0 backpack with Canvas provider
110
    Given I am on homepage
111
    And I log in as "admin"
112
    And I navigate to "Badges > Manage backpacks" in site administration
113
    When I press "Add a new backpack"
1 efrain 114
    And I set the field "apiversion" to "2"
1441 ariadna 115
    And I press "Save changes"
116
    And I should see "You must supply a value here"
117
    And I set the field "provider" to "Canvas Credentials"
118
    And I press "Save changes"
119
    And I should see "You must supply a value here"
120
    And I set the field "region" to "Singapore"
121
    And I should not see "Backpack web URL"
122
    And I should not see "Backpack API URL"
123
    And I press "Save changes"
124
    Then I should see "https://sg.badgr.io"
125
    And "Delete" "icon" should exist in the "https://sg.badgr.io" "table_row"
126
    And "Edit settings" "icon" should exist in the "https://sg.badgr.io" "table_row"
127
    And "Test settings" "icon" should exist in the "https://sg.badgr.io" "table_row"
128
    # Check that editing the backpack shows the correct values.
129
    And I click on "Edit settings" "link" in the "https://sg.badgr.io" "table_row"
130
    And I should see "API version supported"
131
    And the field "apiversion" matches value "2"
132
    And I should see "Provider"
133
    And the field "provider" matches value "Canvas Credentials"
134
    And I should see "Region"
135
    And the field "region" matches value "Singapore"
136
    And I should see "Connect to a Canvas Credentials issuer account"
137
    And the field "Connect to a Canvas Credentials issuer account" matches value "0"
138
    And I should not see "Connect to backpack provider account"
139
 
140
  @javascript
141
  Scenario: Add a new site OBv2.0 backpack with Canvas provider and issuer authentication details
142
    Given I am on homepage
143
    And I log in as "admin"
144
    And I navigate to "Badges > Manage backpacks" in site administration
145
    When I press "Add a new backpack"
146
    And I set the field "apiversion" to "2"
147
    And I set the field "provider" to "Canvas Credentials"
148
    And I set the field "region" to "Canada"
149
    And I should see "Connect to a Canvas Credentials issuer account"
150
    And I should not see "Connect to backpack provider account"
151
    And the field "Connect to a Canvas Credentials issuer account" matches value "0"
152
    And I click on "includeauthdetailscanvas" "checkbox"
153
    And I should see "Email"
154
    And I should see "Password"
155
    And I press "Save changes"
156
    And I should see "You must supply a value here"
157
    And I set the field "backpackemailcanvas" to "test@test.com"
158
    And I should see "You must supply a value here"
159
    And I press "Save changes"
160
    And I set the field "backpackpasswordcanvas" to "123456"
161
    And I press "Save changes"
162
    Then I should see "https://ca.badgr.io"
163
    # Check that editing the backpack shows the correct values.
164
    And I click on "Edit settings" "link" in the "https://ca.badgr.io" "table_row"
165
    And I should see "API version supported"
166
    And the field "apiversion" matches value "2"
167
    And I should see "Provider"
168
    And the field "provider" matches value "Canvas Credentials"
169
    And I should see "Region"
170
    And the field "region" matches value "Canada"
171
    And I should see "Connect to a Canvas Credentials issuer account"
172
    And the field "Connect to a Canvas Credentials issuer account" matches value "1"
173
    And the field "backpackemailcanvas" matches value "test@test.com"
174
    And the field "backpackpasswordcanvas" matches value "123456"
175
    # Disable authentication details and check that email and password are cleared.
176
    But I click on "includeauthdetailscanvas" "checkbox"
177
    And I press "Save changes"
178
    And I click on "Edit settings" "link" in the "https://ca.badgr.io" "table_row"
179
    And I should see "API version supported"
180
    And the field "apiversion" matches value "2"
181
    And I should see "Provider"
182
    And the field "provider" matches value "Canvas Credentials"
183
    And I should see "Region"
184
    And the field "region" matches value "Canada"
185
    And I should see "Connect to a Canvas Credentials issuer account"
186
    And the field "Connect to a Canvas Credentials issuer account" matches value "0"
187
    And the field "backpackemailcanvas" matches value ""
188
    And the field "backpackpasswordcanvas" matches value ""
189
 
190
  @javascript
191
  Scenario: Add a new site OBv2.0 backpack with Other provider
192
    Given I am on homepage
193
    And I log in as "admin"
194
    And I navigate to "Badges > Manage backpacks" in site administration
195
    When I press "Add a new backpack"
196
    And I set the field "apiversion" to "2"
197
    And I set the field "provider" to "Other"
198
    And I should not see "Region"
1 efrain 199
    And I set the field "backpackweburl" to "aaa"
200
    And I press "Save changes"
201
    And I should see "Invalid URL"
202
    And I set the field "backpackweburl" to "http://backpackweburl.cat"
203
    And I press "Save changes"
204
    And I should see "You must supply a value here"
205
    And I set the field "backpackapiurl" to "http://backpackapiurl.cat"
206
    And I press "Save changes"
207
    Then I should see "http://backpackweburl.cat"
208
    And "Delete" "icon" should exist in the "http://backpackweburl.cat" "table_row"
209
    And "Edit settings" "icon" should exist in the "http://backpackweburl.cat" "table_row"
1441 ariadna 210
    And "Test settings" "icon" should exist in the "http://backpackweburl.cat" "table_row"
211
    # Check that editing the backpack shows the correct values.
212
    And I click on "Edit settings" "link" in the "http://backpackweburl.cat" "table_row"
213
    And I should see "API version supported"
214
    And the field "apiversion" matches value "2"
215
    And I should see "Provider"
216
    And the field "provider" matches value "Other"
217
    And I should not see "Region"
218
    And the field "backpackweburl" matches value "http://backpackweburl.cat"
219
    And the field "backpackapiurl" matches value "http://backpackapiurl.cat"
220
    And the field "Connect to backpack provider account" matches value "0"
221
    And I should not see "Connect to a Canvas Credentials issuer account"
1 efrain 222
 
223
  @javascript
1441 ariadna 224
  Scenario: Add a new site OBv2.0 backpack with Other provider and issuer authentication details
225
    Given I am on homepage
226
    And I log in as "admin"
227
    And I navigate to "Badges > Manage backpacks" in site administration
228
    When I press "Add a new backpack"
229
    And I set the field "apiversion" to "2"
230
    And I set the field "provider" to "Other"
231
    And I set the field "backpackweburl" to "http://backpackweburl.cat"
232
    And I set the field "backpackapiurl" to "http://backpackapiurl.cat"
233
    And I should see "Connect to backpack provider account"
234
    And I should not see "Connect to a Canvas Credentials issuer account"
235
    And the field "Connect to backpack provider account" matches value "0"
236
    And I click on "includeauthdetails" "checkbox"
237
    And I should see "Email"
238
    And I should see "Password"
239
    And I press "Save changes"
240
    And I should see "You must supply a value here"
241
    And I set the field "backpackemail" to "test@test.com"
242
    And I press "Save changes"
243
    And I should see "You must supply a value here"
244
    And I set the field "password" to "123456"
245
    And I press "Save changes"
246
    Then I should see "http://backpackweburl.cat"
247
    # Check that editing the backpack shows the correct values.
248
    And I click on "Edit settings" "link" in the "http://backpackweburl.cat" "table_row"
249
    And I should see "API version supported"
250
    And the field "apiversion" matches value "2"
251
    And the field "provider" matches value "Other"
252
    And the field "backpackweburl" matches value "http://backpackweburl.cat"
253
    And the field "backpackapiurl" matches value "http://backpackapiurl.cat"
254
    And the field "Connect to backpack provider account" matches value "1"
255
    And the field "backpackemail" matches value "test@test.com"
256
    And the field "password" matches value "123456"
257
    # Disable authentication details and check that email and password are cleared.
258
    But I click on "includeauthdetails" "checkbox"
259
    And I press "Save changes"
260
    And I click on "Edit settings" "link" in the "http://backpackweburl.cat" "table_row"
261
    And I should see "API version supported"
262
    And the field "apiversion" matches value "2"
263
    And the field "provider" matches value "Other"
264
    And the field "backpackweburl" matches value "http://backpackweburl.cat"
265
    And the field "backpackapiurl" matches value "http://backpackapiurl.cat"
266
    And the field "Connect to backpack provider account" matches value "0"
267
    And the field "backpackemail" matches value ""
268
    And the field "password" matches value ""
269
 
270
  @javascript
271
  Scenario: Add a new site OBv2.0 backpack without providers
272
    Given the following config values are set as admin:
273
      | badges_canvasregions |  |
274
    And I am on homepage
275
    And I log in as "admin"
276
    And I navigate to "Badges > Manage backpacks" in site administration
277
    When I press "Add a new backpack"
278
    And I set the field "apiversion" to "2"
279
    And I should not see "Provider"
280
    And I should see "Backpack URL"
281
    And I should see "Backpack API URL"
282
    And I press "Save changes"
283
    And I should see "You must supply a value here"
284
    And I set the field "backpackweburl" to "https://eu.badgr.io"
285
    And I set the field "backpackapiurl" to "https://api.eu.badgr.io/v2"
286
    And I should see "Connect to backpack provider account"
287
    And I should not see "Connect to a Canvas Credentials issuer account"
288
    And I press "Save changes"
289
    Then I should see "https://eu.badgr.io"
290
    And "Delete" "icon" should exist in the "https://eu.badgr.io" "table_row"
291
    And "Edit settings" "icon" should exist in the "https://eu.badgr.io" "table_row"
292
    And "Test settings" "icon" should exist in the "https://eu.badgr.io" "table_row"
293
    # Check that editing the backpack shows the correct values.
294
    And I click on "Edit settings" "link" in the "https://eu.badgr.io" "table_row"
295
    And I should see "API version supported"
296
    And the field "apiversion" matches value "2"
297
    And I should not see "Provider"
298
    And the field "backpackweburl" matches value "https://eu.badgr.io"
299
    And the field "backpackapiurl" matches value "https://api.eu.badgr.io/v2"
300
    And I should see "Connect to backpack provider account"
301
    And the field "Connect to backpack provider account" matches value "0"
302
    And I should not see "Connect to a Canvas Credentials issuer account"
303
    And I press "Cancel"
304
    # Add Europe to the providers list and check that editing the backpack shows the correct values.
305
    But the following config values are set as admin:
306
      | badges_canvasregions | Europe\|https://eu.badgr.io\|https://api.eu.badgr.io/v2 |
307
    And I click on "Edit settings" "link" in the "https://eu.badgr.io" "table_row"
308
    And I should see "API version supported"
309
    And the field "apiversion" matches value "2"
310
    And I should see "Provider"
311
    And the field "provider" matches value "Canvas Credentials"
312
    And I should see "Region"
313
    And the field "region" matches value "Europe"
314
    And I should see "Connect to a Canvas Credentials issuer account"
315
    And the field "Connect to a Canvas Credentials issuer account" matches value "0"
316
    And I should not see "Connect to backpack provider account"
317
    And I should not see "Backpack URL"
318
    And I should not see "Backpack API URL"
319
 
320
  @javascript
1 efrain 321
  Scenario: Remove a site backpack
322
    Given I am on homepage
323
    And I log in as "admin"
324
    And I navigate to "Badges > Manage backpacks" in site administration
325
    When I click on "Delete" "link" in the "https://dc.imsglobal.org" "table_row"
326
    And I should see "Delete site backpack 'https://dc.imsglobal.org'?"
327
    And I click on "Delete" "button" in the "Delete site backpack" "dialogue"
328
    Then I should see "The site backpack has been deleted."
329
    And I should not see "https://dc.imsglobal.org"
330
    And "Delete" "button" should not be visible
331
 
332
  @javascript
333
  Scenario: Move up and down site backpack
334
    Given I am on homepage
335
    And I log in as "admin"
336
    And I navigate to "Badges > Manage backpacks" in site administration
337
    And "Move up" "icon" should exist in the "https://dc.imsglobal.org" "table_row"
338
    And "Move down" "icon" should exist in the "https://dc.imsglobal.org" "table_row"
339
    When I click on "Move up" "link" in the "https://dc.imsglobal.org" "table_row"
340
    Then "Move up" "icon" should not exist in the "https://dc.imsglobal.org" "table_row"
341
    And "Move down" "icon" should exist in the "https://dc.imsglobal.org" "table_row"
342
    And I click on "Move down" "link" in the "https://dc.imsglobal.org" "table_row"
343
    And I click on "Move down" "link" in the "https://dc.imsglobal.org" "table_row"
344
    And "Move up" "icon" should exist in the "https://dc.imsglobal.org" "table_row"
345
    And "Move down" "icon" should not exist in the "https://dc.imsglobal.org" "table_row"
346
 
347
  @javascript
348
  Scenario: View backpack form as a student
349
    Given I log in as "student1"
350
    And I follow "Preferences" in the user menu
351
    And I follow "Backpack settings"
352
    When I set the field "externalbackpackid" to "https://dc.imsglobal.org"
353
    Then I should not see "Log in to your backpack"
1441 ariadna 354
    And I should not see "Email"
1 efrain 355
    And I should not see "Password"
356
    But I set the field "externalbackpackid" to "https://test.com/"
357
    And I should see "Log in to your backpack"
1441 ariadna 358
    And I should see "Email"
1 efrain 359
    And I should see "Password"
360
 
361
  @javascript
362
  Scenario: Check backpack form validation as a student
363
    Given I log in as "student1"
364
    And I follow "Preferences" in the user menu
365
    And I follow "Backpack settings"
366
    When I click on "Connect to backpack" "button"
367
    Then I should see "Backpack provider can't be blank"
368
    And I set the field "externalbackpackid" to "https://test.com/"
369
    And I set the field "password" to ""
370
    When I click on "Connect to backpack" "button"
371
    Then I should see "Password can't be blank"
372
    And I should not see "Email address can't be blank"
373
    And I set the field "backpackemail" to ""
374
    And I click on "Connect to backpack" "button"
375
    And I should see "Email address can't be blank"
376
    And I should see "Password can't be blank"