@newskit-render/core 1.85.6 → 1.87.0-alpha.0
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/CHANGELOG.md +16 -0
- package/cypress/e2e/account/accessibility.spec.js +4 -0
- package/cypress/e2e/account/account-subscription.spec.js +109 -96
- package/cypress/e2e/account/payment-failer.spec.js +21 -60
- package/cypress/fixtures/paymentFailure.js +19 -0
- package/cypress/fixtures/print-subscriptions/print-subscription-response.json +50 -0
- package/cypress/plugins/index.js +19 -9
- package/cypress/support/commands.js +22 -0
- package/cypress/visual/account/print-visual-regression.spec.js +17 -0
- package/cypress/visual/account/visual-regression.spec.js +4 -0
- package/package.json +7 -6
- package/pages/account/subscription-and-billing/index.tsx +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.86.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.86.0-alpha.0...@newskit-render/core@1.86.0) (2022-09-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @newskit-render/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.85.6](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.85.6-alpha.1...@newskit-render/core@1.85.6) (2022-09-05)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @newskit-render/core
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.85.5](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.85.5-alpha.0...@newskit-render/core@1.85.5) (2022-09-05)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @newskit-render/core
|
|
@@ -33,6 +33,10 @@ const pages = [
|
|
|
33
33
|
url: '/account/edit/commenting-notifications',
|
|
34
34
|
name: 'Commenting Notifications form',
|
|
35
35
|
},
|
|
36
|
+
{
|
|
37
|
+
url: '/account/edit/delivery-instructions',
|
|
38
|
+
name: 'delivery instructions form',
|
|
39
|
+
},
|
|
36
40
|
]
|
|
37
41
|
|
|
38
42
|
describe('Page accessibility', () => {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as printSubscriptionPageProps from '../../fixtures/print-subscriptions/print-subscription-response.json'
|
|
2
|
+
import { paymentFailure } from '../../fixtures/paymentFailure'
|
|
1
3
|
// These tests are skiped now, until CPS resolves their issue with subsriptions.
|
|
2
4
|
describe('Account Subscription & Cancellation', () => {
|
|
3
5
|
it('Should show no subscription view', () => {
|
|
@@ -13,23 +15,12 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
13
15
|
it('Should show Pending Activation view', () => {
|
|
14
16
|
cy.GetAcsSession('expiredSub')
|
|
15
17
|
cy.mockConsent()
|
|
16
|
-
cy.visit('/account/subscription-and-billing', {
|
|
17
|
-
onBeforeLoad: (win) => {
|
|
18
|
-
let nextData
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
nextData = o
|
|
26
|
-
},
|
|
27
|
-
get() {
|
|
28
|
-
return nextData
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
},
|
|
32
|
-
})
|
|
19
|
+
cy.visitAndOverrideNextData(
|
|
20
|
+
'/account/subscription-and-billing',
|
|
21
|
+
'props.pageProps.user.subscriptions[0].status',
|
|
22
|
+
'Pending Activation'
|
|
23
|
+
)
|
|
33
24
|
cy.contains('Your subscription is being activated')
|
|
34
25
|
cy.contains(
|
|
35
26
|
'Your membership is being set up at the moment, so you can’t access your subscription and billing details yet.'
|
|
@@ -43,23 +34,12 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
43
34
|
cy.GetAcsSession('expiredSub')
|
|
44
35
|
cy.mockConsent()
|
|
45
36
|
const date = new Date(Date.now() - 24 * 35 * 3600 * 1000)
|
|
46
|
-
cy.visit('/account/subscription-and-billing', {
|
|
47
|
-
onBeforeLoad: (win) => {
|
|
48
|
-
let nextData
|
|
49
|
-
|
|
50
|
-
Object.defineProperty(win, '__NEXT_DATA__', {
|
|
51
|
-
set(o) {
|
|
52
|
-
// eslint-disable-next-line no-param-reassign
|
|
53
|
-
o.props.pageProps.user.subscriptions[0].serviceCancellationDate = date.toISOString()
|
|
54
|
-
nextData = o
|
|
55
|
-
},
|
|
56
|
-
get() {
|
|
57
|
-
return nextData
|
|
58
|
-
},
|
|
59
|
-
})
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
37
|
|
|
38
|
+
cy.visitAndOverrideNextData(
|
|
39
|
+
'/account/subscription-and-billing',
|
|
40
|
+
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
41
|
+
date.toISOString()
|
|
42
|
+
)
|
|
63
43
|
cy.contains('You’ve previously had a subscription that has now expired')
|
|
64
44
|
|
|
65
45
|
cy.contains(
|
|
@@ -110,22 +90,12 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
110
90
|
cy.intercept('/account/subscription-and-billing')
|
|
111
91
|
// reload with correct mock data to show past banner
|
|
112
92
|
const date = new Date(Date.now() + 20 * 30 * 3600 * 1000)
|
|
113
|
-
cy.visit('/account/subscription-and-billing', {
|
|
114
|
-
onBeforeLoad: (win) => {
|
|
115
|
-
let nextData
|
|
116
93
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
get() {
|
|
124
|
-
return nextData
|
|
125
|
-
},
|
|
126
|
-
})
|
|
127
|
-
},
|
|
128
|
-
})
|
|
94
|
+
cy.visitAndOverrideNextData(
|
|
95
|
+
'/account/subscription-and-billing',
|
|
96
|
+
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
97
|
+
date.toISOString()
|
|
98
|
+
)
|
|
129
99
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
130
100
|
cy.contains('Your subscription will end soon.')
|
|
131
101
|
cy.contains(
|
|
@@ -163,22 +133,12 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
163
133
|
cy.GetAcsSession('withSub')
|
|
164
134
|
cy.mockConsent()
|
|
165
135
|
const date = new Date(Date.now() + 20 * 30 * 3600 * 1000)
|
|
166
|
-
cy.visit('/account/subscription-and-billing', {
|
|
167
|
-
onBeforeLoad: (win) => {
|
|
168
|
-
let nextData
|
|
169
136
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
get() {
|
|
177
|
-
return nextData
|
|
178
|
-
},
|
|
179
|
-
})
|
|
180
|
-
},
|
|
181
|
-
})
|
|
137
|
+
cy.visitAndOverrideNextData(
|
|
138
|
+
'/account/subscription-and-billing',
|
|
139
|
+
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
140
|
+
date.toISOString()
|
|
141
|
+
)
|
|
182
142
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
183
143
|
cy.contains('Your subscription will end soon.')
|
|
184
144
|
cy.get('button[data-testid="banner-close-button"]').click({
|
|
@@ -193,22 +153,11 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
193
153
|
cy.GetAcsSession('withSub')
|
|
194
154
|
cy.mockConsent()
|
|
195
155
|
const date = new Date(Date.now() - 24 * 35 * 3600 * 1000)
|
|
196
|
-
cy.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
set(o) {
|
|
202
|
-
// eslint-disable-next-line no-param-reassign
|
|
203
|
-
o.props.pageProps.user.subscriptions[0].serviceCancellationDate = date.toISOString()
|
|
204
|
-
nextData = o
|
|
205
|
-
},
|
|
206
|
-
get() {
|
|
207
|
-
return nextData
|
|
208
|
-
},
|
|
209
|
-
})
|
|
210
|
-
},
|
|
211
|
-
})
|
|
156
|
+
cy.visitAndOverrideNextData(
|
|
157
|
+
'/account/subscription-and-billing',
|
|
158
|
+
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
159
|
+
date.toISOString()
|
|
160
|
+
)
|
|
212
161
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
213
162
|
cy.contains('Your subscription has been cancelled.').then(() => {
|
|
214
163
|
window.localStorage.setItem(
|
|
@@ -224,25 +173,12 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
224
173
|
it('should show modal when Cancel subscription link is clicked but user is in payment failure', () => {
|
|
225
174
|
cy.GetAcsSession('withSub')
|
|
226
175
|
cy.mockConsent()
|
|
227
|
-
cy.visit('/account/subscription-and-billing', {
|
|
228
|
-
onBeforeLoad: (win) => {
|
|
229
|
-
let nextData
|
|
230
176
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
startDate: new Date().toISOString(),
|
|
237
|
-
}
|
|
238
|
-
nextData = o
|
|
239
|
-
},
|
|
240
|
-
get() {
|
|
241
|
-
return nextData
|
|
242
|
-
},
|
|
243
|
-
})
|
|
244
|
-
},
|
|
245
|
-
})
|
|
177
|
+
cy.visitAndOverrideNextData(
|
|
178
|
+
'/account/subscription-and-billing',
|
|
179
|
+
'props.pageProps.user.paymentFailure',
|
|
180
|
+
paymentFailure
|
|
181
|
+
)
|
|
246
182
|
cy.get('a[href="/account/cancellation"]').should('be.visible').click()
|
|
247
183
|
|
|
248
184
|
cy.contains('You have outstanding payments')
|
|
@@ -265,4 +201,81 @@ describe('Account Subscription & Cancellation', () => {
|
|
|
265
201
|
'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.'
|
|
266
202
|
)
|
|
267
203
|
})
|
|
204
|
+
|
|
205
|
+
it('should show your deliveries section if the subscription has print', () => {
|
|
206
|
+
cy.GetAcsSession('withSub')
|
|
207
|
+
cy.mockConsent()
|
|
208
|
+
|
|
209
|
+
cy.visitAndOverrideNextData(
|
|
210
|
+
'/account/subscription-and-billing',
|
|
211
|
+
'props.pageProps.user.subscriptions',
|
|
212
|
+
printSubscriptionPageProps.props.pageProps.user.subscriptions
|
|
213
|
+
)
|
|
214
|
+
cy.contains('Your deliveries')
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
it('should be able to add your delivery instructions', () => {
|
|
218
|
+
cy.GetAcsSession('withSub')
|
|
219
|
+
cy.mockConsentAndVisit('/account/edit/delivery-instructions')
|
|
220
|
+
cy.contains('h1', 'Delivery instructions')
|
|
221
|
+
cy.contains('Where should we leave your Newspaper?')
|
|
222
|
+
cy.get('[type="radio"]').first().should('be.checked')
|
|
223
|
+
// mock sussesful api call
|
|
224
|
+
cy.intercept('POST', '/api/account/mutate', {
|
|
225
|
+
statusCode: 200,
|
|
226
|
+
body: { data: { updateUserSubscription: { success: true } } },
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
230
|
+
cy.contains(
|
|
231
|
+
'[data-testid="toast-container"]',
|
|
232
|
+
'Updating your delivery instructions'
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
// Redirects to Subscription and billing page
|
|
236
|
+
cy.contains(
|
|
237
|
+
'[data-testid="toast-container"]',
|
|
238
|
+
'Your delivery instructions were succesfully updated. This may take up to 48hrs to come into effect.'
|
|
239
|
+
)
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('should be able to add your custom delivery instructions', () => {
|
|
243
|
+
cy.GetAcsSession('withSub')
|
|
244
|
+
cy.mockConsentAndVisit('/account/edit/delivery-instructions')
|
|
245
|
+
cy.contains('h1', 'Delivery instructions')
|
|
246
|
+
cy.contains('Where should we leave your Newspaper?')
|
|
247
|
+
|
|
248
|
+
// cy.get('[value="Other (Please state)"]').first().check()
|
|
249
|
+
cy.get('[type="radio"]').check('Other (Please state)')
|
|
250
|
+
cy.contains(
|
|
251
|
+
'Please note that if you choose a delivery location that is not secure we cannot be liable for lost or stolen newspapers.'
|
|
252
|
+
)
|
|
253
|
+
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
254
|
+
cy.contains('Please enter your delivery instructions.')
|
|
255
|
+
cy.get('input[name="other"]')
|
|
256
|
+
.clear()
|
|
257
|
+
.type(
|
|
258
|
+
'This is more than seventy Characters. Lorem ipsum dolor sit amet, consectetur.'
|
|
259
|
+
)
|
|
260
|
+
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
261
|
+
cy.contains('You cannot exceed 70 characters')
|
|
262
|
+
cy.get('input[name="other"]').clear().type('Ring the bell')
|
|
263
|
+
// mock sussesful api call
|
|
264
|
+
cy.intercept('POST', '/api/account/mutate', {
|
|
265
|
+
statusCode: 200,
|
|
266
|
+
body: { data: { updateUserSubscription: { success: true } } },
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
270
|
+
cy.contains(
|
|
271
|
+
'[data-testid="toast-container"]',
|
|
272
|
+
'Updating your delivery instructions'
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
// Redirects to Subscription and billing page
|
|
276
|
+
cy.contains(
|
|
277
|
+
'[data-testid="toast-container"]',
|
|
278
|
+
'Your delivery instructions were succesfully updated. This may take up to 48hrs to come into effect.'
|
|
279
|
+
)
|
|
280
|
+
})
|
|
268
281
|
})
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
paymentFailureFirstNotice,
|
|
3
|
+
paymentFailureSecondNotice,
|
|
4
|
+
paymentFailureTerminatedNotice,
|
|
5
|
+
} from '../../fixtures/paymentFailure'
|
|
6
|
+
|
|
1
7
|
describe('Payment Failer', () => {
|
|
2
8
|
it('Should show first notice', () => {
|
|
3
9
|
cy.GetAcsSession('withSub')
|
|
4
10
|
cy.mockConsent()
|
|
5
|
-
cy.visit('/account', {
|
|
6
|
-
onBeforeLoad: (win) => {
|
|
7
|
-
let nextData
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
startDate: new Date(Date.now() - 24 * 3600 * 1000).toISOString(),
|
|
15
|
-
}
|
|
16
|
-
nextData = o
|
|
17
|
-
},
|
|
18
|
-
get() {
|
|
19
|
-
return nextData
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
},
|
|
23
|
-
})
|
|
12
|
+
cy.visitAndOverrideNextData(
|
|
13
|
+
'/account',
|
|
14
|
+
'props.pageProps.user.paymentFailure',
|
|
15
|
+
paymentFailureFirstNotice
|
|
16
|
+
)
|
|
24
17
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
25
18
|
cy.contains("We haven't been able to take payment")
|
|
26
19
|
cy.contains(
|
|
@@ -33,27 +26,12 @@ describe('Payment Failer', () => {
|
|
|
33
26
|
it('Should show second notice', () => {
|
|
34
27
|
cy.GetAcsSession('withSub')
|
|
35
28
|
cy.mockConsent()
|
|
36
|
-
cy.visit('/account', {
|
|
37
|
-
onBeforeLoad: (win) => {
|
|
38
|
-
let nextData
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
startDate: new Date(
|
|
46
|
-
Date.now() - 24 * 27 * 3600 * 1000
|
|
47
|
-
).toISOString(),
|
|
48
|
-
}
|
|
49
|
-
nextData = o
|
|
50
|
-
},
|
|
51
|
-
get() {
|
|
52
|
-
return nextData
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
},
|
|
56
|
-
})
|
|
30
|
+
cy.visitAndOverrideNextData(
|
|
31
|
+
'/account',
|
|
32
|
+
'props.pageProps.user.paymentFailure',
|
|
33
|
+
paymentFailureSecondNotice
|
|
34
|
+
)
|
|
57
35
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
58
36
|
cy.contains('Act now to keep your subscription')
|
|
59
37
|
cy.contains(
|
|
@@ -66,27 +44,11 @@ describe('Payment Failer', () => {
|
|
|
66
44
|
it('Should show terminated notice', () => {
|
|
67
45
|
cy.GetAcsSession('withSub')
|
|
68
46
|
cy.mockConsent()
|
|
69
|
-
cy.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
set(o) {
|
|
75
|
-
// eslint-disable-next-line no-param-reassign
|
|
76
|
-
o.props.pageProps.user.paymentFailure = {
|
|
77
|
-
active: true,
|
|
78
|
-
startDate: new Date(
|
|
79
|
-
Date.now() - 24 * 35 * 3600 * 1000
|
|
80
|
-
).toISOString(),
|
|
81
|
-
}
|
|
82
|
-
nextData = o
|
|
83
|
-
},
|
|
84
|
-
get() {
|
|
85
|
-
return nextData
|
|
86
|
-
},
|
|
87
|
-
})
|
|
88
|
-
},
|
|
89
|
-
})
|
|
47
|
+
cy.visitAndOverrideNextData(
|
|
48
|
+
'/account',
|
|
49
|
+
'props.pageProps.user.paymentFailure',
|
|
50
|
+
paymentFailureTerminatedNotice
|
|
51
|
+
)
|
|
90
52
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
91
53
|
cy.contains('Your subscription has been terminated')
|
|
92
54
|
cy.contains(
|
|
@@ -119,7 +81,6 @@ describe('Payment Failer', () => {
|
|
|
119
81
|
})
|
|
120
82
|
},
|
|
121
83
|
})
|
|
122
|
-
|
|
123
84
|
cy.contains('You’ve previously had a subscription that has now expired')
|
|
124
85
|
|
|
125
86
|
cy.contains(
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const paymentFailure = {
|
|
2
|
+
active: true,
|
|
3
|
+
startDate: new Date(Date.now() - 24 * 35 * 3600 * 1000),
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const paymentFailureFirstNotice = {
|
|
7
|
+
active: true,
|
|
8
|
+
startDate: new Date(Date.now() - 24 * 3600 * 1000).toISOString(),
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const paymentFailureSecondNotice = {
|
|
12
|
+
active: true,
|
|
13
|
+
startDate: new Date(Date.now() - 24 * 27 * 3600 * 1000).toISOString(),
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const paymentFailureTerminatedNotice = {
|
|
17
|
+
active: true,
|
|
18
|
+
startDate: new Date(Date.now() - 24 * 35 * 3600 * 1000).toISOString(),
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"props": {
|
|
3
|
+
"pageProps": {
|
|
4
|
+
"user": {
|
|
5
|
+
"paymentFailure": {
|
|
6
|
+
"__typename": "CustomerPaymentFailure",
|
|
7
|
+
"active": false,
|
|
8
|
+
"startDate": null
|
|
9
|
+
},
|
|
10
|
+
"subscriptions": [
|
|
11
|
+
{
|
|
12
|
+
"id": "SUB-0010708256",
|
|
13
|
+
"startDate": "2022-08-01T13:22:33",
|
|
14
|
+
"serviceCancellationDate": null,
|
|
15
|
+
"isActive": true,
|
|
16
|
+
"currency": "GBP",
|
|
17
|
+
"price": 0,
|
|
18
|
+
"type": "Print",
|
|
19
|
+
"status": "Active",
|
|
20
|
+
"billingDetails": {
|
|
21
|
+
"__typename": "BillingDetails",
|
|
22
|
+
"billCycleDay": null,
|
|
23
|
+
"paymentMethod": {
|
|
24
|
+
"__typename": "PaymentMethod",
|
|
25
|
+
"cardType": null,
|
|
26
|
+
"cardNumber": null,
|
|
27
|
+
"type": null,
|
|
28
|
+
"expirationYear": null,
|
|
29
|
+
"expirationMonth": null
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"__typename": "Subscription"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"__typename": "User",
|
|
36
|
+
"cpn": "4AAA039158001"
|
|
37
|
+
},
|
|
38
|
+
"env": { "LOQACCOUNT_KEY": "" }
|
|
39
|
+
},
|
|
40
|
+
"tenant": "DEMO",
|
|
41
|
+
"__N_SSP": true
|
|
42
|
+
},
|
|
43
|
+
"page": "/account/subscription-and-billing",
|
|
44
|
+
"query": {},
|
|
45
|
+
"buildId": "development",
|
|
46
|
+
"isFallback": false,
|
|
47
|
+
"gssp": true,
|
|
48
|
+
"appGip": true,
|
|
49
|
+
"scriptLoader": []
|
|
50
|
+
}
|
package/cypress/plugins/index.js
CHANGED
|
@@ -17,24 +17,35 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import fs from 'fs'
|
|
19
19
|
import path from 'path'
|
|
20
|
-
|
|
20
|
+
import { loadEnvConfig } from '@next/env'
|
|
21
21
|
module.exports = (on, config) => {
|
|
22
22
|
// `on` is used to hook into various events Cypress emits
|
|
23
23
|
// `config` is the resolved Cypress config
|
|
24
|
+
const projectDir = process.cwd()
|
|
25
|
+
loadEnvConfig(projectDir)
|
|
24
26
|
const conf = config
|
|
25
27
|
|
|
26
|
-
const dirPath =
|
|
28
|
+
const dirPath =
|
|
29
|
+
config.integrationFolder === './cypress/e2e'
|
|
30
|
+
? path.resolve('./cypress/e2e')
|
|
31
|
+
: path.resolve('./cypress/visual')
|
|
27
32
|
fs.readdir(dirPath, function (err, files) {
|
|
28
33
|
if (err) {
|
|
29
|
-
|
|
30
|
-
}
|
|
34
|
+
return console.log('Unable to scan directory: ' + err)
|
|
35
|
+
}
|
|
31
36
|
//listing all files using forEach. For this script to work the folder must only contain folders with spec files
|
|
32
37
|
files.forEach(function (file) {
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
return conf
|
|
36
|
-
})
|
|
38
|
+
conf.integrationFolder = `${dirPath}/${file}`
|
|
39
|
+
})
|
|
40
|
+
return conf
|
|
41
|
+
})
|
|
42
|
+
const printVisualPath = path.resolve('./cypress/visual')
|
|
37
43
|
|
|
44
|
+
fs.readdir(printVisualPath, function (err, files) {
|
|
45
|
+
files.forEach(function (file) {
|
|
46
|
+
console.log(file, 'file logged')
|
|
47
|
+
})
|
|
48
|
+
})
|
|
38
49
|
on('task', {
|
|
39
50
|
log(message) {
|
|
40
51
|
console.log(message)
|
|
@@ -43,7 +54,6 @@ return conf
|
|
|
43
54
|
},
|
|
44
55
|
table(message) {
|
|
45
56
|
console.table(message)
|
|
46
|
-
|
|
47
57
|
return null
|
|
48
58
|
},
|
|
49
59
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//Note: Check periodically if these consent cookie values exprire
|
|
2
|
+
import _ from 'lodash'
|
|
2
3
|
const nuktSPConsentValue = 'JABCDEFGHI'
|
|
3
4
|
const consentUUIDValue = 'ff8ac797-02c4-4fb4-81f2-22f8ba2e8723_8'
|
|
4
5
|
|
|
@@ -79,3 +80,24 @@ Cypress.Commands.add('getZuoraElement', (selector) => {
|
|
|
79
80
|
.then(cy.wrap)
|
|
80
81
|
.find(selector)
|
|
81
82
|
})
|
|
83
|
+
|
|
84
|
+
Cypress.Commands.add(
|
|
85
|
+
'visitAndOverrideNextData',
|
|
86
|
+
(url, originalObject, objToOverrideWith) => {
|
|
87
|
+
cy.visit(url, {
|
|
88
|
+
onBeforeLoad: (win) => {
|
|
89
|
+
let nextData
|
|
90
|
+
|
|
91
|
+
Object.defineProperty(win, '__NEXT_DATA__', {
|
|
92
|
+
set(o) {
|
|
93
|
+
_.set(o, `${originalObject}`, objToOverrideWith)
|
|
94
|
+
nextData = o
|
|
95
|
+
},
|
|
96
|
+
get() {
|
|
97
|
+
return nextData
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as printSubscriptionPageProps from '../../fixtures/print-subscriptions/print-subscription-response.json'
|
|
2
|
+
|
|
3
|
+
describe('Visual regression for print and digi_print subscriptions', () => {
|
|
4
|
+
it('should show sections for print user subscribtions', () => {
|
|
5
|
+
cy.GetAcsSession('withSub')
|
|
6
|
+
cy.mockConsent()
|
|
7
|
+
cy.visitAndOverrideNextData(
|
|
8
|
+
'/account/subscription-and-billing',
|
|
9
|
+
'props.pageProps.user.subscriptions',
|
|
10
|
+
printSubscriptionPageProps.props.pageProps.user.subscriptions
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
cy.eyesOpen()
|
|
14
|
+
cy.eyesCheckWindow('Subscription and Billing page for print subscriptions')
|
|
15
|
+
cy.eyesClose()
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -18,6 +18,10 @@ const pages = [
|
|
|
18
18
|
url: '/account/edit/commenting-notifications',
|
|
19
19
|
pageName: 'Commenting Notifications form',
|
|
20
20
|
},
|
|
21
|
+
{
|
|
22
|
+
url: '/account/edit/delivery-instructions',
|
|
23
|
+
name: 'delivery instructions form',
|
|
24
|
+
},
|
|
21
25
|
]
|
|
22
26
|
|
|
23
27
|
describe('Visual regression', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.87.0-alpha.0",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"cy:run": "cypress run --config-file cypress/config/config.e2e.json -b chrome --headless",
|
|
20
20
|
"cy:vis": "cypress run --config-file cypress/config/config.visual.json -b chrome --headless",
|
|
21
21
|
"cy:open": "cypress open --config-file cypress/config/config.e2e.json -b chrome",
|
|
22
|
+
"cy:open:vis": "cypress open --config-file cypress/config/config.visual.json -b chrome",
|
|
22
23
|
"test:e2e": "yarn cy:run",
|
|
23
24
|
"test:e2e:ci": "cypress run --env -b chrome --headless",
|
|
24
25
|
"start:test:server": "next build && next start",
|
|
@@ -35,13 +36,13 @@
|
|
|
35
36
|
"@apollo/client": "3.4.16",
|
|
36
37
|
"@newskit-render/api": "^0.37.1",
|
|
37
38
|
"@newskit-render/auth": "^0.45.1",
|
|
38
|
-
"@newskit-render/checkout": "^0.54.
|
|
39
|
+
"@newskit-render/checkout": "^0.54.7-alpha.0",
|
|
39
40
|
"@newskit-render/feature-flags": "^0.25.1",
|
|
40
41
|
"@newskit-render/feed": "^0.27.1",
|
|
41
|
-
"@newskit-render/my-account": "^2.
|
|
42
|
-
"@newskit-render/shared-components": "^0.
|
|
43
|
-
"@newskit-render/standalone-components": "^0.35.
|
|
44
|
-
"@newskit-render/validation": "^0.
|
|
42
|
+
"@newskit-render/my-account": "^2.6.0-alpha.0",
|
|
43
|
+
"@newskit-render/shared-components": "^0.72.0-alpha.0",
|
|
44
|
+
"@newskit-render/standalone-components": "^0.35.2-alpha.0",
|
|
45
|
+
"@newskit-render/validation": "^0.53.0-alpha.0",
|
|
45
46
|
"cross-fetch": "3.1.5",
|
|
46
47
|
"graphql": "15.6.0",
|
|
47
48
|
"lodash.get": "4.4.2",
|
|
@@ -23,5 +23,10 @@ export default AccountSubscriptionAndBilling
|
|
|
23
23
|
|
|
24
24
|
export const getServerSideProps = async (context) => {
|
|
25
25
|
newrelic.setTransactionName('Account: Subscription and Billing')
|
|
26
|
-
|
|
26
|
+
const result = await getProviderProps({
|
|
27
|
+
...context,
|
|
28
|
+
provider: 'SubscriptionAndBilling',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
return result
|
|
27
32
|
}
|