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: User must accept policy managed by this plugin when logging in and signing up
3
  In order to record user agreement to use the site
4
  As a user
5
  I need to be able to accept site policy during sign up
6
 
7
  Scenario: Accept policy on sign up, no site policy
8
    Given the following config values are set as admin:
9
      | registerauth    | email |
10
      | passwordpolicy  | 0     |
11
      | sitepolicyhandler | tool_policy |
12
    And I am on site homepage
13
    And I follow "Log in"
14
    When I click on "Create new account" "link"
15
    Then I should not see "I understand and agree"
16
    And I set the following fields to these values:
17
      | Username      | user1                 |
18
      | Password      | user1                 |
19
      | Email address | user1@address.invalid |
20
      | Email (again) | user1@address.invalid |
21
      | First name    | User1                 |
22
      | Last name     | L1                    |
23
    And I press "Create my new account"
24
    And I should see "Confirm your account"
25
    And I should see "An email should have been sent to your address at user1@address.invalid"
26
    And I confirm email for "user1"
27
    And I should see "Thanks, User1 L1"
28
    And I should see "Your registration has been confirmed"
29
    And I open my profile in edit mode
30
    And the field "First name" matches value "User1"
31
    And I log out
32
    # Confirm that user can login and browse the site (edit their profile).
33
    And I log in as "user1"
34
    And I open my profile in edit mode
35
    And the field "First name" matches value "User1"
36
 
37
  Scenario: Accept policy on sign up, only draft policy
38
    Given the following config values are set as admin:
39
      | registerauth    | email |
40
      | passwordpolicy  | 0     |
41
      | sitepolicyhandler | tool_policy |
42
    And the following policies exist:
43
      | Policy | Name             | Revision | Content    | Summary     | Status   |
44
      | P1     | This site policy |          | full text1 | short text1 | draft |
45
      | P1     | This privacy policy |          | full text2 | short text2 | draft |
46
    And I am on site homepage
47
    And I follow "Log in"
48
    When I click on "Create new account" "link"
49
    Then I should not see "I understand and agree"
50
    And I set the following fields to these values:
51
      | Username      | user1                 |
52
      | Password      | user1                 |
53
      | Email address | user1@address.invalid |
54
      | Email (again) | user1@address.invalid |
55
      | First name    | User1                 |
56
      | Last name     | L1                    |
57
    And I press "Create my new account"
58
    And I should see "Confirm your account"
59
    And I should see "An email should have been sent to your address at user1@address.invalid"
60
    And I confirm email for "user1"
61
    And I should see "Thanks, User1 L1"
62
    And I should see "Your registration has been confirmed"
63
    And I open my profile in edit mode
64
    And the field "First name" matches value "User1"
65
    And I log out
66
    # Confirm that user can login and browse the site (edit their profile).
67
    And I log in as "user1"
68
    And I open my profile in edit mode
69
    And the field "First name" matches value "User1"
70
 
71
  Scenario: Accept policy on sign up, one policy
72
    Given the following config values are set as admin:
73
      | registerauth    | email |
74
      | passwordpolicy  | 0     |
75
      | sitepolicyhandler | tool_policy |
76
    Given the following policies exist:
77
      | Policy | Name             | Revision | Content    | Summary     | Status   |
78
      | P1     | This site policy |          | full text1 | short text1 | archived |
79
      | P1     | This site policy |          | full text2 | short text2 | active   |
80
      | P1     | This site policy |          | full text3 | short text3 | draft    |
81
    And I am on site homepage
82
    And I follow "Log in"
83
    When I click on "Create new account" "link"
84
    Then I should see "This site policy" in the "region-main" "region"
85
    And I should see "short text2"
86
    And I should see "full text2"
87
    And I press "Next"
88
    And I should see "Please agree to the following policies"
89
    And I should see "This site policy" in the "region-main" "region"
90
    And I should see "short text2"
91
    And I should not see "full text2"
92
    And I set the field "I agree to the This site policy" to "1"
93
    And I press "Next"
94
    And I should not see "I understand and agree"
95
    And I set the following fields to these values:
96
      | Username      | user1                 |
97
      | Password      | user1                 |
98
      | Email address | user1@address.invalid |
99
      | Email (again) | user1@address.invalid |
100
      | First name    | User1                 |
101
      | Last name     | L1                    |
102
    And I press "Create my new account"
103
    And I should see "Confirm your account"
104
    And I should see "An email should have been sent to your address at user1@address.invalid"
105
    And I confirm email for "user1"
106
    And I should see "Thanks, User1 L1"
107
    And I should see "Your registration has been confirmed"
108
    And I open my profile in edit mode
109
    And the field "First name" matches value "User1"
110
    And I log out
111
    # Confirm that user can login and browse the site.
112
    And I log in as "user1"
113
    And I follow "Profile" in the user menu
114
    # User can see his own agreements in the profile.
115
    And I follow "Policies and agreements"
