Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_policy
2
Feature: Optional policies
3
  In order to exercise my privacy rights
4
  As a user
5
  I should be able to decline policy statements and withdraw my previously given consent to them
6
 
7
  Background:
8
    Given the following config values are set as admin:
9
      | sitepolicyhandler | tool_policy |
10
    And the following "users" exist:
11
      | username | firstname | lastname | email           |
12
      | user1    | User      | One      | one@example.com |
13
      | user2    | User      | Two      | two@example.com |
14
      | manager  | Max       | Manager  | man@example.com |
15
    And the following "role assigns" exist:
16
      | user    | role           | contextlevel | reference |
17
      | manager | manager        | System       |           |
18
    And the following "courses" exist:
19
      | fullname | shortname |
20
      | Course1  | C1        |
21
    And the following "course enrolments" exist:
22
      | user     | course | role    |
23
      | user1    | C1     | student |
24
      | user2    | C1     | student |
25
 
26
  Scenario: Configuring a policy as optional
27
    Given I log in as "manager"
28
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
29
    And I follow "New policy"
30
    # Policies are compulsory by default.
31
    And the field "Agreement optional" matches value "No"
32
    # Optional status can be set when creating a new policy.
33
    And I set the following fields to these values:
34
      | Name                                      | ConsentPageOptional1  |
35
      | Version                                   | v1                    |
36
      | Summary                                   | Policy summary        |
37
      | Full policy                               | Full text             |
38
      | Active                                    | 1                     |
39
      | Show policy before showing other policies | No                    |
40
      | Agreement optional                        | Yes                   |
41
    When I press "Save"
42
    Then the following should exist in the "tool-policy-managedocs-wrapper" table:
43
      | Name                                                    | Policy status | Version |
44
      | ConsentPageOptional1 Site policy, All users, Optional   | Active        | v1      |
45
    # Optional status can be edited.
46
    And I open the action menu in "ConsentPageOptional1" "table_row"
47
    And I click on "Edit" "link" in the "ConsentPageOptional1" "table_row"
48
    And I set the field "Agreement optional" to "No"
49
    And I set the field "Minor change" to "1"
50
    And I press "Save"
51
    And the following should exist in the "tool-policy-managedocs-wrapper" table:
52
      | Name                                                    | Policy status | Version |
53
      | ConsentPageOptional1 Site policy, All users, Compulsory | Active        | v1      |
54
 
55
  Scenario: Compulsory policies must be accepted prior signup, optional policies just after it
56
    Given the following config values are set as admin:
57
      | registerauth    | email |
58
      | passwordpolicy  | 0     |
59
    And the following policies exist:
60
      | Name                   | Content    | Summary     | Agreementstyle | Optional  |
61
      | ConsentPageOptional1   | full text1 | short text1 | 0              | 1         |
62
      | ConsentPageOptional2   | full text2 | short text2 | 0              | 1         |
63
      | ConsentPageCompulsory1 | full text3 | short text3 | 0              | 0         |
64
      | OwnPageCompulsory1     | full text4 | short text4 | 1              | 0         |
65
      | OwnPageOptional1       | full text5 | short text5 | 1              | 1         |
66
    And I am on site homepage
67
    And I follow "Log in"
68
    And I click on "Create new account" "link"
69
    # Compulsory policies displayed on own page are shown first and must be agreed.
70
    And I should see "OwnPageCompulsory1" in the "region-main" "region"
71
    And I should see "short text4" in the "region-main" "region"
72
    And I should see "full text4" in the "region-main" "region"
73
    And I press "I agree to the OwnPageCompulsory1"
74
    # Compulsory policies displayed on the consent page are shown next and must be agreed.
75
    And I should see "ConsentPageCompulsory1"
76
    And I should see "short text3" in the "region-main" "region"
77
    And I should see "full text3" in the "region-main" "region"
78
    And I press "Next"
79
    And I should see "Please agree to the following policies"
80
    And I set the field "I agree to the ConsentPageCompulsory1" to "1"
81
    And I press "Next"
82
    # The signup form can be submitted and a new account created.
83
    And I set the following fields to these values:
84
      | Username      | user3               |
85
      | Password      | user3                 |
86
      | Email address | user3@address.invalid |
87
      | Email (again) | user3@address.invalid |
88
      | First name    | User3                 |
89
      | Last name       | L3                    |
90
    And I press "Create my new account"
91
    And I should see "Confirm your account"
92
    And I should see "An email should have been sent to your address at user3@address.invalid"
93
    And I confirm email for "user3"
94
    And I should see "Thanks, User3 L3"
95
    And I should see "Your registration has been confirmed"
96
    When I press "Continue"
97
    # After confirming the new account, the user is logged in and asked to accept or decline the optional policies.
98
    # First come policies displayed on their own page.
99
    Then I should see "OwnPageOptional1"
100
    And I should see "short text5" in the "region-main" "region"
101
    And I should see "full text5" in the "region-main" "region"
102
    And I press "No thanks, I decline OwnPageOptional1"
103
    # Then come policies displayed on the consent page.
