2 Feature: A user can control their own subscription preferences for a discussion
3 In order to receive notifications for things I am interested in
5 I need to choose my discussion subscriptions
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | student1 | Student | One | student.one@example.com |
11 And the following "courses" exist:
12 | fullname | shortname | category |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | student1 | C1 | student |
17 And I log in as "admin"
18 And I follow "Course 1"
19 And I turn editing mode on
21 Scenario: An optional forum can have discussions subscribed to
22 Given I add a "Forum" to section "1" and I fill the form with:
23 | Forum name | Test forum name |
24 | Forum type | Standard forum for general use |
25 | Description | Test forum description |
26 | Subscription mode | Optional subscription |
27 And I add a new discussion to "Test forum name" forum with:
28 | Subject | Test post subject one |
29 | Message | Test post message one |
30 And I add a new discussion to "Test forum name" forum with:
31 | Subject | Test post subject two |
32 | Message | Test post message two |
34 When I log in as "student1"
35 And I follow "Course 1"
36 And I follow "Test forum name"
37 Then I should see "Subscribe to this forum"
38 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
39 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
40 And I click on "Not subscribed. Click to subscribe." "link" in the "Test post subject one" "table_row"
41 And I follow "Continue"
42 And I should see "Subscribe to this forum"
43 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
44 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
45 And I click on "You are subscribed to this discussion. Click to unsubscribe." "link" in the "Test post subject one" "table_row"
46 And I follow "Continue"
47 And I should see "Subscribe to this forum"
48 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
49 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
50 And I click on "Not subscribed. Click to subscribe." "link" in the "Test post subject one" "table_row"
51 And I follow "Continue"
52 And I should see "Subscribe to this forum"
53 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
54 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
55 And I follow "Subscribe to this forum"
56 And I follow "Continue"
57 And I should see "Unsubscribe from this forum"
58 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
59 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
60 And I follow "Unsubscribe from this forum"
61 And I follow "Continue"
62 And I should see "Subscribe to this forum"
63 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
64 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
66 Scenario: An automatic subscription forum can have discussions unsubscribed from
67 Given I add a "Forum" to section "1" and I fill the form with:
68 | Forum name | Test forum name |
69 | Forum type | Standard forum for general use |
70 | Description | Test forum description |
71 | Subscription mode | Auto subscription |
72 And I add a new discussion to "Test forum name" forum with:
73 | Subject | Test post subject one |
74 | Message | Test post message one |
75 And I add a new discussion to "Test forum name" forum with:
76 | Subject | Test post subject two |
77 | Message | Test post message two |
79 When I log in as "student1"
80 And I follow "Course 1"
81 And I follow "Test forum name"
82 Then I should see "Unsubscribe from this forum"
83 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
84 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
85 And I click on "You are subscribed to this discussion. Click to unsubscribe." "link" in the "Test post subject one" "table_row"
86 And I follow "Continue"
87 And I should see "Unsubscribe from this forum"
88 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
89 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
90 And I click on "Not subscribed. Click to subscribe." "link" in the "Test post subject one" "table_row"
91 And I follow "Continue"
92 And I should see "Unsubscribe from this forum"
93 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
94 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
95 And I click on "You are subscribed to this discussion. Click to unsubscribe." "link" in the "Test post subject one" "table_row"
96 And I follow "Continue"
97 And I should see "Unsubscribe from this forum"
98 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
99 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
100 And I follow "Unsubscribe from this forum"
101 And I follow "Continue"
102 And I should see "Subscribe to this forum"
103 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
104 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
105 And I follow "Subscribe to this forum"
106 And I follow "Continue"
107 And I should see "Unsubscribe from this forum"
108 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
109 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
111 Scenario: A user does not lose their preferences when a forum is switch from optional to automatic
112 Given I add a "Forum" to section "1" and I fill the form with:
113 | Forum name | Test forum name |
114 | Forum type | Standard forum for general use |
115 | Description | Test forum description |
116 | Subscription mode | Optional subscription |
117 And I add a new discussion to "Test forum name" forum with:
118 | Subject | Test post subject one |
119 | Message | Test post message one |
120 And I add a new discussion to "Test forum name" forum with:
121 | Subject | Test post subject two |
122 | Message | Test post message two |
124 And I log in as "student1"
125 And I follow "Course 1"
126 And I follow "Test forum name"
127 And I should see "Subscribe to this forum"
128 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
129 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
130 And I click on "Not subscribed. Click to subscribe." "link" in the "Test post subject one" "table_row"
131 And I follow "Continue"
132 And I should see "Subscribe to this forum"
133 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
134 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
136 And I log in as "admin"
137 And I follow "Course 1"
138 And I follow "Test forum name"
139 And I click on "Edit settings" "link" in the "Administration" "block"
140 And I set the following fields to these values:
141 | Subscription mode | Auto subscription |
142 And I press "Save and return to course"
144 And I log in as "student1"
145 And I follow "Course 1"
146 And I follow "Test forum name"
147 And I should see "Unsubscribe from this forum"
148 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
149 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
150 When I follow "Unsubscribe from this forum"
151 And I follow "Continue"
152 Then I should see "Subscribe to this forum"
153 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
154 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
156 Scenario: A user does not lose their preferences when a forum is switch from optional to automatic
157 Given I add a "Forum" to section "1" and I fill the form with:
158 | Forum name | Test forum name |
159 | Forum type | Standard forum for general use |
160 | Description | Test forum description |
161 | Subscription mode | Optional subscription |
162 And I add a new discussion to "Test forum name" forum with:
163 | Subject | Test post subject one |
164 | Message | Test post message one |
165 And I add a new discussion to "Test forum name" forum with:
166 | Subject | Test post subject two |
167 | Message | Test post message two |
169 And I log in as "student1"
170 And I follow "Course 1"
171 And I follow "Test forum name"
172 And I should see "Subscribe to this forum"
173 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject one" "table_row"
174 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
175 And I click on "Not subscribed. Click to subscribe." "link" in the "Test post subject one" "table_row"
176 And I follow "Continue"
177 And I should see "Subscribe to this forum"
178 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
179 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
181 And I log in as "admin"
182 And I follow "Course 1"
183 And I follow "Test forum name"
184 And I click on "Edit settings" "link" in the "Administration" "block"
185 And I set the following fields to these values:
186 | Subscription mode | Auto subscription |
187 And I press "Save and return to course"
189 And I log in as "student1"
190 And I follow "Course 1"
191 And I follow "Test forum name"
192 And I should see "Unsubscribe from this forum"
193 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
194 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject two" "table_row"
195 When I follow "Unsubscribe from this forum"
196 And I follow "Continue"
197 Then I should see "Subscribe to this forum"
198 And "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
199 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
201 Scenario: An optional forum prompts a user to subscribe to a discussion when posting unless they have already chosen not to subscribe
202 Given I add a "Forum" to section "1" and I fill the form with:
203 | Forum name | Test forum name |
204 | Forum type | Standard forum for general use |
205 | Description | Test forum description |
206 | Subscription mode | Optional subscription |
207 And I add a new discussion to "Test forum name" forum with:
208 | Subject | Test post subject one |
209 | Message | Test post message one |
210 And I add a new discussion to "Test forum name" forum with:
211 | Subject | Test post subject two |
212 | Message | Test post message two |
214 When I log in as "student1"
215 And I follow "Course 1"
216 And I follow "Test forum name"
217 And I should see "Subscribe to this forum"
218 And I reply "Test post subject one" post from "Test forum name" forum with:
219 | Subject | Reply 1 to discussion 1 |
220 | Message | Discussion contents 1, second message |
221 | Discussion subscription | Send me email copies of posts to this discussion |
222 And I reply "Test post subject two" post from "Test forum name" forum with:
223 | Subject | Reply 1 to discussion 1 |
224 | Message | Discussion contents 1, second message |
225 | Discussion subscription | I don't want email copies of posts to this discussion |
226 And I follow "Test forum name"
227 Then "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
228 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
229 And I follow "Test post subject one"
231 And the field "Discussion subscription" matches value "Send me email copies of posts to this discussion"
232 And I follow "Test forum name"
233 And I follow "Test post subject two"
235 And the field "Discussion subscription" matches value "I don't want email copies of posts to this discussion"
237 Scenario: An automatic forum prompts a user to subscribe to a discussion when posting unless they have already chosen not to subscribe
238 Given I add a "Forum" to section "1" and I fill the form with:
239 | Forum name | Test forum name |
240 | Forum type | Standard forum for general use |
241 | Description | Test forum description |
242 | Subscription mode | Auto subscription |
243 And I add a new discussion to "Test forum name" forum with:
244 | Subject | Test post subject one |
245 | Message | Test post message one |
246 And I add a new discussion to "Test forum name" forum with:
247 | Subject | Test post subject two |
248 | Message | Test post message two |
250 When I log in as "student1"
251 And I follow "Course 1"
252 And I follow "Test forum name"
253 And I should see "Unsubscribe from this forum"
254 And I reply "Test post subject one" post from "Test forum name" forum with:
255 | Subject | Reply 1 to discussion 1 |
256 | Message | Discussion contents 1, second message |
257 | Discussion subscription | Send me email copies of posts to this discussion |
258 And I reply "Test post subject two" post from "Test forum name" forum with:
259 | Subject | Reply 1 to discussion 1 |
260 | Message | Discussion contents 1, second message |
261 | Discussion subscription | I don't want email copies of posts to this discussion |
262 And I follow "Test forum name"
263 Then "You are subscribed to this discussion. Click to unsubscribe." "link" should exist in the "Test post subject one" "table_row"
264 And "Not subscribed. Click to subscribe." "link" should exist in the "Test post subject two" "table_row"
265 And I follow "Test post subject one"
267 And the field "Discussion subscription" matches value "Send me email copies of posts to this discussion"
268 And I follow "Test forum name"
269 And I follow "Test post subject two"
271 And the field "Discussion subscription" matches value "I don't want email copies of posts to this discussion"