From 4bb3e3fccffbb3b9e7278bb38acee02ac82a3cdc Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Tue, 4 Sep 2018 13:08:12 +0800 Subject: [PATCH] MDL-63116 privacy: Add behat tests --- .../tests/behat/manage_data_requests.feature | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature b/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature index bdc43e763f8..9eb2a8a75cd 100644 --- a/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature +++ b/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature @@ -56,3 +56,93 @@ Feature: Manage data requests And I click on "Actions" "link" in the "Jane Doe" "table_row" And I should see "View the request" But I should not see "Mark as complete" + + @javascript + Scenario: Bulk accepting requests + Given I log in as "student1" + And I follow "Profile" in the user menu + And I should see "Data requests" + And I click on "Data requests" "link" + And I should see "New request" + And I click on "New request" "link" + And I should see "Type" + And I should see "Comments" + And I set the field "Type" to "Export all of my personal data" + And I set the field "Comments" to "Comment1" + And I press "Save changes" + And I should see "Your request has been submitted to the privacy officer" + And I log out + And I log in as "student2" + And I follow "Profile" in the user menu + And I should see "Data requests" + And I click on "Data requests" "link" + And I should see "New request" + And I click on "New request" "link" + And I should see "Type" + And I should see "Comments" + And I set the field "Type" to "Export all of my personal data" + And I set the field "Comments" to "Comment2" + And I press "Save changes" + And I should see "Your request has been submitted to the privacy officer" + And I log out + And I trigger cron + And I log in as "admin" + And I navigate to "Users > Privacy and policies > Data requests" in site administration + And I should see "Comment1" in the "John Doe" "table_row" + And I should see "Awaiting approval" in the "John Doe" "table_row" + And I should see "Comment2" in the "Jane Doe" "table_row" + And I should see "Awaiting approval" in the "Jane Doe" "table_row" + And I click on ".selectrequests" "css_element" in the "John Doe" "table_row" + And I click on ".selectrequests" "css_element" in the "Jane Doe" "table_row" + And I set the field with xpath "//select[@id='bulk-action']" to "Approve" + And I press "Confirm" + And I should see "Approve requests" + And I should see "Do you really want to bulk approve the selected data requests?" + When I press "Approve requests" + Then I should see "Approved" in the "John Doe" "table_row" + And I should see "Approved" in the "Jane Doe" "table_row" + + @javascript + Scenario: Bulk denying requests + Given I log in as "student1" + And I follow "Profile" in the user menu + And I should see "Data requests" + And I click on "Data requests" "link" + And I should see "New request" + And I click on "New request" "link" + And I should see "Type" + And I should see "Comments" + And I set the field "Type" to "Export all of my personal data" + And I set the field "Comments" to "Comment1" + And I press "Save changes" + And I should see "Your request has been submitted to the privacy officer" + And I log out + And I log in as "student2" + And I follow "Profile" in the user menu + And I should see "Data requests" + And I click on "Data requests" "link" + And I should see "New request" + And I click on "New request" "link" + And I should see "Type" + And I should see "Comments" + And I set the field "Type" to "Export all of my personal data" + And I set the field "Comments" to "Comment2" + And I press "Save changes" + And I should see "Your request has been submitted to the privacy officer" + And I log out + And I trigger cron + And I log in as "admin" + And I navigate to "Users > Privacy and policies > Data requests" in site administration + And I should see "Comment1" in the "John Doe" "table_row" + And I should see "Awaiting approval" in the "John Doe" "table_row" + And I should see "Comment2" in the "Jane Doe" "table_row" + And I should see "Awaiting approval" in the "Jane Doe" "table_row" + And I click on ".selectrequests" "css_element" in the "John Doe" "table_row" + And I click on ".selectrequests" "css_element" in the "Jane Doe" "table_row" + And I set the field with xpath "//select[@id='bulk-action']" to "Deny" + And I press "Confirm" + And I should see "Deny requests" + And I should see "Do you really want to bulk deny the selected data requests?" + When I press "Deny requests" + Then I should see "Rejected" in the "John Doe" "table_row" + And I should see "Rejected" in the "Jane Doe" "table_row"