116
    And "Accepted" "text" should exist in the "This site policy" "table_row"
117
    And I log out
118
 
119
  Scenario: Accept policy on sign up, multiple policies
120
    Given the following config values are set as admin:
121
      | registerauth    | email |
122
      | passwordpolicy  | 0     |
123
      | sitepolicyhandler | tool_policy |
124
    Given the following policies exist:
125
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
126
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
127
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
128
      | This guests policy  | 0    |          | full text4 | short text4 | active   | guest    |
129
    And I am on site homepage
130
    And I follow "Log in"
131
    When I click on "Create new account" "link"
132
    Then I should see "This site policy" in the "region-main" "region"
133
    And I should see "short text2"
134
    And I should see "full text2"
135
    And I press "Next"
136
    And I should see "This privacy policy" in the "region-main" "region"
137
    And I should see "short text3"
138
    And I should see "full text3"
139
    And I press "Next"
140
    And I should see "Please agree to the following policies"
141
    And I should see "This site policy" in the "region-main" "region"
142
    And I should see "short text2"
143
    And I should not see "full text2"
144
    And I should see "This privacy policy" in the "region-main" "region"
145
    And I should see "short text3"
146
    And I should not see "full text3"
147
    And I should not see "This guests policy" in the "region-main" "region"
148
    And I should not see "short text4"
149
    And I should not see "full text4"
150
    And I set the field "I agree to the This site policy" to "1"
151
    And I set the field "I agree to the This privacy policy" to "1"
152
    And I press "Next"
153
    And I should not see "I understand and agree"
154
    And I set the following fields to these values:
155
      | Username      | user1                 |
156
      | Password      | user1                 |
157
      | Email address | user1@address.invalid |
158
      | Email (again) | user1@address.invalid |
159
      | First name    | User1                 |
160
      | Last name     | L1                    |
161
    And I press "Create my new account"
162
    And I should see "Confirm your account"
163
    And I should see "An email should have been sent to your address at user1@address.invalid"
164
    And I confirm email for "user1"
165
    And I should see "Thanks, User1 L1"
166
    And I should see "Your registration has been confirmed"
167
    And I open my profile in edit mode
168
    And the field "First name" matches value "User1"
169
    And I log out
170
    # Confirm that user can login and browse the site.
171
    And I log in as "user1"
172
    And I follow "Profile" in the user menu
173
    # User can see his own agreements in the profile.
174
    And I follow "Policies and agreements"
175
    And "Accepted" "text" should exist in the "This site policy" "table_row"
176
    And "Accepted" "text" should exist in the "This privacy policy" "table_row"
177
    And I should not see "This guests policy"
178
    And I log out
179
 
180
  Scenario: Accept policy on sign up and age verification
181
    Given the following config values are set as admin:
182
      | registerauth    | email |
183
      | passwordpolicy  | 0     |
184
      | sitepolicyhandler | tool_policy |
185
      | agedigitalconsentverification | 1 |
186
    Given the following policies exist:
187
      | Name             | Revision | Content    | Summary     | Status   |
188
      | This site policy |          | full text2 | short text2 | active   |
189
    And I am on site homepage
190
    And I follow "Log in"
191
    When I click on "Create new account" "link"
192
    Then I should see "Age and location verification"
193
    And I set the field "What is your age?" to "16"
194
    And I set the field "In which country do you live?" to "DZ"
195
    And I press "Proceed"
196
    And I should see "This site policy"
197
    And I should see "short text2"
198
    And I should see "full text2"
199
    And I press "Next"
200
    And I should see "Please agree to the following policies"
201
    And I should see "This site policy"
202
    And I should see "short text2"
203
    And I should not see "full text2"
204
    And I set the field "I agree to the This site policy" to "1"
205
    And I press "Next"
206
    And I should not see "I understand and agree"
207
    And I set the following fields to these values:
208
      | Username      | user1                 |
209
      | Password      | user1                 |
210
      | Email address | user1@address.invalid |
211
      | Email (again) | user1@address.invalid |
212
      | First name    | User1                 |
213
      | Last name     | L1                    |
214
    And I press "Create my new account"
215
    And I should see "Confirm your account"
216
    And I should see "An email should have been sent to your address at user1@address.invalid"
217
    And I confirm email for "user1"
218
    And I should see "Thanks, User1 L1"
219
    And I should see "Your registration has been confirmed"
220
    And I open my profile in edit mode
221
    And the field "First name" matches value "User1"
222
    And I log out
223
    # Confirm that user can login and browse the site.
224
    And I log in as "user1"
225
    And I follow "Profile" in the user menu
226
    # User can see his own agreements in the profile.
227
    And I follow "Policies and agreements"
228
    And "Accepted" "text" should exist in the "This site policy" "table_row"
229
    And I log out
230
 
231
  Scenario: Accept policy on sign up, do not accept all policies
232
    Given the following config values are set as admin:
