From 147b16d5527a33681ee0849622ebec48552e1327 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 7 Mar 2023 10:46:51 +0800 Subject: [PATCH] MDL-77463 Behat: Coverage for assign submission notification to teacher --- .../behat/submission_notifications.feature | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 mod/assign/tests/behat/submission_notifications.feature diff --git a/mod/assign/tests/behat/submission_notifications.feature b/mod/assign/tests/behat/submission_notifications.feature new file mode 100644 index 0000000000000..590b043dcd085 --- /dev/null +++ b/mod/assign/tests/behat/submission_notifications.feature @@ -0,0 +1,48 @@ +@mod @mod_assign @javascript +Feature: Manage assignment submission web notifications + In order to receive assignment submission notifications + As a teacher + I need to be able to turn on web notifications for assignment submission + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@example.com | + | teacher1 | Teacher | 1 | teacher1@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And the following "activity" exists: + | activity | assign | + | course | C1 | + | name | Assign 1 | + | assignsubmission_onlinetext_enabled | 1 | + | assignsubmission_file_enabled | 0 | + | submissiondrafts | 0 | + | sendnotifications | 1 | + And the following "mod_assign > submissions" exist: + | assign | user | onlinetext | + | Assign 1 | student1 | I'm the student1 submission | + + Scenario: Teacher can choose to receive assignment notification submissions + Given I log in as "teacher1" + When I open the notification popover + Then I should see "You have no notifications" + # Enable assignment submission notification + And I follow "Preferences" in the user menu + And I click on "Notification preferences" "link" in the "#page-content" "css_element" + And I click on "//td[@data-processor-name='popup']//label[@class='preference-state']" "xpath_element" in the "Assignment notifications" "table_row" + # Update assignment submission to generate a notification + And I am on the "Assign 1" "assign activity" page logged in as student1 + # This should generate a notification + And I press "Edit submission" + And I set the field "Online text" to "updated" + And I press "Save changes" + # Confirm that teacher received assignment submission notification + And I log in as "teacher1" + And I open the notification popover + Then I should see "Student 1 has updated their submission for assignment Assign 1"