MOBILE-4329 dataprivacy: Add behat tests
This commit is contained in:
		
							parent
							
								
									cc2f238d68
								
							
						
					
					
						commit
						9e0b1d45cd
					
				
							
								
								
									
										1
									
								
								.github/workflows/acceptance.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/acceptance.yml
									
									
									
									
										vendored
									
									
								
							@ -84,6 +84,7 @@ jobs:
 | 
			
		||||
              "@core_comments"
 | 
			
		||||
              "@core_course"
 | 
			
		||||
              "@core_courses"
 | 
			
		||||
              "@core_dataprivacy"
 | 
			
		||||
              "@core_grades"
 | 
			
		||||
              "@core_login"
 | 
			
		||||
              "@core_mainmenu"
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,27 @@
 | 
			
		||||
@core_dataprivacy @app @javascript @lms_from4.4
 | 
			
		||||
Feature: Contact the privacy officer
 | 
			
		||||
  As a user
 | 
			
		||||
  In order to reach out to the site's privacy officer
 | 
			
		||||
  I need to be able to contact the site's privacy officer in Moodle
 | 
			
		||||
 | 
			
		||||
  Background:
 | 
			
		||||
    Given the following "users" exist:
 | 
			
		||||
      | username | firstname | lastname | email          |
 | 
			
		||||
      | student1 | Student   | 1        | s1@example.com |
 | 
			
		||||
 | 
			
		||||
  Scenario: Contacting the privacy officer
 | 
			
		||||
    Given the following config values are set as admin:
 | 
			
		||||
      | contactdataprotectionofficer | 1 | tool_dataprivacy |
 | 
			
		||||
    When I entered the app as "student1"
 | 
			
		||||
    And I press the user menu button in the app
 | 
			
		||||
    And I press "Data privacy" in the app
 | 
			
		||||
    And I press "Contact the privacy officer" in the app
 | 
			
		||||
    And I set the field "Message" to "Hello DPO!" in the app
 | 
			
		||||
    And I press "Send" in the app
 | 
			
		||||
    Then I should find "Your request has been submitted to the privacy officer" in the app
 | 
			
		||||
    And I should find "Hello DPO!" in the app
 | 
			
		||||
 | 
			
		||||
  Scenario: Contacting the privacy officer when not enabled
 | 
			
		||||
    When I entered the app as "student1"
 | 
			
		||||
    And I press the user menu button in the app
 | 
			
		||||
    Then I should not find ""Data privacy" in the app
 | 
			
		||||
@ -0,0 +1,62 @@
 | 
			
		||||
@core_dataprivacy @app @javascript @lms_from4.4
 | 
			
		||||