233
      | registerauth    | email |
234
      | passwordpolicy  | 0     |
235
      | sitepolicyhandler | tool_policy |
236
    And the following policies exist:
237
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
238
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
239
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
240
    And I am on site homepage
241
    And I follow "Log in"
242
    And I click on "Create new account" "link"
243
    And I should see "This site policy"
244
    And I press "Next"
245
    And I should see "This privacy policy"
246
    And I press "Next"
247
    And I should see "Please agree to the following policies"
248
    And I should see "This site policy"
249
    And I should see "This privacy policy"
250
    # Confirm that a notification is displayed if none of the policies are accepted.
251
    When I set the field "I agree to the This site policy" to "0"
252
    And I set the field "I agree to the This privacy policy" to "0"
253
    And I press "Next"
254
    Then I should see "Please agree to the following policies"
255
    And I should see "Before continuing you need to acknowledge all these policies."
256
    # Confirm that a notification is displayed if only some policies are accepted.
257
    When I set the field "I agree to the This site policy" to "1"
258
    And I set the field "I agree to the This privacy policy" to "0"
259
    Then I should see "Please agree to the following policies"
260
    And I should see "Before continuing you need to acknowledge all these policies."
261
 
262
  Scenario: Accept policy on login, do not accept all policies
263
    Given the following config values are set as admin:
264
      | registerauth    | email |
265
      | passwordpolicy  | 0     |
266
      | sitepolicyhandler | tool_policy |
267
    And the following policies exist:
268
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
269
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
270
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
271
    And the following "users" exist:
272
      | username | firstname | lastname | email            |
273
      | user1    | User      | 1        | user1@example.com    |
274
    And I log in as "user1"
275
    And I should see "This site policy"
276
    And I press "Next"
277
    And I should see "This privacy policy"
278
    And I press "Next"
279
    And I should see "Please agree to the following policies"
280
    And I should see "This site policy"
281
    And I should see "This privacy policy"
282
    # Confirm that a notification is displayed if none of the policies are accepted.
283
    When I set the field "I agree to the This site policy" to "0"
284
    And I set the field "I agree to the This privacy policy" to "0"
285
    And I press "Next"
286
    Then I should see "Please agree to the following policies"
287
    And I should see "Before continuing you need to acknowledge all these policies."
288
    # Confirm that a notification is displayed if only some policies are accepted.
289
    When I set the field "I agree to the This site policy" to "1"
290
    And I set the field "I agree to the This privacy policy" to "0"
291
    Then I should see "Please agree to the following policies"
292
    And I should see "Before continuing you need to acknowledge all these policies."
293
    # Confirm that user can not browse the site (edit their profile).
294
    When I follow "Profile" in the user menu
295
    Then I should see "Please agree to the following policies"
296
 
297
  Scenario: Accept policy on login, accept all policies
298
    Given the following config values are set as admin:
299
      | registerauth    | email |
300
      | passwordpolicy  | 0     |
301
      | sitepolicyhandler | tool_policy |
302
    And the following policies exist:
303
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
304
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
305
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
306
    And the following "users" exist:
307
      | username | firstname | lastname | email            |
308
      | user1    | User      | 1        | user1@example.com    |
309
    And I log in as "user1"
310
    And I should see "This site policy"
311
    And I press "Next"
312
    And I should see "This privacy policy"
313
    And I press "Next"
314
    And I should see "Please agree to the following policies"
315
    And I should see "This site policy"
316
    And I should see "This privacy policy"
317
    # User accepts all policies.
318
    When I set the field "I agree to the This site policy" to "1"
319
    And I set the field "I agree to the This privacy policy" to "1"
320
    And I press "Next"
321
    Then I should not see "Please agree to the following policies"
322
    And I should not see "Before continuing you need to acknowledge all these policies."
323
    # Confirm that user can login and browse the site (edit their profile).
324
    When I open my profile in edit mode
325
    Then the field "First name" matches value "User"
326
    And I log out
327
    # Confirm when logging again as user, the policies are not displayed.
328
    When I log in as "user1"
329
    Then I should not see "This site policy"
330
    And I should not see "This privacy policy"
331
    And I should not see "Please agree to the following policies"
332
    # Confirm that user can login and browse the site (edit their profile).
333
    When I open my profile in edit mode
334
    Then the field "First name" matches value "User"
335
 
336
  Scenario: Accept policy on login, accept new policy documents
337
    Given the following config values are set as admin:
338
      | registerauth    | email |
339
      | passwordpolicy  | 0     |
340
      | sitepolicyhandler | tool_policy |
341
    And the following policies exist:
342
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
343
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
344
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
345
    And the following "users" exist:
346
      | username | firstname | lastname | email            |
347
      | user1    | User      | 1        | user1@example.com    |
348
    And I log in as "user1"
349
    And I should see "This site policy"
350
    And I press "Next"
351
    And I should see "This privacy policy"
