Skip to content

Commit 9e0b1d4

Browse files
committed
MOBILE-4329 dataprivacy: Add behat tests
1 parent cc2f238 commit 9e0b1d4

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed

.github/workflows/acceptance.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
"@core_comments"
8585
"@core_course"
8686
"@core_courses"
87+
"@core_dataprivacy"
8788
"@core_grades"
8889
"@core_login"
8990
"@core_mainmenu"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@core_dataprivacy @app @javascript @lms_from4.4
2+
Feature: Contact the privacy officer
3+
As a user
4+
In order to reach out to the site's privacy officer
5+
I need to be able to contact the site's privacy officer in Moodle
6+
7+
Background:
8+
Given the following "users" exist:
9+
| username | firstname | lastname | email |
10+
| student1 | Student | 1 | s1@example.com |
11+
12+
Scenario: Contacting the privacy officer
13+
Given the following config values are set as admin:
14+
| contactdataprotectionofficer | 1 | tool_dataprivacy |
15+
When I entered the app as "student1"
16+
And I press the user menu button in the app
17+
And I press "Data privacy" in the app
18+
And I press "Contact the privacy officer" in the app
19+
And I set the field "Message" to "Hello DPO!" in the app
20+
And I press "Send" in the app
21+
Then I should find "Your request has been submitted to the privacy officer" in the app
22+
And I should find "Hello DPO!" in the app
23+
24+
Scenario: Contacting the privacy officer when not enabled
25+
When I entered the app as "student1"
26+
And I press the user menu button in the app
27+
Then I should not find ""Data privacy" in the app
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@core_dataprivacy @app @javascript @lms_from4.4
2+
Feature: Data export and delete from the privacy API
3+
In order to export or delete data for users and meet legal requirements
4+
I need to be able to request my data data be exported or deleted
5+
6+
Background:
7+
Given the following "users" exist:
8+
| username | firstname | lastname |
9+
| victim | Victim User | 1 |
10+
And the following config values are set as admin:
11+
| contactdataprotectionofficer | 1 | tool_dataprivacy |
12+
| privacyrequestexpiry | 55 | tool_dataprivacy |
13+
| dporoles | 1 | tool_dataprivacy |
14+
15+
Scenario: As a student, request deletion of account and data
16+
Given I entered the app as "victim"
17+
And I press the user menu button in the app
18+
And I press "Data privacy" in the app
19+
And I press "New request" in the app
20+
And I press "Delete all of my personal data" in the app
21+
And I press "Send" in the app
22+
Then I should find "Delete all of my personal data" in the app
23+
And I should find "Awaiting approval" near "Delete all of my personal data" in the app
24+
25+
Scenario: As a student, I cannot create data deletion request unless I have permission.
26+
Given the following "permission overrides" exist:
27+
| capability | permission | role | contextlevel | reference |
28+
| tool/dataprivacy:requestdelete | Prevent | user | System | |
29+
And I entered the app as "victim"
30+
And I press the user menu button in the app
31+
And I press "Data privacy" in the app
32+
When I press "New request" in the app
33+
Then I should not find "Delete all of my personal data" in the app
34+
35+
Scenario: As a student, request data export and then see the status
36+
Given I entered the app as "victim"
37+
And I press the user menu button in the app
38+
And I press "Data privacy" in the app
39+
When I press "New request" in the app
40+
And I press "Export all of my personal data" in the app
41+
And I set the field "Comments" to "Export my data" in the app
42+
And I press "Send" in the app
43+
Then I should find "Export all of my personal data" in the app
44+
And I should find "Awaiting approval" near "Export all of my personal data" in the app
45+
And I should find "Export my data" near "Export all of my personal data" in the app
46+
47+
# The next step allows to naavigate to site administration
48+
When I change viewport size to "1200x640" in the app
49+
And I open a browser tab with url "$WWWROOT"
50+
And I log in as "admin"
51+
And I navigate to "Users > Privacy and policies > Data requests" in site administration
52+
And I open the action menu in "Victim User 1" "table_row"
53+
And I follow "Approve request"
54+
And I press "Approve request"
55+
56+
And I switch back to the app
57+
And I pull to refresh in the app
58+
Then I should find "Approved" near "Export all of my personal data" in the app
59+
When I run all adhoc tasks
60+
And I pull to refresh in the app
61+
And I should find "Download ready" near "Export all of my personal data" in the app
62+
# TODO: Add download link and test it.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@core_dataprivacy @app @javascript @lms_from4.4
2+
Feature: Manage my own data requests
3+
In order to manage my own data requests
4+
As a user
5+
I need to be able to view and cancel all my data requests
6+
7+
Background:
8+
Given the following "users" exist:
9+
| username | firstname | lastname | email |
10+
| student1 | Student | 1 | s1@example.com |
11+
And the following config values are set as admin:
12+
| contactdataprotectionofficer | 1 | tool_dataprivacy |
13+
14+
Scenario: Cancel my own data request
15+
Given I entered the app as "student1"
16+
And I press the user menu button in the app
17+
And I press "Data privacy" in the app
18+
And I press "Contact the privacy officer" in the app
19+
And I set the field "Message" to "Hello DPO!" in the app
20+
And I press "Send" in the app
21+
Then I should find "Your request has been submitted to the privacy officer" in the app
22+
When I press "Cancel" near "Hello DPO!" in the app
23+
And I press "Cancel request" "button" in the app
24+
Then I should find "Cancelled" near "Hello DPO!" in the app

0 commit comments

Comments
 (0)