1 |
efrain |
1 |
@mod @mod_forum
|
|
|
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
|
|
|
4 |
As a user
|
|
|
5 |
I need to choose my discussion subscriptions
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
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 |
|
|
|
13 |
| Course 1 | C1 | 0 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| student1 | C1 | student |
|
|
|
17 |
|
|
|
18 |
@javascript
|
|
|
19 |
Scenario: An optional forum can have discussions subscribed to
|
|
|
20 |
Given the following "activity" exists:
|
|
|
21 |
| activity | forum |
|
|
|
22 |
| course | C1 |
|
|
|
23 |
| idnumber | forum1 |
|
|
|
24 |
| name | Test forum name |
|
|
|
25 |
| type | general |
|
|
|
26 |
| forcesubscribe | 0 |
|
|
|
27 |
And the following "mod_forum > discussions" exist:
|
|
|
28 |
| user | forum | name | message |
|
|
|
29 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
30 |
| admin | forum1 | Test post subject two | Test post message two |
|
|
|
31 |
When I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
32 |
Then I can subscribe to this forum
|
|
|
33 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
34 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
35 |
And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject one" "table_row"
|
|
|
36 |
And I can subscribe to this forum
|
|
|
37 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
38 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
39 |
And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject one" "table_row"
|
|
|
40 |
And I can subscribe to this forum
|
|
|
41 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
42 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
43 |
And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject one" "table_row"
|
|
|
44 |
And I can subscribe to this forum
|
|
|
45 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
46 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
47 |
And I follow "Subscribe to forum"
|
|
|
48 |
And I should see "You will be notified of new posts in the forum 'Test forum name'"
|
|
|
49 |
And I can unsubscribe from this forum
|
|
|
50 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
51 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
52 |
And I unsubscribe from this forum
|
|
|
53 |
And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
|
|
|
54 |
And I can subscribe to this forum
|
|
|
55 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
56 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
57 |
|
|
|
58 |
@javascript
|
|
|
59 |
Scenario: An automatic subscription forum can have discussions unsubscribed from
|
|
|
60 |
Given the following "activity" exists:
|
|
|
61 |
| activity | forum |
|
|
|
62 |
| course | C1 |
|
|
|
63 |
| idnumber | forum1 |
|
|
|
64 |
| name | Test forum name |
|
|
|
65 |
| type | general |
|
|
|
66 |
| forcesubscribe | 2 |
|
|
|
67 |
And the following "mod_forum > discussions" exist:
|
|
|
68 |
| user | forum | name | message |
|
|
|
69 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
70 |
| admin | forum1 | Test post subject two | Test post message two |
|
|
|
71 |
When I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
72 |
Then I can unsubscribe from this forum
|
|
|
73 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
74 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
75 |
And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject one" "table_row"
|
|
|
76 |
And I can unsubscribe from this forum
|
|
|
77 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
78 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
79 |
And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject one" "table_row"
|
|
|
80 |
And I can unsubscribe from this forum
|
|
|
81 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
82 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
83 |
And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject one" "table_row"
|
|
|
84 |
And I can unsubscribe from this forum
|
|
|
85 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
86 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
87 |
And I unsubscribe from this forum
|
|
|
88 |
And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
|
|
|
89 |
And I can subscribe to this forum
|
|
|
90 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
91 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
92 |
And I subscribe to this forum
|
|
|
93 |
And I should see "You will be notified of new posts in the forum 'Test forum name'"
|
|
|
94 |
And I can unsubscribe from this forum
|
|
|
95 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
96 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
97 |
|
|
|
98 |
@javascript
|
|
|
99 |
Scenario: A user does not lose their preferences when a forum is switch from optional to automatic
|
|
|
100 |
Given the following "activity" exists:
|
|
|
101 |
| activity | forum |
|
|
|
102 |
| course | C1 |
|
|
|
103 |
| idnumber | forum1 |
|
|
|
104 |
| name | Test forum name |
|
|
|
105 |
| type | general |
|
|
|
106 |
| forcesubscribe | 0 |
|
|
|
107 |
And the following "mod_forum > discussions" exist:
|
|
|
108 |
| user | forum | name | message |
|
|
|
109 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
110 |
| admin | forum1 | Test post subject two | Test post message two |
|
|
|
111 |
And I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
112 |
And I can subscribe to this forum
|
|
|
113 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
114 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
115 |
And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject one" "table_row"
|
|
|
116 |
And I can subscribe to this forum
|
|
|
117 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
118 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
119 |
And I am on the "Test forum name" "forum activity editing" page logged in as admin
|
|
|
120 |
And I set the following fields to these values:
|
|
|
121 |
| Subscription mode | Auto subscription |
|
|
|
122 |
And I press "Save and return to course"
|
|
|
123 |
And I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
124 |
And I can unsubscribe from this forum
|
|
|
125 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
126 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
127 |
When I unsubscribe from this forum
|
|
|
128 |
Then I should see "Student One will NOT be notified of new posts in 'Test forum name'"
|
|
|
129 |
And I can subscribe to this forum
|
|
|
130 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
131 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
132 |
|
|
|
133 |
Scenario: An optional forum prompts a user to subscribe to a discussion when posting unless they have already chosen not to subscribe
|
|
|
134 |
Given the following "activity" exists:
|
|
|
135 |
| activity | forum |
|
|
|
136 |
| course | C1 |
|
|
|
137 |
| idnumber | forum1 |
|
|
|
138 |
| name | Test forum name |
|
|
|
139 |
| type | general |
|
|
|
140 |
| forcesubscribe | 0 |
|
|
|
141 |
And the following "mod_forum > discussions" exist:
|
|
|
142 |
| user | forum | name | message |
|
|
|
143 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
144 |
| admin | forum1 | Test post subject two | Test post message two |
|
|
|
145 |
When I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
146 |
And I should see "Subscribe to forum"
|
|
|
147 |
And I reply "Test post subject one" post from "Test forum name" forum with:
|
|
|
148 |
| Subject | Reply 1 to discussion 1 |
|
|
|
149 |
| Message | Discussion contents 1, second message |
|
|
|
150 |
| Discussion subscription | 1 |
|
|
|
151 |
And I reply "Test post subject two" post from "Test forum name" forum with:
|
|
|
152 |
| Subject | Reply 1 to discussion 1 |
|
|
|
153 |
| Message | Discussion contents 1, second message |
|
|
|
154 |
| Discussion subscription | 0 |
|
|
|
155 |
And I am on the "Test forum name" "forum activity" page
|
|
|
156 |
Then "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
157 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
158 |
And I follow "Test post subject one"
|
|
|
159 |
And I follow "Reply"
|
|
|
160 |
And the field "Discussion subscription" matches value "Send me notifications of new posts in this discussion"
|
|
|
161 |
And I follow "Test forum name"
|
|
|
162 |
And I follow "Test post subject two"
|
|
|
163 |
And I follow "Reply"
|
|
|
164 |
And the field "Discussion subscription" matches value "I don't want to be notified of new posts in this discussion"
|
|
|
165 |
|
|
|
166 |
Scenario: An automatic forum prompts a user to subscribe to a discussion when posting unless they have already chosen not to subscribe
|
|
|
167 |
Given the following "activity" exists:
|
|
|
168 |
| activity | forum |
|
|
|
169 |
| course | C1 |
|
|
|
170 |
| idnumber | forum1 |
|
|
|
171 |
| name | Test forum name |
|
|
|
172 |
| type | general |
|
|
|
173 |
| forcesubscribe | 2 |
|
|
|
174 |
And the following "mod_forum > discussions" exist:
|
|
|
175 |
| user | forum | name | message |
|
|
|
176 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
177 |
| admin | forum1 | Test post subject two | Test post message two |
|
|
|
178 |
# added for this scenario
|
|
|
179 |
And the following "users" exist:
|
|
|
180 |
| username | firstname | lastname | email |
|
|
|
181 |
| student2 | Student | Two | student.two@example.com |
|
|
|
182 |
And the following "course enrolments" exist:
|
|
|
183 |
| user | course | role |
|
|
|
184 |
| student2 | C1 | student |
|
|
|
185 |
When I am on the "Test forum name" "forum activity" page logged in as student2
|
|
|
186 |
And I should see "Unsubscribe from forum"
|
|
|
187 |
And I reply "Test post subject one" post from "Test forum name" forum with:
|
|
|
188 |
| Subject | Reply 1 to discussion 1 |
|
|
|
189 |
| Message | Discussion contents 1, second message |
|
|
|
190 |
| Discussion subscription | 1 |
|
|
|
191 |
And I reply "Test post subject two" post from "Test forum name" forum with:
|
|
|
192 |
| Subject | Reply 1 to discussion 1 |
|
|
|
193 |
| Message | Discussion contents 1, second message |
|
|
|
194 |
| Discussion subscription | 0 |
|
|
|
195 |
And I am on the "Test forum name" "forum activity" page
|
|
|
196 |
Then "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
197 |
And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row"
|
|
|
198 |
And I follow "Test post subject one"
|
|
|
199 |
And I follow "Reply"
|
|
|
200 |
And the field "Discussion subscription" matches value "Send me notifications of new posts in this discussion"
|
|
|
201 |
And I am on the "Test forum name" "forum activity" page
|
|
|
202 |
And I follow "Test post subject two"
|
|
|
203 |
And I follow "Reply"
|
|
|
204 |
And the field "Discussion subscription" matches value "I don't want to be notified of new posts in this discussion"
|
|
|
205 |
|
|
|
206 |
Scenario: A guest should not be able to subscribe to a discussion
|
|
|
207 |
Given the following "activities" exist:
|
|
|
208 |
| activity | name | course | section | idnumber | type |
|
|
|
209 |
| forum | Test forum name | Acceptance test site | 1 | forum1 | general |
|
|
|
210 |
And the following "mod_forum > discussions" exist:
|
|
|
211 |
| user | forum | name | message |
|
|
|
212 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
213 |
When I am on the "Test forum name" "forum activity" page logged in as guest
|
|
|
214 |
Then "Subscribe to this discussion" "checkbox" should not exist in the "Test post subject one" "table_row"
|
|
|
215 |
And "Unsubscribe from this discussion" "checkbox" should not exist in the "Test post subject one" "table_row"
|
|
|
216 |
And I follow "Test post subject one"
|
|
|
217 |
And "Subscribe to this discussion" "checkbox" should not exist
|
|
|
218 |
And "Unsubscribe from this discussion" "checkbox" should not exist
|
|
|
219 |
|
|
|
220 |
Scenario: A user who is not logged in should not be able to subscribe to a discussion
|
|
|
221 |
Given the following "activities" exist:
|
|
|
222 |
| activity | name | course | section | idnumber | type |
|
|
|
223 |
| forum | Test forum name | Acceptance test site | 1 | forum1 | general |
|
|
|
224 |
And the following "mod_forum > discussions" exist:
|
|
|
225 |
| user | forum | name | message |
|
|
|
226 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
227 |
When I am on site homepage
|
|
|
228 |
And I follow "Test forum name"
|
|
|
229 |
Then "Subscribe to this discussion" "checkbox" should not exist in the "Test post subject one" "table_row"
|
|
|
230 |
And "Unsubscribe from this discussion" "checkbox" should not exist in the "Test post subject one" "table_row"
|
|
|
231 |
And I follow "Test post subject one"
|
|
|
232 |
And "Subscribe to this discussion" "checkbox" should not exist
|
|
|
233 |
And "Unsubscribe from this discussion" "checkbox" should not exist
|
|
|
234 |
|
|
|
235 |
Scenario: A user can toggle their subscription preferences when viewing a discussion
|
|
|
236 |
Given the following "activity" exists:
|
|
|
237 |
| activity | forum |
|
|
|
238 |
| course | C1 |
|
|
|
239 |
| idnumber | forum1 |
|
|
|
240 |
| name | Test forum name |
|
|
|
241 |
| type | general |
|
|
|
242 |
| forcesubscribe | 0 |
|
|
|
243 |
And the following "mod_forum > discussions" exist:
|
|
|
244 |
| user | forum | name | message |
|
|
|
245 |
| admin | forum1 | Test post subject one | Test post message one |
|
|
|
246 |
When I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
247 |
Then "Subscribe to forum" "link" should exist
|
|
|
248 |
And I follow "Test post subject one"
|
|
|
249 |
And "You are not subscribed to this discussion. Click to subscribe" "link" should exist
|
|
|
250 |
And I follow "Test forum name"
|
|
|
251 |
And I follow "Subscribe to forum"
|
|
|
252 |
And I should see "You will be notified of new posts in the forum 'Test forum name'"
|
|
|
253 |
And "Unsubscribe from forum" "link" should exist
|
|
|
254 |
And I follow "Test post subject one"
|
|
|
255 |
And "You are subscribed to this discussion. Click to unsubscribe" "link" should exist
|
|
|
256 |
And I follow "You are subscribed to this discussion. Click to unsubscribe"
|
|
|
257 |
And I should see "Student One will NOT be notified of new posts in 'Test post subject one' of 'Test forum name'"
|
|
|
258 |
And I follow "Test post subject one"
|
|
|
259 |
And "You are not subscribed to this discussion. Click to subscribe" "link" should exist
|
|
|
260 |
And I follow "Test forum name"
|
|
|
261 |
And I follow "Unsubscribe from forum"
|
|
|
262 |
And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
|
|
|
263 |
And "Subscribe to forum" "link" should exist
|
|
|
264 |
And I follow "Test post subject one"
|
|
|
265 |
And "You are not subscribed to this discussion. Click to subscribe" "link" should exist
|
|
|
266 |
And I follow "You are not subscribed to this discussion. Click to subscribe"
|
|
|
267 |
And I should see "You will be notified of new posts in 'Test post subject one' in the forum 'Test forum name'."
|
|
|
268 |
And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row"
|
|
|
269 |
And I follow "Subscribe to forum"
|
|
|
270 |
And I should see "You will be notified of new posts in the forum 'Test forum name'"
|
|
|
271 |
And "Unsubscribe from forum" "link" should exist
|
|
|
272 |
And I follow "Test post subject one"
|
|
|
273 |
And "You are subscribed to this discussion. Click to unsubscribe" "link" should exist
|
|
|
274 |
And I follow "Test forum name"
|
|
|
275 |
And I follow "Unsubscribe from forum"
|
|
|
276 |
And I should see "Student One will NOT be notified of new posts in 'Test forum name'"
|
|
|
277 |
And "Subscribe to forum" "link" should exist
|
|
|
278 |
And I follow "Test post subject one"
|
|
|
279 |
And "You are not subscribed to this discussion. Click to subscribe" "link" should exist
|