1 |
efrain |
1 |
@core @core_message @javascript
|
|
|
2 |
Feature: Manage notification preferences - Email
|
|
|
3 |
In order to be notified of messages
|
|
|
4 |
As a user
|
|
|
5 |
I need to be able to update my messaging notification preferences
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
| student2 | Student | 2 | student2@example.com |
|
|
|
12 |
# Turn off the course welcome message, so we can easily test other messages.
|
|
|
13 |
And the following config values are set as admin:
|
|
|
14 |
| messaging | 1 | core |
|
|
|
15 |
| sendcoursewelcomemessage | 0 | enrol_manual |
|
|
|
16 |
|
|
|
17 |
Scenario: Disable email notifications for everybody
|
|
|
18 |
Given I log in as "admin"
|
|
|
19 |
When I navigate to "Messaging > Notification settings" in site administration
|
|
|
20 |
And I set the field "email" to "0"
|
|
|
21 |
And I press "Save changes"
|
|
|
22 |
And I log out
|
|
|
23 |
And I log in as "student1"
|
|
|
24 |
And I open messaging
|
|
|
25 |
And I open messaging settings preferences
|
|
|
26 |
Then I should not see "Notification preferences"
|
|
|
27 |
And I should not see "Email"
|
|
|
28 |
|
|
|
29 |
Scenario: Enable email notifications
|
|
|
30 |
# Disable email default value
|
|
|
31 |
Given the following "user preferences" exist:
|
|
|
32 |
| user | preference | value |
|
|
|
33 |
| student1 | message_provider_moodle_instantmessage_enabled | none |
|
|
|
34 |
When I log in as "admin"
|
|
|
35 |
And I navigate to "Messaging > Notification settings" in site administration
|
|
|
36 |
And I set the field "email" to "1"
|
|
|
37 |
And I press "Save changes"
|
|
|
38 |
And I log out
|
|
|
39 |
And I log in as "student1"
|
|
|
40 |
And I open messaging
|
|
|
41 |
And I open messaging settings preferences
|
|
|
42 |
Then I should see "Notification preferences"
|
|
|
43 |
And I should see "Email"
|
|
|
44 |
And the field "Email" matches value "0"
|
|
|
45 |
And I set the field "Email" to "1"
|
|
|
46 |
And I follow "Preferences" in the user menu
|
|
|
47 |
And I click on "Message preferences" "link"
|
|
|
48 |
And the field "Email" matches value "1"
|
|
|
49 |
|
|
|
50 |
Scenario: Disable email notifications
|
|
|
51 |
Given I log in as "admin"
|
|
|
52 |
When I navigate to "Messaging > Notification settings" in site administration
|
|
|
53 |
And I set the field "email" to "1"
|
|
|
54 |
And I press "Save changes"
|
|
|
55 |
And I log out
|
|
|
56 |
And I log in as "student1"
|
|
|
57 |
And I open messaging
|
|
|
58 |
And I open messaging settings preferences
|
|
|
59 |
Then I should see "Notification preferences"
|
|
|
60 |
And I should see "Email"
|
|
|
61 |
And the field "Email" matches value "1"
|
|
|
62 |
And I set the field "Email" to "0"
|
|
|
63 |
And I follow "Preferences" in the user menu
|
|
|
64 |
And I click on "Message preferences" "link"
|
|
|
65 |
And the field "Email" matches value "0"
|
|
|
66 |
|
|
|
67 |
Scenario: Disable email notifications for Assignment notifications
|
|
|
68 |
Given I log in as "admin"
|
|
|
69 |
When I navigate to "Messaging > Notification settings" in site administration
|
|
|
70 |
And I set the field "email" to "1"
|
|
|
71 |
And I press "Save changes"
|
|
|
72 |
Then the field "email" matches value "1"
|
|
|
73 |
And I set the field "mod_assign_assign_notification_disable" to "0"
|
|
|
74 |
And I press "Save changes"
|
|
|
75 |
And the field "mod_assign_assign_notification_disable" matches value "0"
|
|
|
76 |
And I follow "Preferences" in the user menu
|
|
|
77 |
And I click on "Notification preferences" "link" in the "#page-content" "css_element"
|
|
|
78 |
And I should not see "Assignment notifications"
|
|
|
79 |
|
|
|
80 |
Scenario: User can disable email notifications for Assignment notifications
|
|
|
81 |
Given I log in as "admin"
|
|
|
82 |
And I navigate to "Messaging > Notification settings" in site administration
|
|
|
83 |
And I set the field "email" to "1"
|
|
|
84 |
And I press "Save changes"
|
|
|
85 |
And I follow "Preferences" in the user menu
|
|
|
86 |
And I click on "Notification preferences" "link" in the "#page-content" "css_element"
|
|
|
87 |
And I should not see "Enabled" in the "Assignment notifications" "table_row"
|
|
|
88 |
When I set the field "message_provider_mod_assign_assign_notification_email" to "0"
|
|
|
89 |
And I reload the page
|
|
|
90 |
Then the field "message_provider_mod_assign_assign_notification_email" matches value "0"
|
|
|
91 |
And I should not see "Enabled" in the "Assignment notifications" "table_row"
|
|
|
92 |
|
|
|
93 |
Scenario: Lock email notifications for Forum providers
|
|
|
94 |
Given I log in as "admin"
|
|
|
95 |
When I navigate to "Messaging > Notification settings" in site administration
|
|
|
96 |
And I set the field "email" to "1"
|
|
|
97 |
And I press "Save changes"
|
|
|
98 |
Then the field "email" matches value "1"
|
|
|
99 |
And I set the field "mod_forum_posts_enabled[email]" to "1"
|
|
|
100 |
And I set the field "mod_forum_posts_locked[email]" to "1"
|
|
|
101 |
And I set the field "mod_forum_digests_enabled[email]" to "0"
|
|
|
102 |
And I set the field "mod_forum_digests_locked[email]" to "1"
|
|
|
103 |
And I press "Save changes"
|
|
|
104 |
And the field "mod_forum_posts_enabled[email]" matches value "1"
|
|
|
105 |
And the field "mod_forum_posts_locked[email]" matches value "1"
|
|
|
106 |
And the field "mod_forum_digests_enabled[email]" matches value "0"
|
|
|
107 |
And the field "mod_forum_digests_locked[email]" matches value "1"
|
|
|
108 |
And I follow "Preferences" in the user menu
|
|
|
109 |
And I click on "Notification preferences" "link" in the "#page-content" "css_element"
|
|
|
110 |
And I should see "Locked on" in the "[data-preference-key=message_provider_mod_forum_posts]" "css_element"
|
|
|
111 |
And I should see "Locked off" in the "[data-preference-key=message_provider_mod_forum_digests]" "css_element"
|
|
|
112 |
|
|
|
113 |
Scenario: User can disable notification preferences
|
|
|
114 |
Given the following "courses" exist:
|
|
|
115 |
| fullname | shortname | category | groupmode |
|
|
|
116 |
| Course 1 | C1 | 0 | 1 |
|
|
|
117 |
And the following "course enrolments" exist:
|
|
|
118 |
| user | course | role |
|
|
|
119 |
| student1 | C1 | student |
|
|
|
120 |
| student2 | C1 | student |
|
|
|
121 |
And the following config values are set as admin:
|
|
|
122 |
| popup_provider_mod_assign_assign_notification_locked | 0 | message |
|
|
|
123 |
| message_provider_mod_assign_assign_notification_enabled | popup | message |
|
|
|
124 |
And the following "user preferences" exist:
|
|
|
125 |
| user | preference | value |
|
|
|
126 |
| student1 | message_provider_mod_assign_assign_notification_enabled | none |
|
|
|
127 |
| student2 | message_provider_mod_assign_assign_notification_enabled | popup |
|
|
|
128 |
And the following "activity" exists:
|
|
|
129 |
| activity | assign |
|
|
|
130 |
| course | C1 |
|
|
|
131 |
| name | Test assignment name |
|
|
|
132 |
| assignsubmission_onlinetext_enabled | 1 |
|
|
|
133 |
| assignsubmission_file_enabled | 0 |
|
|
|
134 |
| submissiondrafts | 0 |
|
|
|
135 |
# This should generate a notification.
|
|
|
136 |
And the following "mod_assign > submissions" exist:
|
|
|
137 |
| assign | user | onlinetext |
|
|
|
138 |
| Test assignment name | student1 | I'm the student1 submission |
|
|
|
139 |
| Test assignment name | student2 | I'm the student2 submission |
|
|
|
140 |
When I log in as "student1"
|
|
|
141 |
# Confirm the popover is not showing any unread notifications.
|
|
|
142 |
Then I should not see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
143 |
# Open the popover.
|
|
|
144 |
And I open the notification popover
|
|
|
145 |
# Confirm the submission notification is NOT visible.
|
|
|
146 |
And I should not see "You have submitted your assignment submission for Test assignment name" in the "#nav-notification-popover-container" "css_element"
|
|
|
147 |
And I log in as "student2"
|
|
|
148 |
# Confirm the popover is showing the unread notifications.
|
|
|
149 |
Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
150 |
# Open the popover.
|
|
|
151 |
And I open the notification popover
|
|
|
152 |
# Confirm the submission notification is visible.
|
|
|
153 |
And I should see "You have submitted your assignment submission for Test assignment name" in the "#nav-notification-popover-container" "css_element"
|
|
|
154 |
|
|
|
155 |
Scenario: User cannot disable forced notification preferences
|
|
|
156 |
Given the following "courses" exist:
|
|
|
157 |
| fullname | shortname | category | groupmode |
|
|
|
158 |
| Course 1 | C1 | 0 | 1 |
|
|
|
159 |
And the following "course enrolments" exist:
|
|
|
160 |
| user | course | role |
|
|
|
161 |
| student1 | C1 | student |
|
|
|
162 |
And the following config values are set as admin:
|
|
|
163 |
| popup_provider_mod_assign_assign_notification_locked | 1 | message |
|
|
|
164 |
| message_provider_mod_assign_assign_notification_enabled | popup | message |
|
|
|
165 |
And the following "user preferences" exist:
|
|
|
166 |
| user | preference | value |
|
|
|
167 |
| student1 | message_provider_mod_assign_assign_notification_enabled | none |
|
|
|
168 |
And the following "activity" exists:
|
|
|
169 |
| activity | assign |
|
|
|
170 |
| course | C1 |
|
|
|
171 |
| name | Test assignment name |
|
|
|
172 |
| assignsubmission_onlinetext_enabled | 1 |
|
|
|
173 |
| assignsubmission_file_enabled | 0 |
|
|
|
174 |
| submissiondrafts | 0 |
|
|
|
175 |
# This should generate a notification.
|
|
|
176 |
And the following "mod_assign > submissions" exist:
|
|
|
177 |
| assign | user | onlinetext |
|
|
|
178 |
| Test assignment name | student1 | I'm the student1 submission |
|
|
|
179 |
When I log in as "student1"
|
|
|
180 |
# Confirm the popover is saying 1 unread notifications.
|
|
|
181 |
Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
182 |
# Open the popover.
|
|
|
183 |
And I open the notification popover
|
|
|
184 |
# Confirm the submission notification is visible.
|
|
|
185 |
And I should see "You have submitted your assignment submission for Test assignment name" in the "#nav-notification-popover-container" "css_element"
|
|
|
186 |
|
|
|
187 |
Scenario: User cannot disable disallowed notification preferences
|
|
|
188 |
Given the following "courses" exist:
|
|
|
189 |
| fullname | shortname | category | groupmode |
|
|
|
190 |
| Course 1 | C1 | 0 | 1 |
|
|
|
191 |
And the following "course enrolments" exist:
|
|
|
192 |
| user | course | role |
|
|
|
193 |
| student1 | C1 | student |
|
|
|
194 |
And the following config values are set as admin:
|
|
|
195 |
| popup_provider_mod_assign_assign_notification_locked | 1 | message |
|
|
|
196 |
| message_provider_mod_assign_assign_notification_enabled | none | message |
|
|
|
197 |
And the following "user preferences" exist:
|
|
|
198 |
| user | preference | value |
|
|
|
199 |
| student1 | message_provider_mod_assign_assign_notification_enabled | popup |
|
|
|
200 |
And the following "activity" exists:
|
|
|
201 |
| activity | assign |
|
|
|
202 |
| course | C1 |
|
|
|
203 |
| name | Test assignment name |
|
|
|
204 |
| assignsubmission_onlinetext_enabled | 1 |
|
|
|
205 |
| assignsubmission_file_enabled | 0 |
|
|
|
206 |
| submissiondrafts | 0 |
|
|
|
207 |
# This should generate a notification.
|
|
|
208 |
And the following "mod_assign > submissions" exist:
|
|
|
209 |
| assign | user | onlinetext |
|
|
|
210 |
| Test assignment name | student1 | I'm the student1 submission |
|
|
|
211 |
When I log in as "student1"
|
|
|
212 |
# Confirm the popover is not showing any unread notifications.
|
|
|
213 |
Then I should not see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element"
|
|
|
214 |
# Open the popover.
|
|
|
215 |
And I open the notification popover
|
|
|
216 |
# Confirm the submission notification is NOT visible.
|
|
|
217 |
And I should not see "You have submitted your assignment submission for Test assignment name" in the "#nav-notification-popover-container" "css_element"
|