Feature: Data export and delete from the privacy API
 | 
			
		||||
  In order to export or delete data for users and meet legal requirements
 | 
			
		||||
  I need to be able to request my data data be exported or deleted
 | 
			
		||||
 | 
			
		||||
  Background:
 | 
			
		||||
    Given the following "users" exist:
 | 
			
		||||
      | username       | firstname       | lastname |
 | 
			
		||||
      | victim         | Victim User     | 1        |
 | 
			
		||||
    And the following config values are set as admin:
 | 
			
		||||
      | contactdataprotectionofficer | 1  | tool_dataprivacy |
 | 
			
		||||
      | privacyrequestexpiry         | 55 | tool_dataprivacy |
 | 
			
		||||
      | dporoles                     | 1  | tool_dataprivacy |
 | 
			
		||||
 | 
			
		||||
  Scenario: As a student, request deletion of account and data
 | 
			
		||||
    Given I entered the app as "victim"
 | 
			
		||||
    And I press the user menu button in the app
 | 
			
		||||
    And I press "Data privacy" in the app
 | 
			
		||||
    And I press "New request" in the app
 | 
			
		||||
    And I press "Delete all of my personal data" in the app
 | 
			
		||||
    And I press "Send" in the app
 | 
			
		||||
    Then I should find "Delete all of my personal data" in the app
 | 
			
		||||
    And I should find "Awaiting approval" near "Delete all of my personal data" in the app
 | 
			
		||||
 | 
			
		||||
  Scenario: As a student, I cannot create data deletion request unless I have permission.
 | 
			
		||||
    Given the following "permission overrides" exist:
 | 
			
		||||
    | capability                     | permission | role | contextlevel | reference |
 | 
			
		||||
    | tool/dataprivacy:requestdelete | Prevent    | user | System       |           |
 | 
			
		||||
    And I entered the app as "victim"
 | 
			
		||||
    And I press the user menu button in the app
 | 
			
		||||
    And I press "Data privacy" in the app
 | 
			
		||||
    When I press "New request" in the app
 | 
			
		||||
    Then I should not find "Delete all of my personal data" in the app
 | 
			
		||||
 | 
			
		||||
  Scenario: As a student, request data export and then see the status
 | 
			
		||||
    Given I entered the app as "victim"
 | 
			
		||||
    And I press the user menu button in the app
 | 
			
		||||
    And I press "Data privacy" in the app
 | 
			
		||||
    When I press "New request" in the app
 | 
			
		||||
    And I press "Export all of my personal data" in the app
 | 
			
		||||
    And I set the field "Comments" to "Export my data" in the app
 | 
			
		||||
    And I press "Send" in the app
 | 
			
		||||
    Then I should find "Export all of my personal data" in the app
 | 
			
		||||
    And I should find "Awaiting approval" near "Export all of my personal data" in the app
 | 
			
		||||
    And I should find "Export my data" near "Export all of my personal data" in the app
 | 
			
		||||
 | 
			
		||||
    # The next step allows to naavigate to site administration
 | 
			
		||||
    When I change viewport size to "1200x640" in the app
 | 
			
		||||
    And I open a browser tab with url "$WWWROOT"
 | 
			
		||||
    And I log in as "admin"
 | 
			
		||||
    And I navigate to "Users > Privacy and policies > Data requests" in site administration
 | 
			
		||||
    And I open the action menu in "Victim User 1" "table_row"
 | 
			
		||||
    And I follow "Approve request"
 | 
			
		||||
    And I press "Approve request"
 | 
			
		||||
 | 
			
		||||
    And I switch back to the app
 | 
			
		||||
    And I pull to refresh in the app
 | 
			
		||||
    Then I should find "Approved" near "Export all of my personal data" in the app
 | 
			
		||||
    When I run all adhoc tasks
 | 
			
		||||
    And I pull to refresh in the app
 | 
			
		||||
    And I should find "Download ready" near "Export all of my personal data" in the app
 | 
			
		||||
    # TODO: Add download link and test it.
 | 
			
		||||
@ -0,0 +1,24 @@
 | 
			
		||||
@core_dataprivacy @app @javascript @lms_from4.4
 | 
			
		||||
Feature: Manage my own data requests
 | 
			
		||||
  In order to manage my own data requests
 | 
			
		||||
  As a user
 | 
			
		||||
  I need to be able to view and cancel all my data requests
 | 
			
		||||
 | 
			
		||||
  Background:
 | 
			
		||||
    Given the following "users" exist:
 | 
			
		||||
      | username | firstname | lastname | email          |
 | 
			
		||||
      | student1 | Student   | 1        | s1@example.com |
 | 
			
		||||
    And the following config values are set as admin:
 | 
			
		||||
      | contactdataprotectionofficer | 1 | tool_dataprivacy |
 | 
			
		||||
 | 
			
		||||
  Scenario: Cancel my own data request
 | 
			
		||||
    Given I entered the app as "student1"
 | 
			
		||||
    And I press the user menu button in the app
 | 
			
		||||
    And I press "Data privacy" in the app
 | 
			
		||||
    And I press "Contact the privacy officer" in the app
 | 
			
		||||
    And I set the field "Message" to "Hello DPO!" in the app
 | 
			
		||||
    And I press "Send" in the app
 | 
			
		||||
    Then I should find "Your request has been submitted to the privacy officer" in the app
 | 
			
		||||
    When I press "Cancel" near "Hello DPO!" in the app
 | 
			
		||||
    And I press "Cancel request" "button" in the app
 | 
			
		||||
    Then I should find "Cancelled" near "Hello DPO!" in the app
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user