MDL-62342 privacy: Fix strings used in the consent on behalf modal
[moodle.git] / admin / tool / policy / tests / behat / acceptances.feature
CommitLineData
cf398020
MG
1@tool @tool_policy
2Feature: Viewing acceptances reports and accepting on behalf of other users
3 In order to manage user acceptances
4 As a manager
5 I need to be able to view acceptances and accept on behalf of other users
6
7 Background:
8 Given the following config values are set as admin:
9 | sitepolicyhandler | tool_policy |
10 And the following policies exist:
11 | Name | Revision | Content | Summary | Status |
12 | This site policy | | full text2 | short text2 | active |
13 | This privacy policy | | full text3 | short text3 | draft |
14 And the following "users" exist:
15 | username | firstname | lastname | email |
16 | user1 | User | One | one@example.com |
17 | user2 | User | Two | two@example.com |
18 | manager | Max | Manager | man@example.com |
19 And the following "role assigns" exist:
20 | user | role | contextlevel | reference |
21 | manager | manager | System | |
22 And the following "courses" exist:
23 | fullname | shortname |
24 | Course1 | C1 |
25 And the following "course enrolments" exist:
26 | user | course | role |
27 | user1 | C1 | student |
28 | user2 | C1 | student |
29
30 Scenario: View acceptances made by users on their own, single policy
31 When I log in as "user1"
32 Then I should see "This site policy"
33 And I should not see "Course overview"
34 And I press "Next"
35 And I set the field "I agree to the This site policy" to "1"
36 And I press "Next"
37 And I should see "Course overview"
38 And I log out
39 And I log in as "manager"
40 And I press "Next"
41 And I set the field "I agree to the This site policy" to "1"
42 And I press "Next"
6a23fb21 43 And I navigate to "Users > Privacy and policies > User agreements" in site administration
cf398020
MG
44 And "Agreed" "icon" should exist in the "User One" "table_row"
45 And "Agreed" "icon" should exist in the "Max Manager" "table_row"
14e0ab35 46 And "Consent not given" "icon" should exist in the "User Two" "table_row"
cf398020
MG
47
48 Scenario: Agree on behalf of another user as a manager, single policy, javascript off
49 Given I log in as "admin"
50 And I set the following system permissions of "Manager" role:
51 | capability | permission |
52 | tool/policy:acceptbehalf | Allow |
53 And I log out
54 When I log in as "manager"
55 And I press "Next"
56 And I set the field "I agree to the This site policy" to "1"
57 And I press "Next"
6a23fb21 58 And I navigate to "Users > Privacy and policies > Manage policies" in site administration
cf398020 59 And I click on "1 of 4 (25%)" "link" in the "This site policy" "table_row"
14e0ab35 60 And I click on "Consent not given" "link" in the "User One" "table_row"
2e72392b 61 Then I should see "Give consent"
cf398020
MG
62 And I should see "User One"
63 And I should see "This site policy"
2e72392b 64 And I should see "I acknowledge that I have received a request to give consent on behalf of the above user(s)."
cf398020 65 And I set the field "Remarks" to "Consent received from a parent"
2e72392b 66 And I press "Give consent"
14e0ab35 67 And "Consent given on behalf of user" "icon" should exist in the "User One" "table_row"
cf398020
MG
68 And "Max Manager" "link" should exist in the "User One" "table_row"
69 And "Consent received from a parent" "text" should exist in the "User One" "table_row"
14e0ab35 70 And "Consent not given" "icon" should exist in the "User Two" "table_row"
cf398020
MG
71
72 @javascript
73 Scenario: Agree on behalf of another user as a manager, single policy, javascript on
74 Given I log in as "admin"
75 And I set the following system permissions of "Manager" role:
76 | capability | permission |
77 | tool/policy:acceptbehalf | Allow |
78 And I log out
79 When I log in as "manager"
80 And I press "Next"
81 And I set the field "I agree to the This site policy" to "1"
82 And I press "Next"
5bf7f59a 83 And I should not see "Next"
6a23fb21 84 And I navigate to "Users > Privacy and policies > Manage policies" in site administration
cf398020 85 And I click on "1 of 4 (25%)" "link" in the "This site policy" "table_row"
14e0ab35 86 And I click on "Consent not given" "link" in the "User One" "table_row"
2e72392b 87 Then I should see "Give consent"
cf398020
MG
88 And I should see "User One"
89 And I should see "This site policy"
2e72392b 90 And I should see "I acknowledge that I have received a request to give consent on behalf of the above user(s)."
cf398020 91 And I set the field "Remarks" to "Consent received from a parent"
2e72392b 92 And I press "Give consent"
14e0ab35 93 And "Consent given on behalf of user" "icon" should exist in the "User One" "table_row"
cf398020
MG
94 And "Max Manager" "link" should exist in the "User One" "table_row"
95 And "Consent received from a parent" "text" should exist in the "User One" "table_row"
14e0ab35 96 And "Consent not given" "icon" should exist in the "User Two" "table_row"
cf398020
MG
97
98 Scenario: View acceptances made by users on their own, multiple policies
99 Given I log in as "admin"
6a23fb21 100 And I navigate to "Users > Privacy and policies > Manage policies" in site administration
cf398020
MG
101 And I open the action menu in "This privacy policy" "table_row"
102 And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
103 And I press "Continue"
104 And I log out
105 When I log in as "user1"
106 Then I should see "This site policy"
107 And I press "Next"
108 And I should see "This privacy policy"
109 And I press "Next"
110 And I set the field "I agree to the This site policy" to "1"
111 And I set the field "I agree to the This privacy policy" to "1"
112 And I press "Next"
113 And I should see "Course overview"
114 And I log out
115 And I log in as "manager"
116 And I press "Next"
117 And I press "Next"
118 And I set the field "I agree to the This site policy" to "1"
119 And I set the field "I agree to the This privacy policy" to "1"
120 And I press "Next"
6a23fb21 121 And I navigate to "Users > Privacy and policies > User agreements" in site administration
cf398020 122 And "Agreed" "icon" should exist in the "User One" "table_row"
14e0ab35 123 And "Consent not given" "icon" should not exist in the "User One" "table_row"
cf398020 124 And "Agreed" "icon" should exist in the "Max Manager" "table_row"
14e0ab35 125 And "Consent not given" "icon" should exist in the "User Two" "table_row"
cf398020
MG
126 And "Agreed" "icon" should not exist in the "User Two" "table_row"
127 And I click on "2 of 2" "link" in the "User One" "table_row"
128 And "Agreed" "icon" should exist in the "This site policy" "table_row"
129 And "Agreed" "icon" should exist in the "This privacy policy" "table_row"
130 And I am on site homepage
6a23fb21 131 And I navigate to "Users > Privacy and policies > User agreements" in site administration
cf398020 132 And I click on "0 of 2" "link" in the "User Two" "table_row"
14e0ab35
DM
133 And "Consent not given" "icon" should exist in the "This site policy" "table_row"
134 And "Consent not given" "icon" should exist in the "This privacy policy" "table_row"
cf398020
MG
135
136 Scenario: Agree on behalf of another user as a manager, multiple policies, javascript off
137 Given I log in as "admin"
6a23fb21 138 And I navigate to "Users > Privacy and policies > Manage policies" in site administration
cf398020
MG
139 And I open the action menu in "This privacy policy" "table_row"
140 And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
141 And I press "Continue"
142 And I set the following system permissions of "Manager" role:
143 | capability | permission |
144 | tool/policy:acceptbehalf | Allow |
145 And I log out
146 When I log in as "manager"
147 And I press "Next"
148 And I press "Next"
149 And I set the field "I agree to the This site policy" to "1"
150 And I set the field "I agree to the This privacy policy" to "1"
151 And I press "Next"
6a23fb21 152 And I navigate to "Users > Privacy and policies > User agreements" in site administration
14e0ab35 153 And I click on "Consent not given; click to give consent on behalf of user for This site policy" "link" in the "User One" "table_row"
2e72392b 154 Then I should see "Give consent"
cf398020
MG
155 And I should see "User One"
156 And I should see "This site policy"
2e72392b 157 And I should see "I acknowledge that I have received a request to give consent on behalf of the above user(s)."
cf398020 158 And I set the field "Remarks" to "Consent received from a parent"
2e72392b 159 And I press "Give consent"
14e0ab35
DM
160 And "Consent given on behalf of user" "icon" should exist in the "User One" "table_row"
161 And "Consent not given; click to give consent on behalf of user for This privacy policy" "icon" should exist in the "User One" "table_row"
cf398020 162 And I click on "1 of 2" "link" in the "User One" "table_row"
14e0ab35 163 And "Consent given on behalf of user" "icon" should exist in the "This site policy" "table_row"
cf398020
MG
164 And "Max Manager" "link" should exist in the "This site policy" "table_row"
165 And "Consent received from a parent" "text" should exist in the "This site policy" "table_row"
14e0ab35 166 And "Consent not given" "icon" should exist in the "This privacy policy" "table_row"
cf398020
MG
167
168 @javascript
169 Scenario: Agree on behalf of another user as a manager, multiple policies, javascript on
170 Given I log in as "admin"
6a23fb21 171 And I navigate to "Users > Privacy and policies > Manage policies" in site administration
cf398020
MG
172 And I open the action menu in "This privacy policy" "table_row"
173 And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
174 And I press "Activate"
175 And I set the following system permissions of "Manager" role:
176 | capability | permission |
177 | tool/policy:acceptbehalf | Allow |
178 And I log out
179 When I log in as "manager"
180 And I press "Next"
181 And I press "Next"
182 And I set the field "I agree to the This site policy" to "1"
183 And I set the field "I agree to the This privacy policy" to "1"
184 And I press "Next"
6a23fb21 185 And I navigate to "Users > Privacy and policies > User agreements" in site administration
14e0ab35 186 And I click on "Consent not given; click to give consent on behalf of user for This site policy" "link" in the "User One" "table_row"
2e72392b 187 Then I should see "Give consent"
cf398020
MG
188 And I should see "User One"
189 And I should see "This site policy"
2e72392b 190 And I should see "I acknowledge that I have received a request to give consent on behalf of the above user(s)."
cf398020 191 And I set the field "Remarks" to "Consent received from a parent"
2e72392b 192 And I press "Give consent"
14e0ab35
DM
193 And "Consent given on behalf of user" "icon" should exist in the "User One" "table_row"
194 And "Consent not given; click to give consent on behalf of user for This privacy policy" "icon" should exist in the "User One" "table_row"
cf398020 195 And I click on "1 of 2" "link" in the "User One" "table_row"
14e0ab35 196 And "Consent given on behalf of user" "icon" should exist in the "This site policy" "table_row"
cf398020
MG
197 And "Max Manager" "link" should exist in the "This site policy" "table_row"
198 And "Consent received from a parent" "text" should exist in the "This site policy" "table_row"
14e0ab35 199 And "Consent not given" "icon" should exist in the "This privacy policy" "table_row"
cf398020
MG
200
201 Scenario: Policies and agreements profile link visible for current user
202 Given I log in as "user1"
203 And I press "Next"
204 And I set the field "I agree to the This site policy" to "1"
205 And I press "Next"
206 When I follow "Profile" in the user menu
207 # User can see his own agreements link in the profile.
208 Then I should see "Policies and agreements"
209 And I follow "Policies and agreements"
210 And "Agreed" "icon" should exist in the "This site policy" "table_row"
211 # User can't see agreements link in other user profiles.
212 And I am on "Course1" course homepage
213 And I navigate to course participants
214 And I follow "User Two"
215 And I should not see "Policies and agreements"
216
217 Scenario: Policies and agreements profile link visible also for users who can access on behaf of others
218 Given I log in as "admin"
219 And I set the following system permissions of "Manager" role:
220 | capability | permission |
221 | tool/policy:acceptbehalf | Allow |
222 And I log out
223 And I log in as "manager"
224 And I press "Next"
225 And I set the field "I agree to the This site policy" to "1"
226 And I press "Next"
227 # User can see agreements link in other user profiles because has the capability for accepting on behalf of them.
228 When I am on "Course1" course homepage
229 And I navigate to course participants
230 And I follow "User Two"
231 Then I should see "Policies and agreements"
e8cf2ffd
MG
232
233 Scenario: Agree on behalf of another user as an admin who is logged in as a manager
234 Given I log in as "admin"
235 And I set the following system permissions of "Manager" role:
236 | capability | permission |
237 | tool/policy:acceptbehalf | Allow |
238 And I log out
239 When I log in as "manager"
240 And I press "Next"
241 And I set the field "I agree to the This site policy" to "1"
242 And I press "Next"
243 And I log out
244 And I log in as "admin"
245 And I navigate to "Users > Accounts > Browse list of users" in site administration
246 And I follow "Manager"
247 And I follow "Log in as"
248 And I press "Continue"
6a23fb21 249 And I navigate to "Users > Privacy and policies > Manage policies" in site administration
e8cf2ffd 250 And I click on "1 of 4 (25%)" "link" in the "This site policy" "table_row"
14e0ab35 251 And I click on "Consent not given" "link" in the "User One" "table_row"
2e72392b 252 Then I should see "Give consent"
e8cf2ffd
MG
253 And I should see "User One"
254 And I should see "This site policy"
2e72392b 255 And I should see "I acknowledge that I have received a request to give consent on behalf of the above user(s)."
e8cf2ffd 256 And I set the field "Remarks" to "Consent received from a parent"
2e72392b 257 And I press "Give consent"
14e0ab35 258 And "Consent given on behalf of user" "icon" should exist in the "User One" "table_row"
e8cf2ffd
MG
259 And "Max Manager" "link" should not exist in the "User One" "table_row"
260 And "Admin User" "link" should exist in the "User One" "table_row"
261 And "Consent received from a parent" "text" should exist in the "User One" "table_row"
14e0ab35 262 And "Consent not given" "icon" should exist in the "User Two" "table_row"