352
    And I press "Next"
353
    And I should see "Please agree to the following policies"
354
    And I should see "This site policy"
355
    And I should see "This privacy policy"
356
    # User accepts all policies.
357
    When I set the field "I agree to the This site policy" to "1"
358
    And I set the field "I agree to the This privacy policy" to "1"
359
    And I press "Next"
360
    Then I should not see "Please agree to the following policies"
361
    # Confirm that user can login and browse the site (edit their profile).
362
    When I open my profile in edit mode
363
    Then the field "First name" matches value "User"
364
    And I log out
365
    # Create new policy document.
366
    And I log in as "admin"
367
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
368
    And I should see "Policies and agreements"
369
    And I should see "New policy"
370
    And I follow "New policy"
371
    And I set the following fields to these values:
372
      | Name          | This third parties policy |
373
      | Type          | Third parties policy      |
374
      | User consent  | All users                 |
375
      | Summary       | short text4               |
376
      | Full policy   | full text4                |
377
      | Active        | 1                    |
378
    When I press "Save"
379
    Then I should see "Policies and agreements"
380
    And I should see "This third parties policy"
381
    And I log out
382
    # Confirm when logging again as user, the new policies are displayed.
383
    When I log in as "user1"
384
    And I should not see "This site policy"
385
    And I should not see "This privacy policy"
386
    Then I should see "This third parties policy"
387
    And I press "Next"
388
    And I should see "Please agree to the following policies"
389
    And I should see "This third parties policy"
390
    And I set the field "This third parties policy" to "1"
391
    And I press "Next"
392
    # Confirm that user can login and browse the site (edit their profile).
393
    When I open my profile in edit mode
394
    Then the field "First name" matches value "User"
395
 
396
  Scenario: Accept policy on login, accept new policy version
397
    Given the following config values are set as admin:
398
      | registerauth    | email |
399
      | passwordpolicy  | 0     |
400
      | sitepolicyhandler | tool_policy |
401
    And the following policies exist:
402
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
403
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
404
    And the following "users" exist:
405
      | username | firstname | lastname | email            |
406
      | user1    | User      | 1        | user1@example.com    |
407
    And I log in as "user1"
408
    And I should see "This site policy"
409
    And I press "Next"
410
    And I should see "Please agree to the following policies"
411
    And I should see "This site policy"
412
    # User accepts policy.
413
    When I set the field "I agree to the This site policy" to "1"
414
    And I press "Next"
415
    Then I should not see "Please agree to the following policies"
416
    # Confirm that user can login and browse the site (edit their profile).
417
    When I open my profile in edit mode
418
    Then the field "First name" matches value "User"
419
    And I log out
420
    # Create new version of the policy document.
421
    And I log in as "admin"
422
    And I navigate to "Users > Privacy and policies > Manage policies" in site administration
423
    # Menu is already open because javascript is disabled.
424
    Then I should see "View"
425
    And I should see "Edit"
426
    And I should see "Set status to \"Inactive\""
427
    When I follow "Edit"
428
    Then I should see "Editing policy"
429
    And I set the field "Name" to "This site policy new version"
430
    And I set the field "Summary" to "short text2 new version"
431
    And I set the field "Full policy" to "full text2 new version"
432
    And I press "Save"
433
    And I log out
434
    # Confirm that the user has to agree to the new version of the policy.
435
    When I log in as "user1"
436
    Then I should see "This site policy new version"
437
    And I should see "short text2 new version"
438
    And I should see "full text2 new version"
439
    When I press "Next"
440
    Then I should see "Please agree to the following policies"
441
    And I should see "This site policy new version"
442
    And I should see "short text2 new version"
443
    # User accepts policy.
444
    And I set the field "I agree to the This site policy new version" to "1"
445
    When I press "Next"
446
    Then I should not see "Please agree to the following policies"
447
    # Confirm that user can login and browse the site (edit their profile).
448
    When I open my profile in edit mode
449
    Then the field "First name" matches value "User"
450
 
451
  @javascript
452
  Scenario: Accept policy on login as guest
453
    Given the following config values are set as admin:
454
      | registerauth    | email |
455
      | passwordpolicy  | 0     |
456
      | sitepolicyhandler | tool_policy |
457
    And the following policies exist:
458
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
459
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
460
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
461
      | This guests policy  | 0    |          | full text4 | short text4 | active   | guest    |
462
    And I am on site homepage
463
    And I change window size to "large"
464
    And I follow "Log in"
465
    When I press "Access as a guest"
466
    Then I should see "If you continue browsing this website, you agree to our policies"
467
    # Confirm when navigating, the pop-up policies are displayed.
468
    When I am on the "My courses" page
469
    Then I should see "If you continue browsing this website, you agree to our policies"
470
    And I should see "This site policy"
471
    And I should see "This guests policy"
472
    And I should not see "This privacy policy"
473
    # Confirm when clicking on the policy links, the policy content is displayed.
