MDL-64821 mod_forum: increase data privacy export expected size
[moodle.git] / admin / tool / dataprivacy / tests / behat / dataexport.feature
CommitLineData
635c7b29 1@tool @tool_dataprivacy
2Feature: Data export from the privacy API
3 In order to export data for users and meet legal requirements
4 As an admin, user, or parent
5 I need to be able to export data for a user
6
7 Background:
8 Given the following "users" exist:
81eb8b2b
KC
9 | username | firstname | lastname | institution |
10 | victim | Victim User | 1 | University1 |
11 | victim2 | Victim User | 2 | University2 |
12 | requester | The | Requester | University3 |
13 | parent | Long-suffering | Parent | |
635c7b29 14 And the following "roles" exist:
15 | shortname | name | archetype |
16 | tired | Tired | |
17 And the following "permission overrides" exist:
81eb8b2b
KC
18 | capability | permission | role | contextlevel | reference |
19 | tool/dataprivacy:makedatarequestsforchildren | Allow | tired | System | |
20 | tool/dataprivacy:managedatarequests | Allow | manager | System | |
21 | moodle/site:viewuseridentity | Prevent | manager | System | |
635c7b29 22 And the following "role assigns" exist:
23 | user | role | contextlevel | reference |
24 | parent | tired | User | victim |
81eb8b2b
KC
25 And the following "system role assigns" exist:
26 | user | role | contextlevel |
27 | requester | manager | User |
635c7b29 28 And the following config values are set as admin:
a1e1cf63
MH
29 | contactdataprotectionofficer | 1 | tool_dataprivacy |
30 | privacyrequestexpiry | 55 | tool_dataprivacy |
81eb8b2b 31 | dporoles | 1 | tool_dataprivacy |
95a3f780
MH
32 And the following data privacy "categories" exist:
33 | name |
34 | Site category |
35 And the following data privacy "purposes" exist:
36 | name | retentionperiod |
37 | Site purpose | P10Y |
38 And I set the site category and purpose to "Site category" and "Site purpose"
635c7b29 39
40 @javascript
a1e1cf63 41 Scenario: As admin, export data for a user and download it, unless it has expired
635c7b29 42 Given I log in as "admin"
43 And I navigate to "Users > Privacy and policies > Data requests" in site administration
44 And I follow "New request"
f5d98e61 45 And I set the field "User" to "Victim User 1"
635c7b29 46 And I press "Save changes"
47 Then I should see "Victim User 1"
635c7b29 48 And I should see "Awaiting approval" in the "Victim User 1" "table_row"
cfd390ee 49 And I open the action menu in "Victim User 1" "table_row"
635c7b29 50 And I follow "Approve request"
51 And I press "Approve request"
52 And I should see "Approved" in the "Victim User 1" "table_row"
53 And I run all adhoc tasks
54 And I reload the page
a1e1cf63 55 And I should see "Download ready" in the "Victim User 1" "table_row"
cfd390ee 56 And I open the action menu in "Victim User 1" "table_row"
cc28bff6 57 And following "Download" should download between "1" and "140000" bytes
a1e1cf63
MH
58 And the following config values are set as admin:
59 | privacyrequestexpiry | 1 | tool_dataprivacy |
60 And I wait "1" seconds
61 And I navigate to "Users > Privacy and policies > Data requests" in site administration
62 And I should see "Expired" in the "Victim User 1" "table_row"
cfd390ee 63 And I open the action menu in "Victim User 1" "table_row"
a1e1cf63 64 And I should not see "Download"
635c7b29 65
66 @javascript
a1e1cf63 67 Scenario: As a student, request data export and then download it when approved, unless it has expired
635c7b29 68 Given I log in as "victim"
69 And I follow "Profile" in the user menu
70 And I follow "Data requests"
71 And I follow "New request"
72 And I press "Save changes"
73 Then I should see "Export all of my personal data"
635c7b29 74 And I should see "Awaiting approval" in the "Export all of my personal data" "table_row"
75
76 And I log out
77 And I log in as "admin"
78 And I navigate to "Users > Privacy and policies > Data requests" in site administration
cfd390ee 79 And I open the action menu in "Victim User 1" "table_row"
635c7b29 80 And I follow "Approve request"
81 And I press "Approve request"
82
83 And I log out
84 And I log in as "victim"
85 And I follow "Profile" in the user menu
86 And I follow "Data requests"
87 And I should see "Approved" in the "Export all of my personal data" "table_row"
88 And I run all adhoc tasks
89 And I reload the page
a1e1cf63 90 And I should see "Download ready" in the "Export all of my personal data" "table_row"
cfd390ee 91 And I open the action menu in "Victim User 1" "table_row"
cc28bff6 92 And following "Download" should download between "1" and "140000" bytes
635c7b29 93
a1e1cf63
MH
94 And the following config values are set as admin:
95 | privacyrequestexpiry | 1 | tool_dataprivacy |
96 And I wait "1" seconds
97 And I reload the page
98
99 And I should see "Expired" in the "Export all of my personal data" "table_row"
100 And I should not see "Actions"
101
635c7b29 102 @javascript
103 Scenario: As a parent, request data export for my child because I don't trust the little blighter
104 Given I log in as "parent"
105 And I follow "Profile" in the user menu
106 And I follow "Data requests"
107 And I follow "New request"
f5d98e61 108 And I set the field "User" to "Victim User 1"
635c7b29 109 And I press "Save changes"
110 Then I should see "Victim User 1"
635c7b29 111 And I should see "Awaiting approval" in the "Victim User 1" "table_row"
112
113 And I log out
114 And I log in as "admin"
115 And I navigate to "Users > Privacy and policies > Data requests" in site administration
cfd390ee 116 And I open the action menu in "Victim User 1" "table_row"
635c7b29 117 And I follow "Approve request"
118 And I press "Approve request"
119
120 And I log out
121 And I log in as "parent"
122 And I follow "Profile" in the user menu
123 And I follow "Data requests"
124 And I should see "Approved" in the "Victim User 1" "table_row"
125 And I run all adhoc tasks
126 And I reload the page
a1e1cf63 127 And I should see "Download ready" in the "Victim User 1" "table_row"
cfd390ee 128 And I open the action menu in "Victim User 1" "table_row"
cc28bff6 129 And following "Download" should download between "1" and "140000" bytes
a1e1cf63
MH
130
131 And the following config values are set as admin:
132 | privacyrequestexpiry | 1 | tool_dataprivacy |
133 And I wait "1" seconds
134 And I reload the page
135
136 And I should see "Expired" in the "Victim User 1" "table_row"
137 And I should not see "Actions"
81eb8b2b
KC
138
139 @javascript
140 Scenario: Test search for user using extra field.
141 Given the following "permission overrides" exist:
142 | capability | permission | role | contextlevel | reference |
143 | moodle/site:viewuseridentity | Allow | manager | System | |
144 And the following config values are set as admin:
145 | showuseridentity | institution |
146 And I log in as "requester"
147 And I navigate to "Users > Privacy and policies > Data requests" in site administration
148 And I follow "New request"
149 And I set the field "Search" to "University1"
150 Then I should see "Victim User 1"
151 When I reload the page
152 And I set the field "Search" to "University2"
153 Then I should see "Victim User 2"