MDL-69054 core_badges: allow editing OBv1.0 backpacks
[moodle.git] / badges / tests / behat / backpack.feature
CommitLineData
15a00bea
TT
1@core @core_badges @_file_upload
2Feature: Backpack badges
3 The settings to connect to backpack with OAuth2 service
4 As an learner
5 I need to verify display backpack in the my profile
6
7 Background:
8 Given the following "badge external backpack" exist:
9 | backpackapiurl | backpackweburl | apiversion |
10 | https://dc.imsglobal.org/obchost/ims/ob/v2p1 | https://dc.imsglobal.org | 2.1 |
11 And the following "users" exist:
12 | username | firstname | lastname | email |
13 | student1 | Student | 1 | student1@example.com |
dcbc830c
SA
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
15a00bea
TT
19
20 @javascript
21 Scenario: Verify backback settings
22 Given I am on homepage
23 And I log in as "admin"
24 And I navigate to "Badges > Backpack settings" in site administration
25 And I set the following fields to these values:
26 | External backpack connection | 1 |
27 | Active external backpack | https://dc.imsglobal.org |
28 And I press "Save changes"
29 And I navigate to "Badges > Add a new badge" in site administration
30 And I set the following fields to these values:
31 | Name | Test badge verify backpack |
32 | Version | v1 |
33 | Language | English |
34 | Description | Test badge description |
35 | Image author | http://author.example.com |
36 | Image caption | Test caption image |
15a00bea
TT
37 And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
38 And I press "Create badge"
39 And I set the field "type" to "Manual issue by role"
40 And I set the field "Manager" to "1"
41 And I press "Save"
42 And I press "Enable access"
43 And I press "Continue"
44 And I follow "Recipients (0)"
45 And I press "Award badge"
46 And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
47 And I press "Award badge"
48 And I log out
49 When I am on homepage
50 And I log in as "student1"
51 And I follow "Preferences" in the user menu
52 And I follow "Backpack settings"
53 Then I should see "https://dc.imsglobal.org"
54 And I should see "Not connected"
55
56 @javascript
57 Scenario: User has been connected backpack
58 Given I am on homepage
59 And I log in as "admin"
60 And I navigate to "Badges > Backpack settings" in site administration
61 And I set the following fields to these values:
62 | External backpack connection | 1 |
63 | Active external backpack | https://dc.imsglobal.org |
64 And I press "Save changes"
65 And I navigate to "Badges > Add a new badge" in site administration
66 And I set the following fields to these values:
67 | Name | Test badge verify backpack |
68 | Version | v1 |
69 | Language | English |
70 | Description | Test badge description |
71 | Image author | http://author.example.com |
72 | Image caption | Test caption image |
15a00bea
TT
73 And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
74 And I press "Create badge"
75 And I set the field "type" to "Manual issue by role"
76 And I set the field "Manager" to "1"
77 And I press "Save"
78 And I press "Enable access"
79 And I press "Continue"
80 And I follow "Recipients (0)"
81 And I press "Award badge"
82 And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
83 And I press "Award badge"
84 And I log out
85 And the following "setup backpack connected" exist:
86 | user | externalbackpack |
87 | student1 | https://dc.imsglobal.org |
88 When I log in as "student1"
89 And I follow "Preferences" in the user menu
90 And I follow "Backpack settings"
91 Then I should see "Connected"
92 And I follow "Preferences" in the user menu
93 And I follow "Manage badges"
94 And I should see "Test badge verify backpack"
95 And "Add to backpack" "link" should exist
a80541ea
SA
96
97 @javascript
98 Scenario: Add a new site backpack
99 Given I am on homepage
100 And I log in as "admin"
101 And I navigate to "Badges > Manage backpacks" in site administration
102 When I press "Add a new backpack"
103 And I set the field "backpackapiurl" to "http://backpackapiurl.cat"
104 And I set the field "backpackweburl" to "aaa"
105 And I press "Save changes"
106 And I should see "Invalid URL"
107 And I set the field "backpackweburl" to "http://backpackweburl.cat"
108 And I press "Save changes"
109 Then I should see "http://backpackweburl.cat"
aa3a9c78
SA
110 And "Delete" "icon" should exist in the "http://backpackweburl.cat" "table_row"
111 And "Edit settings" "icon" should exist in the "http://backpackweburl.cat" "table_row"
a80541ea
SA
112
113 @javascript
114 Scenario: Remove a site backpack
115 Given I am on homepage
116 And I log in as "admin"
117 And I navigate to "Badges > Manage backpacks" in site administration
118 When I click on "Delete" "link" in the "https://dc.imsglobal.org" "table_row"
119 And I should see "Delete site backpack 'https://dc.imsglobal.org'?"
120 And I click on "Delete" "button" in the "Delete site backpack" "dialogue"
121 Then I should see "The site backpack has been deleted."
122 And I should not see "https://dc.imsglobal.org"
123 And "Delete" "button" should not exist