474
    When I click on "This site policy" "link"
475
    Then I should see "full text2"
476
    And I click on "Close" "button" in the "This site policy" "dialogue"
477
    And I should not see "full text2"
478
    When I click on "This guests policy" "link"
479
    Then I should see "full text4"
480
    And I click on "Close" "button" in the "This guests policy" "dialogue"
481
    And I should not see "full text4"
482
    # Confirm when agreeing to policies the pop-up is no longer displayed.
483
    When I follow "Continue"
484
    Then I should not see "If you continue browsing this website, you agree to our policies"
485
 
486
  Scenario: Accept policy on sign up, after completing sign up attempt to create another account
487
    Given the following config values are set as admin:
488
      | registerauth    | email |
489
      | passwordpolicy  | 0     |
490
      | sitepolicyhandler | tool_policy |
491
    Given the following policies exist:
492
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
493
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
494
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
495
      | This guests policy  | 0    |          | full text4 | short text4 | active   | guest    |
496
    And I am on site homepage
497
    And I follow "Log in"
498
    When I click on "Create new account" "link"
499
    Then I should see "This site policy" in the "region-main" "region"
500
    And I should see "short text2"
501
    And I should see "full text2"
502
    When I press "Next"
503
    Then I should see "This privacy policy" in the "region-main" "region"
504
    And I should see "short text3"
505
    And I should see "full text3"
506
    When I press "Next"
507
    Then I should see "Please agree to the following policies"
508
    And I should see "This site policy" in the "region-main" "region"
509
    And I should see "short text2"
510
    And I should see "This privacy policy" in the "region-main" "region"
511
    And I should see "short text3"
512
    And I should not see "This guests policy" in the "region-main" "region"
513
    And I should not see "short text4"
514
    And I set the field "I agree to the This site policy" to "1"
515
    And I set the field "I agree to the This privacy policy" to "1"
516
    When I press "Next"
517
    Then I should not see "I understand and agree"
518
    And I should see "New account"
519
    And I set the following fields to these values:
520
      | Username      | user1                 |
521
      | Password      | user1                 |
522
      | Email address | user1@address.invalid |
523
      | Email (again) | user1@address.invalid |
524
      | First name    | User1                 |
525
      | Last name     | L1                    |
526
    When I press "Create my new account"
527
    Then I should see "Confirm your account"
528
    And I should see "An email should have been sent to your address at user1@address.invalid"
529
    And I follow "Log in"
530
    When I click on "Create new account" "link"
531
    # Confirm that the user can view and accept policies when attempting to create another account.
532
    Then I should see "This site policy" in the "region-main" "region"
533
    And I should see "short text2"
534
    And I should see "full text2"
535
    When I press "Next"
536
    Then I should see "This privacy policy" in the "region-main" "region"
537
    And I should see "short text3"
538
    And I should see "full text3"
539
    When I press "Next"
540
    Then I should see "Please agree to the following policies"
541
    And I should see "This site policy" in the "region-main" "region"
542
    And I should see "short text2"
543
    And I should not see "full text2"
544
    And I should see "This privacy policy" in the "region-main" "region"
545
    And I should see "short text3"
546
    And I should not see "full text3"
547
    And I should not see "This guests policy" in the "region-main" "region"
548
    And I should not see "short text4"
549
    And I should not see "full text4"
550
    And I set the field "I agree to the This site policy" to "1"
551
    And I set the field "I agree to the This privacy policy" to "1"
552
    When I press "Next"
553
    Then I should not see "I understand and agree"
554
    And I should see "New account"
555
 
556
  Scenario: Accept policy while being logged in as another user
557
    Given the following config values are set as admin:
558
      | sitepolicyhandler | tool_policy |
559
    And the following policies exist:
560
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
561
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
562
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
563
    And the following "users" exist:
564
      | username | firstname | lastname | email            |
565
      | user1    | User      | 1        | user1@example.com    |
566
    When I am on the "user1" "user > profile" page logged in as "admin"
567
    And I follow "Log in as"
568
    Then I should see "You are logged in as User 1"
569
    And I press "Continue"
570
    And I should see "Please read our This site policy"
571
    And I press "Next"
572
    And I should see "Please read our This privacy policy"
573
    And I press "Next"
574
    And I should see "Viewing this page on behalf of User 1"
575
    And I set the field "I agree to the This site policy" to "1"
576
    And I set the field "I agree to the This privacy policy" to "1"
577
    And I press "Next"
578
    And I log out
579
    And I log in as "user1"
580
    And I follow "Profile" in the user menu
581
    And I follow "Policies and agreements"
582
    And "Admin User" "link" should exist in the "This site policy" "table_row"
583
    And "Admin User" "link" should exist in the "This privacy policy" "table_row"
584
 
585
  Scenario: Log in as another user without capability to accept policies on their behalf
586
    Given the following config values are set as admin:
