-
Notifications
You must be signed in to change notification settings - Fork 515
/
Copy pathgift.feature
310 lines (281 loc) · 13.5 KB
/
gift.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
Feature: Create Gifts
In order to make friends and influence people
As an author
I want to create works for other people
Background:
Given the following activated users exist
| login | password | email |
| gifter | something | [email protected] |
| gifter2 | something | [email protected] |
| giftee1 | something | [email protected] |
| giftee2 | something | [email protected] |
| associate | something | [email protected] |
And "giftee1" has the pseud "g1"
And I am logged in as "gifter" with password "something"
And I set up the draft "GiftStory1"
Scenario: Gifts page without parameters should return error
When I go to the gifts page
Then I should be on the home page
And I should see "Whose gifts did you want to see?"
Scenario: Gifts page for recipient should show recipient's gifts
When I give the work to "giftee1"
And I press "Post"
And I go to the gifts page for the recipient giftee1
Then I should see "GiftStory1 by gifter for giftee1"
Scenario: Gifts page for recipient when logged out should show recipient's gifts if visible to all
When I give the work to "giftee1"
And I press "Post"
And I set up the draft "GiftStory2" as a gift to "giftee1"
And I lock the work
And I press "Post"
And I log out
And I go to the gifts page for the recipient giftee1
Then I should see "GiftStory1 by gifter for giftee1"
And I should not see "GiftStory2 by gifter for giftee1"
Scenario: Gifts page for pseud recipient should show pseud's gifts
Given I give the work to "g1"
And I press "Post"
When I go to the gifts page for the recipient g1
Then I should see "GiftStory1 by gifter for g1"
Scenario: Gifts page for recipient when logged out should show gifts visible to all
When I give the work to "g1"
And I press "Post"
And I set up the draft "GiftStory2" as a gift to "g1"
And I lock the work
And I press "Post"
And I log out
When I go to the gifts page for the recipient g1
Then I should see "GiftStory1 by gifter for g1"
And I should not see "GiftStory2 by gifter for g1"
Scenario: Giving a work as a gift when posting directly
Given I give the work to "giftee1"
When I press "Post"
Then I should see "For giftee1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Giving a work as a gift when posting after previewing
Given I give the work to "giftee1"
And I press "Preview"
And I should see "For giftee1"
And 0 emails should be delivered
When I press "Post"
Then I should see "For giftee1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Edit a draft to add a recipient, then post after previewing
Given I press "Preview"
And I press "Edit"
And I give the work to "giftee1"
And I press "Preview"
And 0 emails should be delivered
When I press "Post"
Then I should see "For giftee1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Edit an existing work to add a recipient, then post directly
Given I press "Post"
And I follow "Edit"
And I give the work to "giftee1"
When I press "Post"
Then I should see "For giftee1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Edit an existing work to add a recipient, then post after previewing
Given I press "Post"
And I follow "Edit"
And I give the work to "giftee1"
When I press "Preview"
# this next thing is broken on beta currently, will settle for not breaking it worse
Then 0 emails should be delivered
When I press "Edit"
Then "giftee1" should be listed as a recipient in the form
When I press "Preview"
Then 0 emails should be delivered
When I press "Update"
Then I should see "For giftee1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Give two gifts to the same recipient
Given I give the work to "giftee1"
And I press "Post"
And I set up the draft "GiftStory2"
And I give the work to "giftee1"
When I press "Post"
And I follow "giftee1"
Then I should see "Gifts for giftee1"
And I should see "GiftStory1"
And I should see "GiftStory2"
Scenario: Add another recipient to a posted gift
Given I give the work to "giftee1"
And I press "Post"
And I should see "For giftee1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
And all emails have been delivered
And I follow "Edit"
And I give the work to "giftee1, giftee2"
When I press "Post"
Then I should see "For giftee1, giftee2"
And 0 emails should be delivered to "[email protected]"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Add another recipient to a draft gift
Given I give the work to "giftee1"
And I press "Preview"
And I should see "For giftee1"
And 0 emails should be delivered to "[email protected]"
And I press "Edit"
And I give the work to "giftee1, giftee2"
When I press "Post"
Then I should see "For giftee1, giftee2"
And "[email protected]" should be notified by email about their gift "GiftStory1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Add two recipients, post, then remove one
Given I give the work to "giftee1, giftee2"
And I press "Post"
And I should see "For giftee1, giftee2"
And "[email protected]" should be notified by email about their gift "GiftStory1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
And all emails have been delivered
And I follow "Edit"
And I give the work to "giftee1"
When I press "Post"
Then I should see "For giftee1"
And I should not see "giftee2"
And 0 emails should be delivered to "[email protected]"
And 0 emails should be delivered to "[email protected]"
Scenario: Add two recipients, preview, then remove one
Given I give the work to "giftee1, giftee2"
And I press "Preview"
And I should see "For giftee1, giftee2"
And 0 emails should be delivered
And I press "Edit"
And I give the work to "giftee1"
When I press "Post"
Then I should see "For giftee1"
And I should not see "giftee2"
And "[email protected]" should be notified by email about their gift "GiftStory1"
And 0 emails should be delivered to "[email protected]"
Scenario: Edit a posted work to replace one recipient with another
Given I give the work to "giftee1"
And I press "Post"
And I should see "For giftee1"
And "[email protected]" should be notified by email about their gift "GiftStory1"
And all emails have been delivered
And I follow "Edit"
And I give the work to "giftee2"
When I press "Post"
Then I should see "For giftee2"
And I should not see "giftee1"
And 0 emails should be delivered to "[email protected]"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: Edit a draft to replace one recipient with another
Given I give the work to "giftee1"
And I press "Preview"
And I should see "For giftee1"
And 0 emails should be delivered
And I press "Edit"
And I give the work to "giftee2"
When I press "Post"
Then I should see "For giftee2"
And I should not see "giftee1"
And 0 emails should be delivered to "[email protected]"
And "[email protected]" should be notified by email about their gift "GiftStory1"
Scenario: When a user is notified that a co-authored work has been given to them as a gift, the e-mail should link to each author's URL instead of showing escaped HTML
Given I invite the co-author "gifter2"
And I give the work to "giftee1"
And I preview the work
Then 1 email should be delivered to "gifter2"
And the email should contain "The user gifter has invited your pseud gifter2 to be listed as a co-creator on the following work"
And the email should not contain "translation missing"
When all emails have been delivered
And the user "gifter2" accepts all co-creator requests
And I press "Post"
Then 1 email should be delivered to "giftee1"
And the email should link to gifter's user url
And the email should not contain "<a href="http://archiveofourown.org/users/gifter/pseuds/gifter""
And the email should link to gifter2's user url
And the email should not contain "<a href="http://archiveofourown.org/users/gifter2/pseuds/gifter2""
Scenario: A gift work should have an associations list
Given I give the work to "associate"
When I press "Post"
Then I should find a list for associations
And I should see "For associate"
Scenario: A user should not be able to gift a work twice to the same person
Given "associate" has the pseud "associate2"
And I am logged in as "troll"
And I set up the draft "Yuck"
And I have given the work to "associate, associate2 (associate)"
Then I should not see "For associate, associate2"
And I should see "For associate"
And 1 email should be delivered to "[email protected]"
When all emails have been delivered
And I edit the work "Yuck"
And I give the work to "associate, associate2 (associate)"
And I post the work without preview
Then I should see "You cannot give a gift to the same user twice."
And I should not see "For associate, associate2"
And 0 emails should be delivered to "[email protected]"
Scenario: A user should be able to refuse a gift
Given I have given the work to "associate"
And I am logged in as "someone_else"
And I am on associate's gifts page
Then I should not see "Refuse Gift"
And I should not see "Refused Gifts"
When I am logged in as "associate" with password "something"
And I go to my gifts page
Then I should see "GiftStory1"
And I should see "Refuse Gift"
And I should see "Refused Gifts"
When I follow "Refuse Gift"
Then I should see "This work will no longer be listed among your gifts."
And I should not see "GiftStory1"
When I follow "Refused Gifts"
Then I should see "GiftStory1"
And I should not see "by gifter for associate"
When I view the work "GiftStory1"
Then I should not see "For associate"
And I should not see "For ."
Scenario: A user should be able to re-accept a gift
Given I have refused the work
And I am on my gifts page
And I follow "Refused Gifts"
Then I should see "Accept Gift"
And I should not see "by gifter for giftee1"
When I follow "Accept Gift"
Then I should see "This work will now be listed among your gifts."
And I should see "GiftStory1"
# TODO: Touch work so the blurb updates with recip info when gift is re-accepted
# And I should see "by gifter for giftee1"
When I view the work "GiftStory1"
Then I should see "For giftee1"
Scenario: An admin should see that a gift has been refused
Given I have refused the work
And I am logged in as an admin
And I view the work "GiftStory1"
Then I should see "Refused As Gift: giftee1"
Scenario: Can't remove a recipient who has refused the gift
Given I have refused the work
And I am logged in as "gifter"
When I edit the work "GiftStory1"
Then "giftee1" should not be listed as a recipient in the form
And the gift for "giftee1" should still exist on "GiftStory1"
When I have removed the recipients
Then the gift for "giftee1" should still exist on "GiftStory1"
Scenario: Opt to disable notifications, then receive a gift (with no collection)
Given I am logged in as "giftee1" with password "something"
And I set my preferences to turn off notification emails for gifts
When I am logged in as "gifter" with password "something"
And I post the work "QuietGift" as a gift for "giftee1, giftee2"
Then 0 emails should be delivered to "[email protected]"
And "[email protected]" should be notified by email about their gift "QuietGift"
Scenario: Opt to disable notifications, then receive a gift posted to a non-hidden collection
Given I am logged in as "giftee1" with password "something"
And I set my preferences to turn off notification emails for gifts
And I have the collection "Open Skies"
When I am logged in as "gifter" with password "something"
And I post the work "QuietGift" in the collection "Open Skies" as a gift for "giftee1, giftee2"
Then 0 emails should be delivered to "[email protected]"
And "[email protected]" should be notified by email about their gift "QuietGift"
Scenario: Opt to disable notifications, then receive a gift posted to a hidden collection and later revealed
Given I am logged in as "giftee1" with password "something"
And I set my preferences to turn off notification emails for gifts
And I have the hidden collection "Hidden Treasures"
When I am logged in as "gifter" with password "something"
And I post the work "QuietGift" in the collection "Hidden Treasures" as a gift for "giftee1, giftee2"
And I reveal works for "Hidden Treasures"
Then 0 emails should be delivered to "[email protected]"
And "[email protected]" should be notified by email about their gift "QuietGift"