@newskit-render/core 4.26.3-alpha.0 → 4.26.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/account/accessibility.cy.js +15 -0
- package/cypress/e2e/account/{payment-failer.cy.js → banners.cy.js} +74 -7
- package/cypress/e2e/account/cancellation.cy.js +219 -0
- package/cypress/e2e/account/newsletters-and-alerts.cy.js +149 -0
- package/cypress/e2e/account/personal-details.cy.js +14 -0
- package/cypress/e2e/account/subscription-and-billing.cy.js +434 -0
- package/cypress/fixtures/paymentFailure.js +5 -0
- package/cypress/support/commands.js +3 -3
- package/package.json +5 -5
- package/cypress/e2e/account/SkipToContent.cy.js +0 -12
- package/cypress/e2e/account/account-subscription.cy.js +0 -295
- package/cypress/e2e/account/commenting-notifications.cy.js +0 -45
- /package/cypress/e2e/account/{holiday-stop.cy.js → holiday-stops.cy.js} +0 -0
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import { paymentFailure } from '../../fixtures/paymentFailure'
|
|
2
|
-
// These tests are skiped now, until CPS resolves their issue with subsriptions.
|
|
3
|
-
describe('Account Subscription & Cancellation', () => {
|
|
4
|
-
it('Should show no subscription view', () => {
|
|
5
|
-
cy.GetAcsSession('noSub')
|
|
6
|
-
cy.mockConsentAndVisit('/account/subscription-and-billing')
|
|
7
|
-
cy.contains('You don’t have a subscription')
|
|
8
|
-
cy.contains('Start a subscription and get access to all benefits.')
|
|
9
|
-
cy.get('[data-testid="primary-button"]')
|
|
10
|
-
.should('have.attr', 'href', '/title-storefront')
|
|
11
|
-
.contains('View subscription options')
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('Should show Pending Activation view', () => {
|
|
15
|
-
cy.GetAcsSession('expiredSub')
|
|
16
|
-
cy.mockConsent()
|
|
17
|
-
|
|
18
|
-
cy.visitAndOverrideNextData(
|
|
19
|
-
'/account/subscription-and-billing',
|
|
20
|
-
'props.pageProps.user.subscriptions[0].status',
|
|
21
|
-
'Pending Activation'
|
|
22
|
-
)
|
|
23
|
-
cy.contains('Your subscription is being activated')
|
|
24
|
-
cy.contains(
|
|
25
|
-
'Your membership is being set up at the moment, so you can’t access your subscription and billing details yet.'
|
|
26
|
-
)
|
|
27
|
-
cy.contains(
|
|
28
|
-
'Setting up your account can take a couple of hours, so please come back and try again later.'
|
|
29
|
-
)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('Should show expired subscription view', () => {
|
|
33
|
-
cy.GetAcsSession('expiredSub')
|
|
34
|
-
cy.mockConsent()
|
|
35
|
-
const date = new Date(Date.now() - 24 * 35 * 3600 * 1000)
|
|
36
|
-
|
|
37
|
-
cy.visitAndOverrideNextData(
|
|
38
|
-
'/account/subscription-and-billing',
|
|
39
|
-
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
40
|
-
date.toISOString()
|
|
41
|
-
)
|
|
42
|
-
cy.contains('You’ve previously had a subscription that has now expired')
|
|
43
|
-
|
|
44
|
-
cy.contains(
|
|
45
|
-
`On ${date.toLocaleDateString(
|
|
46
|
-
'en-GB'
|
|
47
|
-
)} your Digital subscription expired. You can re-subscribe by confirming a few details or view other packages that are available.`
|
|
48
|
-
)
|
|
49
|
-
cy.get('[data-testid="primary-button"]')
|
|
50
|
-
.should('have.attr', 'href', '/title-re-subscribe')
|
|
51
|
-
.contains('Re-subscribe')
|
|
52
|
-
cy.get('[data-testid="secondary-button"]')
|
|
53
|
-
.should('have.attr', 'href', '/title-subscription-options')
|
|
54
|
-
.contains('View subscription options')
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('Should show free subscription view', () => {
|
|
58
|
-
cy.GetAcsSession('withSub')
|
|
59
|
-
cy.mockConsent()
|
|
60
|
-
cy.visitAndOverrideNextData(
|
|
61
|
-
'/account/subscription-and-billing',
|
|
62
|
-
'props.pageProps.user.subscriptions[0].billingDetails.paymentMethod.type',
|
|
63
|
-
null
|
|
64
|
-
)
|
|
65
|
-
cy.contains(
|
|
66
|
-
'There are no payment details associated with this type of account'
|
|
67
|
-
)
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('should got through cancellation workflow', () => {
|
|
71
|
-
cy.GetAcsSession('withSub')
|
|
72
|
-
cy.mockConsentAndVisit('/account/subscription-and-billing')
|
|
73
|
-
cy.contains('h1', 'Subscription & Billing')
|
|
74
|
-
cy.contains(
|
|
75
|
-
'All your subscription details, including payment info and transactions.'
|
|
76
|
-
)
|
|
77
|
-
cy.contains('4AAA038867017')
|
|
78
|
-
cy.contains('************1111')
|
|
79
|
-
cy.contains('expiry date 01/25')
|
|
80
|
-
|
|
81
|
-
cy.get('a[href="/account/cancellation"]').should('be.visible').click()
|
|
82
|
-
|
|
83
|
-
cy.get('[type="radio"]').first().check()
|
|
84
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView()
|
|
85
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
86
|
-
cy.contains('Are you sure you want to cancel your subscription?')
|
|
87
|
-
cy.contains(
|
|
88
|
-
'You will lose unlimited access to exclusive content and benefits.'
|
|
89
|
-
)
|
|
90
|
-
cy.contains(
|
|
91
|
-
'Your subscription full access will be revoked by the end of your current bill cycle.'
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
// mock sussesful cancellation
|
|
95
|
-
cy.intercept('POST', '/api/account/mutate', {
|
|
96
|
-
statusCode: 200,
|
|
97
|
-
body: { data: { cancelSubscription: { success: true } } },
|
|
98
|
-
})
|
|
99
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView()
|
|
100
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
101
|
-
cy.get('[data-testid="dialog-content"]').should('be.visible')
|
|
102
|
-
// go back to subscription and billing
|
|
103
|
-
cy.contains('Back to account').click()
|
|
104
|
-
cy.intercept('/account/subscription-and-billing')
|
|
105
|
-
// reload with correct mock data to show past banner
|
|
106
|
-
const date = new Date(Date.now() + 20 * 30 * 3600 * 1000)
|
|
107
|
-
|
|
108
|
-
cy.visitAndOverrideNextData(
|
|
109
|
-
'/account/subscription-and-billing',
|
|
110
|
-
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
111
|
-
date.toISOString()
|
|
112
|
-
)
|
|
113
|
-
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
114
|
-
cy.contains('Your subscription will end soon.')
|
|
115
|
-
cy.contains(
|
|
116
|
-
`You have cancelled your subscription and will lose access to all benefits on ${date.getDate()}/${
|
|
117
|
-
date.getMonth() + 1
|
|
118
|
-
}/${date.getFullYear()}. To re-activate your subscription call XXXX-XXX-XXXX.`
|
|
119
|
-
)
|
|
120
|
-
cy.contains(
|
|
121
|
-
'If you change your mind or cancelled by mistake, speak to one of our advisors on XXXX-XXX-XXXX'
|
|
122
|
-
)
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
it('Should show warning when you dont give a cancellation reason', () => {
|
|
126
|
-
cy.GetAcsSession('withSub')
|
|
127
|
-
cy.mockConsentAndVisit('/account/cancellation')
|
|
128
|
-
cy.contains('Please tell us why you want to cancel')
|
|
129
|
-
cy.contains(
|
|
130
|
-
'We value your opinion and this information will help us understand how we can improve our product and the services we provide.'
|
|
131
|
-
)
|
|
132
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
133
|
-
cy.contains('Please, select one option')
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
it('Should display textfield for other', () => {
|
|
137
|
-
cy.GetAcsSession('withSub')
|
|
138
|
-
cy.mockConsentAndVisit('/account/cancellation')
|
|
139
|
-
cy.contains('Please tell us why you want to cancel')
|
|
140
|
-
cy.get('[type="radio"]').check('Other')
|
|
141
|
-
cy.get('textarea[name="other"]').clear()
|
|
142
|
-
cy.get('textarea[name="other"]').type('Thanks my business')
|
|
143
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView()
|
|
144
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
145
|
-
cy.contains('Are you sure you want to cancel your subscription?')
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
it('Should not show banner once it has been dismissed', () => {
|
|
149
|
-
cy.GetAcsSession('withSub')
|
|
150
|
-
cy.mockConsent()
|
|
151
|
-
const date = new Date(Date.now() + 20 * 30 * 3600 * 1000)
|
|
152
|
-
|
|
153
|
-
cy.visitAndOverrideNextData(
|
|
154
|
-
'/account/subscription-and-billing',
|
|
155
|
-
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
156
|
-
date.toISOString()
|
|
157
|
-
)
|
|
158
|
-
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
159
|
-
cy.contains('Your subscription will end soon.').should('exist')
|
|
160
|
-
cy.get('[data-testid="banner-close-button"]').filter(':visible').click()
|
|
161
|
-
cy.reload()
|
|
162
|
-
cy.get('[data-testid="past-due-banner"]').should('not.exist')
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
it('Should not display banner if set date is passed current date', () => {
|
|
166
|
-
cy.GetAcsSession('withSub')
|
|
167
|
-
cy.mockConsent()
|
|
168
|
-
const date = new Date(Date.now() - 24 * 35 * 3600 * 1000)
|
|
169
|
-
cy.visitAndOverrideNextData(
|
|
170
|
-
'/account/subscription-and-billing',
|
|
171
|
-
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
172
|
-
date.toISOString()
|
|
173
|
-
)
|
|
174
|
-
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
175
|
-
cy.contains('Your subscription has been cancelled.').then(() => {
|
|
176
|
-
window.localStorage.setItem(
|
|
177
|
-
'cancelledBanner',
|
|
178
|
-
new Date(new Date().setDate(new Date().getDate() - 7)).toDateString()
|
|
179
|
-
)
|
|
180
|
-
})
|
|
181
|
-
cy.reload()
|
|
182
|
-
cy.get('[data-testid="past-due-banner"]').should('not.exist')
|
|
183
|
-
cy.clearLocalStorage()
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
it('should show modal when Cancel subscription link is clicked but user is in payment failure', () => {
|
|
187
|
-
cy.GetAcsSession('withSub')
|
|
188
|
-
cy.mockConsent()
|
|
189
|
-
|
|
190
|
-
cy.visitAndOverrideNextData(
|
|
191
|
-
'/account/subscription-and-billing',
|
|
192
|
-
'props.pageProps.user.paymentFailure',
|
|
193
|
-
paymentFailure
|
|
194
|
-
)
|
|
195
|
-
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
196
|
-
cy.wait(1000)
|
|
197
|
-
cy.get('a[href="/account/cancellation"]').should('be.visible').click()
|
|
198
|
-
|
|
199
|
-
cy.contains('You have outstanding payments')
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
it('should show paypal subscription', () => {
|
|
203
|
-
cy.GetAcsSession('paypalSub')
|
|
204
|
-
cy.mockConsentAndVisit('/account/subscription-and-billing')
|
|
205
|
-
cy.get('[data-testid="paypal-icon"]').should('exist')
|
|
206
|
-
cy.contains('cmp.paypal.user.verified.test@news.co.uk')
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
// it('should show inline message for paypal subscription', () => {
|
|
210
|
-
// cy.GetAcsSession('paypalSub')
|
|
211
|
-
// cy.mockConsentAndVisit('/account/subscription-and-billing')
|
|
212
|
-
// cy.get('a[href="/account/payment"]')
|
|
213
|
-
// .should('be.visible')
|
|
214
|
-
// .click({ force: true })
|
|
215
|
-
// cy.contains(
|
|
216
|
-
// '[data-testid="Zuora-inline"]',
|
|
217
|
-
// 'To update your Paypal credentials, please speak to one of our advisors on xxxx-xxx-xxxx or add a new payment method via credit/debit card using the form below.'
|
|
218
|
-
// )
|
|
219
|
-
// })
|
|
220
|
-
|
|
221
|
-
it('should show your deliveries section if the subscription has print', () => {
|
|
222
|
-
cy.GetTnlAcsSession('tnl')
|
|
223
|
-
cy.mockConsent()
|
|
224
|
-
cy.mockConsentAndVisit('/account/subscription-and-billing')
|
|
225
|
-
cy.contains('Your deliveries')
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
it('should be able to add your delivery instructions', () => {
|
|
229
|
-
cy.GetTnlAcsSession('tnl')
|
|
230
|
-
cy.mockConsentAndVisit('/account/edit/delivery-instructions')
|
|
231
|
-
cy.contains('h1', 'Delivery instructions')
|
|
232
|
-
cy.contains('Where should we leave your Newspaper?')
|
|
233
|
-
cy.get('[type="radio"]').should('be.checked')
|
|
234
|
-
// mock sussesful api call
|
|
235
|
-
cy.intercept('POST', '/api/account/mutate', {
|
|
236
|
-
statusCode: 200,
|
|
237
|
-
body: { data: { updateUserSubscription: { success: true } } },
|
|
238
|
-
})
|
|
239
|
-
|
|
240
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView()
|
|
241
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
242
|
-
cy.contains(
|
|
243
|
-
'[data-testid="toast-container"]',
|
|
244
|
-
'Updating your delivery instructions'
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
// Redirects to Subscription and billing page
|
|
248
|
-
cy.contains(
|
|
249
|
-
'[data-testid="toast-container"]',
|
|
250
|
-
'Your delivery instructions were succesfully updated. This may take up to 48hrs to come into effect.'
|
|
251
|
-
)
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
it('should be able to add your custom delivery instructions', () => {
|
|
255
|
-
cy.GetTnlAcsSession('tnl')
|
|
256
|
-
cy.mockConsentAndVisit('/account/edit/delivery-instructions')
|
|
257
|
-
cy.contains('h1', 'Delivery instructions')
|
|
258
|
-
cy.contains('Where should we leave your Newspaper?')
|
|
259
|
-
|
|
260
|
-
// cy.get('[value="Other (Please state)"]').first().check()
|
|
261
|
-
cy.get('[type="radio"]').check('Other (Please state)')
|
|
262
|
-
cy.contains(
|
|
263
|
-
'Please note that if you choose a delivery location that is not secure we cannot be liable for lost or stolen newspapers.'
|
|
264
|
-
)
|
|
265
|
-
cy.get('textarea[name="other"]').clear()
|
|
266
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView()
|
|
267
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
268
|
-
cy.contains('Please enter your delivery instructions.')
|
|
269
|
-
cy.get('textarea[name="other"]').clear()
|
|
270
|
-
cy.get('textarea[name="other"]').type(
|
|
271
|
-
'This is more than seventy Characters. Lorem ipsum dolor sit amet, consectetur.'
|
|
272
|
-
)
|
|
273
|
-
cy.contains('You have 0 characters remaining')
|
|
274
|
-
cy.get('textarea[name="other"]').clear()
|
|
275
|
-
cy.get('textarea[name="other"]').type('Ring the bell')
|
|
276
|
-
// mock sussesful api call
|
|
277
|
-
cy.intercept('POST', '/api/account/mutate', {
|
|
278
|
-
statusCode: 200,
|
|
279
|
-
body: { data: { updateUserSubscription: { success: true } } },
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView()
|
|
283
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
284
|
-
cy.contains(
|
|
285
|
-
'[data-testid="toast-container"]',
|
|
286
|
-
'Updating your delivery instructions'
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
// Redirects to Subscription and billing page
|
|
290
|
-
cy.contains(
|
|
291
|
-
'[data-testid="toast-container"]',
|
|
292
|
-
'Your delivery instructions were succesfully updated. This may take up to 48hrs to come into effect.'
|
|
293
|
-
)
|
|
294
|
-
})
|
|
295
|
-
})
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
describe('My account commenting notifications', () => {
|
|
2
|
-
beforeEach(() => {
|
|
3
|
-
cy.GetTnlAcsSession('tnl')
|
|
4
|
-
cy.mockConsentAndVisit('/account/edit/commenting-notifications')
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
it('Should display commenting notifications', () => {
|
|
8
|
-
cy.get('[data-testid="layout-grid"]').contains(
|
|
9
|
-
'Edit your commenting notifications'
|
|
10
|
-
)
|
|
11
|
-
cy.get('[data-testid="layout-grid"]').contains(
|
|
12
|
-
'When someone mentions me in a comment'
|
|
13
|
-
)
|
|
14
|
-
cy.get('[data-testid="layout-grid"]').contains(
|
|
15
|
-
'When someone likes one of my comments'
|
|
16
|
-
)
|
|
17
|
-
cy.get('[data-testid="layout-grid"]').contains(
|
|
18
|
-
'When someone replies to one of my comments'
|
|
19
|
-
)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('Should update commenting notifications', () => {
|
|
23
|
-
cy.get('[data-testid="userMentioned"]').check()
|
|
24
|
-
cy.get('[data-testid="likedYourMessage"]').check()
|
|
25
|
-
cy.get('[data-testid="repliedToMessage"]').check()
|
|
26
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
27
|
-
cy.contains(
|
|
28
|
-
'[data-testid="toast-container"]',
|
|
29
|
-
'Your commenting notifications has been updated'
|
|
30
|
-
)
|
|
31
|
-
cy.visit('/account/edit/commenting-notifications')
|
|
32
|
-
cy.get('[data-testid="userMentioned"]').should('be.checked')
|
|
33
|
-
cy.get('[data-testid="likedYourMessage"]').should('be.checked')
|
|
34
|
-
cy.get('[data-testid="repliedToMessage"]').should('be.checked')
|
|
35
|
-
cy.get('[data-testid="userMentioned"]').uncheck()
|
|
36
|
-
cy.get('[data-testid="likedYourMessage"]').uncheck()
|
|
37
|
-
cy.get('[data-testid="repliedToMessage"]').uncheck()
|
|
38
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
39
|
-
|
|
40
|
-
cy.contains(
|
|
41
|
-
'[data-testid="toast-container"]',
|
|
42
|
-
'Your commenting notifications has been updated'
|
|
43
|
-
)
|
|
44
|
-
})
|
|
45
|
-
})
|
|
File without changes
|