587
      | sitepolicyhandler | tool_policy |
588
    And the following policies exist:
589
      | Name                | Type | Revision | Content    | Summary     | Status   | Audience |
590
      | This site policy    | 0    |          | full text2 | short text2 | active   | all      |
591
      | This privacy policy | 1    |          | full text3 | short text3 | active   | loggedin |
592
    And the following "users" exist:
593
      | username | firstname | lastname | email            |
594
      | user1    | User      | 1        | user1@example.com    |
595
      | manager  | Max       | Manager  | man@example.com |
596
    And the following "role assigns" exist:
597
      | user    | role           | contextlevel | reference |
598
      | manager | manager        | System       |           |
599
    When I log in as "manager"
600
    And I press "Next"
601
    And I press "Next"
602
    And I set the field "I agree to the This site policy" to "1"
603
    And I set the field "I agree to the This privacy policy" to "1"
604
    And I press "Next"
605
    And I am on the "user1" "user > profile" page
606
    And I follow "Log in as"
607
    Then I should see "You are logged in as User 1"
608
    And I press "Continue"
609
    And I should see "Policies and agreements"
610
    And I should see "No permission to agree to the policies on behalf of this user"
611
    And I should see "Sorry, you do not have the required permission to agree to the following policies on behalf of User 1"
612
 
613
  Scenario: Accept policy on sign up as a guest, one policy
614
    Given the following config values are set as admin:
615
      | registerauth    | email |
616
      | passwordpolicy  | 0     |
617
      | sitepolicyhandler | tool_policy |
618
    Given the following policies exist:
619
      | Policy | Name             | Revision | Content    | Summary     | Status   |
620
      | P1     | This site policy |          | full text1 | short text1 | archived |
621
      | P1     | This site policy |          | full text2 | short text2 | active   |
622
      | P1     | This site policy |          | full text3 | short text3 | draft    |
623
    And I am on site homepage
624
    And I follow "Log in"
625
    # First log in as a guest
626
    And I press "Access as a guest"
627
    # Now sign up
628
    And I follow "Log in"
629
    When I click on "Create new account" "link"
630
    Then I should see "This site policy"
631
    And I should see "short text2"
632
    And I should see "full text2"
633
    And I press "Next"
634
    And I should see "Please agree to the following policies"
635
    And I should see "This site policy"
636
    And I should see "short text2"
637
    And I should not see "full text2"
638
    And I set the field "I agree to the This site policy" to "1"
639
    And I press "Next"
640
    And I should not see "I understand and agree"
641
    And I set the following fields to these values:
642
      | Username      | user1                 |
643
      | Password      | user1                 |
644
      | Email address | user1@address.invalid |
645
      | Email (again) | user1@address.invalid |
646
      | First name    | User1                 |
647
      | Last name     | L1                    |
648
    And I press "Create my new account"
649
    And I should see "Confirm your account"
650
    And I should see "An email should have been sent to your address at user1@address.invalid"
651
    And I confirm email for "user1"
652
    And I should see "Thanks, User1 L1"
653
    And I should see "Your registration has been confirmed"
654
    And I open my profile in edit mode
655
    And the field "First name" matches value "User1"
656
    And I log out
657
    # Confirm that user can login and browse the site.
658
    And I log in as "user1"
659
    And I follow "Profile" in the user menu
660
    # User can see his own agreements in the profile.
661
    And I follow "Policies and agreements"
662
    And "Accepted" "text" should exist in the "This site policy" "table_row"
663
    And I log out
664
 
665
  Scenario: Accepting policies on sign up, multiple policies with different style of giving ageement.
666
    Given the following config values are set as admin:
667
      | registerauth      | email       |
668
      | passwordpolicy    | 0           |
669
      | sitepolicyhandler | tool_policy |
670
    And the following policies exist:
671
      | name                          | summary                   | content             | agreementstyle  |
672
      | Privacy policy                | We scan your thoughts     | Here goes content.  | 0               |
673
      | Digital maturity declaration  | You declare be old enough | Here goes content.  | 1               |
674
      | Cookies policy                | We eat cookies, srsly     | Here goes content.  | 0               |
675
      | Terms of Service              | We teach, you learn       | Here goes content.  | 1               |
676
    And I am on site homepage
677
    And I follow "Log in"
678
    When I click on "Create new account" "link"
679
    # The first policy with the agreement style "on its own page" must be accepted first.
680
    Then I should see "Digital maturity declaration" in the "region-main" "region"
681
    And I should see "You declare be old enough"
682
    And I should see "Here goes content."
683
    And I press "I agree to the Digital maturity declaration"
684
    # The second policy with the agreement style "on its own page" must be accepted now.
685
    And I should see "Terms of Service" in the "region-main" "region"
686
    And I should see "We teach, you learn"
687
    And I should see "Here goes content."
688
    And I press "I agree to the Terms of Service"
689
    # Only now we see the remaining consent page policies.
