From c1c60e69dc298159b9ec075478cf0e1ce64ebdc2 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 4 Feb 2025 10:51:44 +0800 Subject: [PATCH] MDL-84102 message: Behat for setting default notification preferences --- .../tests/behat/message_preferences.feature | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/message/tests/behat/message_preferences.feature b/message/tests/behat/message_preferences.feature index 185a012e64b..1e1c37b5649 100644 --- a/message/tests/behat/message_preferences.feature +++ b/message/tests/behat/message_preferences.feature @@ -39,3 +39,35 @@ Feature: To be able to see and save user message preferences as admin Then "[data-processor-name='popup']" "css_element" should exist And "[data-processor-name='email']" "css_element" should not exist And "[data-processor-name='airnotifier']" "css_element" should exist + + @javascript + Scenario: An admin can set the default notification preferences + Given I log in as "admin" + And I navigate to "Messaging > Notification settings" in site administration + And I set the field "email" to "1" + And I press "Save changes" + And I set the following fields to these values: + | mod_assign_assign_notification_enabled[popup] | 1 | + | mod_assign_assign_notification_enabled[email] | 0 | + | mod_feedback_submission_enabled[popup] | 0 | + | mod_feedback_submission_locked[popup] | 1 | + | mod_feedback_submission_enabled[email] | 1 | + | mod_feedback_submission_locked[email] | 1 | + | mod_feedback_message_disable | 0 | + And I press "Save changes" + And I log in as "student1" + And I follow "Preferences" in the user menu + When I click on "Notification preferences" "link" in the "#page-content" "css_element" + # Assignment web notification is enabled, email is disabled. + Then the field "message_provider_mod_assign_assign_notification_popup" matches value "1" + And the field "message_provider_mod_assign_assign_notification_email" matches value "0" + # Corresponding checkboxes can be updated. + And I click on "message_provider_mod_assign_assign_notification_popup" "checkbox" + And I click on "message_provider_mod_assign_assign_notification_email" "checkbox" + And the field "message_provider_mod_assign_assign_notification_popup" matches value "0" + And the field "message_provider_mod_assign_assign_notification_email" matches value "1" + # Feedback submission notifications are locked off for web and locked on for email. + And "Feedback notifications" row "Web" column of "preference-table" table should contain "Locked off" + And "Feedback notifications" row "Requires configuration Email" column of "preference-table" table should contain "Locked on" + # Feedback reminder is disabled. + And I should not see "Feedback reminder"