104
    And I should see "ConsentPageOptional1" in the "region-main" "region"
105
    And I should see "short text1" in the "region-main" "region"
106
    And I should see "full text1" in the "region-main" "region"
107
    And I press "Next"
108
    And I should see "ConsentPageOptional2" in the "region-main" "region"
109
    And I should see "short text2" in the "region-main" "region"
110
    And I should see "full text2" in the "region-main" "region"
111
    And I press "Next"
112
    And I should see "Please agree to the following policies"
113
    And I set the field "I agree to the ConsentPageOptional1" to "1"
114
    And I set the field "No thanks, I decline ConsentPageOptional2" to "0"
115
    And I press "Next"
116
    # Accepted and declined policies are shown in the profile.
117
    And I follow "Profile" in the user menu
118
    And I follow "Policies and agreements"
119
    And "Accepted" "text" should exist in the "ConsentPageCompulsory1" "table_row"
120
    And "Accepted" "text" should exist in the "ConsentPageOptional1" "table_row"
121
    And "Accepted" "text" should exist in the "OwnPageCompulsory1" "table_row"
122
    And "Declined" "text" should exist in the "OwnPageOptional1" "table_row"
123
    And "Declined" "text" should exist in the "ConsentPageOptional2" "table_row"
124
 
125
  Scenario: When a new optional policy is added, users are asked to accept/decline it on their next login
126
    Given the following policies exist:
127
      | Name                   | Content    | Summary     | Agreementstyle | Optional  |
128
      | ConsentPageOptional1   | full text1 | short text1 | 0              | 1         |
129
      | OwnPageOptional1       | full text5 | short text5 | 1              | 1         |
130
    When I log in as "user1"
131
    # First come policies displayed on their own page.
132
    Then I should see "OwnPageOptional1"
133
    And I should see "short text5" in the "region-main" "region"
134
    And I should see "full text5" in the "region-main" "region"
135
    And I press "I agree to the OwnPageOptional1"
136
    # Then come policies displayed on the consent page.
137
    And I should see "ConsentPageOptional1" in the "region-main" "region"
138
    And I should see "short text1" in the "region-main" "region"
139
    And I should see "full text1" in the "region-main" "region"
140
    And I press "Next"
141
    And I should see "Please agree to the following policies"
142
    And I set the field "No thanks, I decline ConsentPageOptional1" to "0"
143
    And I press "Next"
144
    # Accepted and declined policies are shown in the profile.
145
    And I follow "Profile" in the user menu
146
    And I follow "Policies and agreements"
147
    And "Accepted" "text" should exist in the "OwnPageOptional1" "table_row"
148
    And "Declined" "text" should exist in the "ConsentPageOptional1" "table_row"
149
 
150
  Scenario: Users can withdraw an accepted optional policy and re-accept it again (js off)
151
    Given the following policies exist:
152
      | Name                   | Content    | Summary     | Agreementstyle | Optional  |
153
      | OwnPageOptional1       | full text1 | short text1 | 1              | 1         |
154
    And I log in as "user1"
155
    And I press "I agree to the OwnPageOptional1"
156
    And I follow "Profile" in the user menu
157
    And I follow "Policies and agreements"
158
    And "Accepted" "text" should exist in the "OwnPageOptional1" "table_row"
159
    And "Withdraw" "link" should exist in the "OwnPageOptional1" "table_row"
160
    When I click on "Withdraw acceptance of OwnPageOptional1" "link" in the "OwnPageOptional1" "table_row"
161
    Then I should see "Withdrawing policy"
162
    And I should see "User One"
163
    And I should see "OwnPageOptional1"
164
    And I press "Withdraw user consent"
165
    And "Declined" "text" should exist in the "OwnPageOptional1" "table_row"
166
    And "Accept" "link" should exist in the "OwnPageOptional1" "table_row"
167
    And I click on "Accept OwnPageOptional1" "link" in the "OwnPageOptional1" "table_row"
168
    And I should see "Accepting policy"
169
    And I should see "User One"
170
    And I should see "OwnPageOptional1"
171
    And I press "Give consent"
172
    And "Accepted" "text" should exist in the "OwnPageOptional1" "table_row"
173
 
174
  @javascript
175
  Scenario: Users can withdraw an accepted optional policy and re-accept it again (js on)
176
    Given the following policies exist:
177
      | Name                   | Content    | Summary     | Agreementstyle | Optional  |
178
      | OwnPageOptional1       | full text1 | short text1 | 1              | 1         |
179
    And I log in as "user1"
180
    And I press "I agree to the OwnPageOptional1"
181
    And I follow "Profile" in the user menu
182
    And I follow "Policies and agreements"
183
    And "Accepted" "text" should exist in the "OwnPageOptional1" "table_row"
184
    And "Withdraw" "link" should exist in the "OwnPageOptional1" "table_row"
185
    When I click on "Withdraw acceptance of OwnPageOptional1" "link" in the "OwnPageOptional1" "table_row"
186
    Then I should see "Withdrawing policy"
187
    And I should see "User One"
188
    And I should see "OwnPageOptional1"