690
    And I should see "Policy 1 out of 2"
691
    And I should see "Privacy policy" in the "region-main" "region"
692
    And I should see "We scan your thoughts"
693
    And I should see "Here goes content."
694
    And I press "Next"
695
    And I should see "Policy 2 out of 2"
696
    And I should see "Cookies policy" in the "region-main" "region"
697
    And I should see "We eat cookies, srsly"
698
    And I should see "Here goes content."
699
    And I press "Next"
700
    And I should see "Please agree to the following policies"
701
    And I should see "Privacy policy"
702
    And I should see "Cookies policy"
703
    And I should not see "Digital maturity declaration" in the "region-main" "region"
704
    And I should not see "Terms of Service" in the "region-main" "region"
705
    And I should not see "Here goes content."
706
    And I set the field "I agree to the Privacy policy" to "1"
707
    And I set the field "I agree to the Cookies policy" to "1"
708
    And I press "Next"
709
    And I should see "New account"
710
    And I set the following fields to these values:
711
      | Username      | user1                 |
712
      | Password      | user1                 |
713
      | Email address | user1@address.invalid |
714
      | Email (again) | user1@address.invalid |
715
      | First name    | User1                 |
716
      | Last name     | L1                    |
717
    And I press "Create my new account"
718
    And I should see "Confirm your account"
719
    And I should see "An email should have been sent to your address at user1@address.invalid"
720
    And I confirm email for "user1"
721
    And I should see "Thanks, User1 L1"
722
    And I should see "Your registration has been confirmed"
723
    And I open my profile in edit mode
724
    And the field "First name" matches value "User1"
725
    And I log out
726
    # Confirm that user can login and browse the site.
727
    And I log in as "user1"
728
    And I follow "Profile" in the user menu
729
    # User can see his own agreements in the profile.
730
    And I follow "Policies and agreements"
731
    And "Accepted" "text" should exist in the "Privacy policy" "table_row"
732
    And "Accepted" "text" should exist in the "Cookies policy" "table_row"
733
    And "Accepted" "text" should exist in the "Terms of Service" "table_row"
734
    And "Accepted" "text" should exist in the "Digital maturity declaration" "table_row"
735
    And I log out
736
 
737
  Scenario: Accepting policies on login, multiple policies with different style of giving ageement.
738
    Given the following config values are set as admin:
739
      | sitepolicyhandler | tool_policy |
740
    And the following policies exist:
741
      | name                          | summary                   | content             | agreementstyle  |
742
      | Digital maturity declaration  | You declare be old enough | Here goes content.  | 1               |
743
      | Privacy policy                | We scan your thoughts     | Here goes content.  | 0               |
744
      | Terms of Service              | We teach, you learn       | Here goes content.  | 1               |
745
      | Cookies policy                | We eat cookies, srsly     | Here goes content.  | 0               |
746
    And the following "users" exist:
747
      | username | firstname | lastname | email             |
748
      | user1    | User      | One      | user1@example.com |
749
    And I log in as "user1"
750
    # The first policy with the agreement style "on its own page" must be accepted first.
751
    Then I should see "Digital maturity declaration" in the "region-main" "region"
752
    And I should see "You declare be old enough"
753
    And I should see "Here goes content."
754
    And I press "I agree to the Digital maturity declaration"
755
    # The second policy with the agreement style "on its own page" must be accepted now.
756
    And I should see "Terms of Service" in the "region-main" "region"
757
    And I should see "We teach, you learn"
758
    And I should see "Here goes content."
759
    # If the user logs out now, only the first policy is accepted and we return to the same page.
760
    And I log out
761
    And I log in as "user1"
762
    And I should see "Terms of Service" in the "region-main" "region"
763
    And I should see "We teach, you learn"
764
    And I should see "Here goes content."
765
    And I press "I agree to the Terms of Service"
766
    # Only now we see the remaining consent page policies.
767
    And I should see "Policy 1 out of 2"
768
    And I should see "Privacy policy" in the "region-main" "region"
769
    And I should see "We scan your thoughts"
770
    And I should see "Here goes content."
771
    And I press "Next"
772
    And I should see "Policy 2 out of 2"
773
    And I should see "Cookies policy" in the "region-main" "region"
774
    And I should see "We eat cookies, srsly"
775
    And I should see "Here goes content."
776
    And I press "Next"
777
    And I should see "Please agree to the following policies"
778
    And I should see "Privacy policy"
779
    And I should see "Cookies policy"
780
    And I should not see "Digital maturity declaration" in the "region-main" "region"
781
    And I should not see "Terms of Service" in the "region-main" "region"
782
    And I should not see "Here goes content."
783
    And I set the field "I agree to the Privacy policy" to "1"
784
    And I set the field "I agree to the Cookies policy" to "1"
785
    And I press "Next"
786
    And I follow "Profile" in the user menu
787
    # User can see his own agreements in the profile.
788
    And I follow "Policies and agreements"
789
    And "Accepted" "text" should exist in the "Privacy policy" "table_row"
790
    And "Accepted" "text" should exist in the "Cookies policy" "table_row"
791
    And "Accepted" "text" should exist in the "Terms of Service" "table_row"
792
    And "Accepted" "text" should exist in the "Digital maturity declaration" "table_row"
793
    And I log out
794
 
795
  Scenario: Accepting policies on login, all and loggedin policies to be accepted on their own page.
796
    Given the following config values are set as admin:
797
      | sitepolicyhandler | tool_policy |
798
    And the following policies exist:
799
      | name                          | summary                   | content             | agreementstyle  | audience  |
800
      | Privacy policy                | We scan your thoughts     | Here goes content.  | 1               | all       |
801
      | Digital maturity declaration  | You declare be old enough | Here goes content.  | 1               | loggedin  |
802
      | Cookies policy                | We eat cookies, srsly     | Here goes content.  | 1               | guest     |
803
      | Terms of Service              | We teach, you learn       | Here goes content.  | 1               | all       |
804
    And the following "users" exist:
805
      | username | firstname | lastname | email             |
806
      | user1    | User      | One      | user1@example.com |
807
    And I log in as "user1"
808
    # All the policies to be displayed one by one with a button to accept each of them prior seeing the next.
809
    Then I should see "Privacy policy" in the "region-main" "region"
810
    And I should see "We scan your thoughts"
811
    And I should see "Here goes content."
812
    And I press "I agree to the Privacy policy"
813
    And I should see "Digital maturity declaration" in the "region-main" "region"
814
    And I should see "You declare be old enough"
815
    And I should see "Here goes content."
816
    And I press "I agree to the Digital maturity declaration"
817
    And I should see "Terms of Service" in the "region-main" "region"
818
    And I should see "We teach, you learn"
819
    And I should see "Here goes content."
820
    And I press "I agree to the Terms of Service"
821
    And I follow "Profile" in the user menu
822
    And I follow "Policies and agreements"
823
    And "Accepted" "text" should exist in the "Privacy policy" "table_row"
824
    And "Accepted" "text" should exist in the "Terms of Service" "table_row"
825
    And "Accepted" "text" should exist in the "Digital maturity declaration" "table_row"
826
    And "Cookies policy" "table_row" should not exist
827
    And I log out
828
 
829
  Scenario: Accepting policies on sign up, policies to be accepted on their own page.
830
    Given the following config values are set as admin:
831
      | registerauth      | email       |
832
      | passwordpolicy    | 0           |
833
      | sitepolicyhandler | tool_policy |
834
    And the following policies exist:
835
      | name                          | summary                   | content             | agreementstyle  | audience  |
836
      | Privacy policy                | We scan your thoughts     | Here goes content.  | 1               | guest     |
837
      | Digital maturity declaration  | You declare be old enough | Here goes content.  | 1               | all       |
838
      | Cookies policy                | We eat cookies, srsly     | Here goes content.  | 1               | loggedin  |
839
      | Terms of Service              | We teach, you learn       | Here goes content.  | 1               | guest     |
840
    And I am on site homepage
841
    And I follow "Log in"
842
    When I click on "Create new account" "link"
843
    # All the policies to be displayed one by one with a button to accept each of them prior seeing the next.
844
    Then I should see "Digital maturity declaration" in the "region-main" "region"
845
    And I should see "You declare be old enough"
846
    And I should see "Here goes content."
847
    And I press "I agree to the Digital maturity declaration"
848
    And I should see "Cookies policy" in the "region-main" "region"
849
    And I should see "We eat cookies, srsly"
850
    And I press "I agree to the Cookies policy"
851
    And I should see "New account"
852
    And I set the following fields to these values:
853
      | Username      | user1                 |
854
      | Password      | user1                 |
855
      | Email address | user1@address.invalid |
856
      | Email (again) | user1@address.invalid |
857
      | First name    | User1                 |
858
      | Last name     | L1                    |
859
    And I press "Create my new account"
860
    And I should see "Confirm your account"
861
    And I should see "An email should have been sent to your address at user1@address.invalid"
862
    And I confirm email for "user1"
863
    And I should see "Thanks, User1 L1"
864
    And I should see "Your registration has been confirmed"
865
    And I open my profile in edit mode
866
    And the field "First name" matches value "User1"
867
    And I log out
868
    # Confirm that user can login and browse the site.
869
    And I log in as "user1"
870
    And I follow "Profile" in the user menu
871
    # User can see his own agreements in the profile.
872
    And I follow "Policies and agreements"
873
    And "Accepted" "text" should exist in the "Digital maturity declaration" "table_row"
874
    And "Accepted" "text" should exist in the "Cookies policy" "table_row"
875
    And "Privacy policy" "table_row" should not exist
876
    And "Terms of Service" "table_row" should not exist
877
    And I log out