189
    And I press "Withdraw user consent"
190
    And "Declined" "text" should exist in the "OwnPageOptional1" "table_row"
191
    And "Accept" "link" should exist in the "OwnPageOptional1" "table_row"
192
    And I click on "Accept OwnPageOptional1" "link" in the "OwnPageOptional1" "table_row"
193
    And I should see "Accepting policy"
194
    And I should see "User One"
195
    And I should see "OwnPageOptional1"
196
    And I press "Give consent"
197
    And "Accepted" "text" should exist in the "OwnPageOptional1" "table_row"
198
 
199
  Scenario: Managers can see accepted, declined and pending acceptances of optional policies
200
    Given the following policies exist:
201
      | Name                   | Content    | Summary     | Agreementstyle | Optional  |
202
      | OwnPageOptional1       | full text1 | short text1 | 1              | 1         |
203
      | OwnPageOptional2       | full text2 | short text2 | 1              | 1         |
204
    And I log in as "user1"
205
    And I press "I agree to the OwnPageOptional1"
206
    And I press "No thanks, I decline OwnPageOptional2"
207
    And I log out
208
    And I log in as "manager"
209
    And I press "I agree to the OwnPageOptional1"
210
    And I press "I agree to the OwnPageOptional2"
211
    When I navigate to "Users > Privacy and policies > User agreements" in site administration
212
    # User One has accepted just some policies.
213
    Then "Partially accepted" "text" should exist in the "User One" "table_row"
214
    And "Details" "link" should exist in the "User One" "table_row"
215
    # User Two did not have a chance to respond to the new policies yet.
216
    And "Pending" "text" should exist in the "User Two" "table_row"
217
    And "Details" "link" should exist in the "User Two" "table_row"
218
    # Max Manager accepted all and can also change status of own acceptances.
219
    And "Accepted" "text" should exist in the "Max Manager" "table_row"
220
    And "Details" "link" should exist in the "Max Manager" "table_row"
221
    And "Withdraw accepted policies" "link" should exist in the "Max Manager" "table_row"
222
    And "Withdraw acceptance of OwnPageOptional1" "link" should exist in the "Max Manager" "table_row"
223
    And "Withdraw acceptance of OwnPageOptional2" "link" should exist in the "Max Manager" "table_row"
224
 
225
  Scenario: Administrators can see accepted, declined and pending acceptances of optional policies and also change them on behalf of other users
226
    Given the following policies exist:
227
      | Name                   | Content    | Summary     | Agreementstyle | Optional  |
228
      | OwnPageOptional1       | full text1 | short text1 | 1              | 1         |
229
      | OwnPageOptional2       | full text2 | short text2 | 1              | 1         |
230
    And I log in as "user1"
231
    And I press "I agree to the OwnPageOptional1"
232
    And I press "No thanks, I decline OwnPageOptional2"
233
    And I log out
234
    And I log in as "admin"
235
    When I navigate to "Users > Privacy and policies > User agreements" in site administration
236
    # User One has accepted just some policies.
237
    Then "Partially accepted" "text" should exist in the "User One" "table_row"
238
    And "Details" "link" should exist in the "User One" "table_row"
239
    And "Withdraw acceptance of OwnPageOptional1" "link" should exist in the "User One" "table_row"
240
    And "Accept OwnPageOptional2" "link" should exist in the "User One" "table_row"
241
    # User Two did not have a chance to respond to the new policies yet.
242
    And "Pending" "text" should exist in the "User Two" "table_row"
243
    And "Accept pending policies" "link" should exist in the "User Two" "table_row"
244
    And "Decline pending policies" "link" should exist in the "User Two" "table_row"
245
    And "Accept OwnPageOptional1" "link" should exist in the "User Two" "table_row"
246
    And "Decline OwnPageOptional1" "link" should exist in the "User Two" "table_row"
247
    And "Accept OwnPageOptional2" "link" should exist in the "User Two" "table_row"
248
    And "Decline OwnPageOptional2" "link" should exist in the "User Two" "table_row"
249
    # Accept all policies on Max Manager's behalf.
250
    And I click on "Accept pending policies" "link" in the "Max Manager" "table_row"
251
    And I press "Give consent"
252
    And "Accepted" "text" should exist in the "Max Manager" "table_row"
253
    # Decline all policies on User Two's behalf.
254
    And I click on "Decline pending policies" "link" in the "User Two" "table_row"
255
    And I press "Decline user consent"
256
    And "Declined on user's behalf" "text" should exist in the "User Two" "table_row"
257
    And "Accepted" "text" should not exist in the "User Two" "table_row"
258
    And "Pending" "text" should not exist in the "User Two" "table_row"
259
    # Accept policy on User One's behalf.
260
    And I click on "Accept OwnPageOptional2" "link" in the "User One" "table_row"
261
    And I press "Give consent"
262
    And "Accepted on user's behalf" "text" should exist in the "User One" "table_row"
263
    And "Declined" "text" should not exist in the "User One" "table_row"
264
    And "Pending" "text" should not exist in the "User One" "table_row"