@newskit-render/core 4.26.3-alpha.1 → 4.26.3-alpha.3
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
|
@@ -71,3 +71,18 @@ describe('Page accessibility', () => {
|
|
|
71
71
|
})
|
|
72
72
|
})
|
|
73
73
|
})
|
|
74
|
+
|
|
75
|
+
describe('SkipToContent', () => {
|
|
76
|
+
beforeEach(() => {
|
|
77
|
+
cy.GetAcsSession()
|
|
78
|
+
cy.mockConsentAndVisit('/account')
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('should take the user to the beginning of the main area', () => {
|
|
82
|
+
cy.get('[data-testid="skip-to-content"]').as('skiptocontentBtn')
|
|
83
|
+
cy.get('@skiptocontentBtn').focus()
|
|
84
|
+
cy.get('@skiptocontentBtn').should('contain', 'Skip to main content')
|
|
85
|
+
cy.get('@skiptocontentBtn').click()
|
|
86
|
+
cy.focused().should('have.id', 'main')
|
|
87
|
+
})
|
|
88
|
+
})
|
|
@@ -2,58 +2,86 @@ import {
|
|
|
2
2
|
paymentFailureFirstNotice,
|
|
3
3
|
paymentFailureSecondNotice,
|
|
4
4
|
paymentFailureTerminatedNotice,
|
|
5
|
+
serviceCancellationDate,
|
|
5
6
|
} from '../../fixtures/paymentFailure'
|
|
6
7
|
|
|
7
|
-
describe('
|
|
8
|
+
describe('Banners', () => {
|
|
8
9
|
it('Should show first notice', () => {
|
|
9
|
-
cy.
|
|
10
|
+
cy.GetTnlAcsSession('tnl')
|
|
10
11
|
cy.mockConsent()
|
|
11
|
-
|
|
12
12
|
cy.visitAndOverrideNextData(
|
|
13
13
|
'/account',
|
|
14
14
|
'props.pageProps.user.paymentFailure',
|
|
15
15
|
paymentFailureFirstNotice
|
|
16
16
|
)
|
|
17
|
+
|
|
17
18
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
18
19
|
cy.contains("We haven't been able to take payment")
|
|
19
20
|
cy.contains(
|
|
20
21
|
'You may need to update your payment details to keep your subscription.'
|
|
21
22
|
)
|
|
22
23
|
cy.get('[data-testid="buttonLink"]').should('be.visible')
|
|
24
|
+
cy.get('[data-testid="banner-close-button"]').should('be.visible')
|
|
23
25
|
cy.contains('Update payment details')
|
|
24
26
|
})
|
|
25
27
|
|
|
26
28
|
it('Should show second notice', () => {
|
|
27
|
-
cy.
|
|
29
|
+
cy.GetTnlAcsSession('tnl')
|
|
28
30
|
cy.mockConsent()
|
|
29
|
-
|
|
30
31
|
cy.visitAndOverrideNextData(
|
|
31
32
|
'/account',
|
|
32
33
|
'props.pageProps.user.paymentFailure',
|
|
33
34
|
paymentFailureSecondNotice
|
|
34
35
|
)
|
|
36
|
+
|
|
35
37
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
36
38
|
cy.contains('Act now to keep your subscription')
|
|
37
39
|
cy.contains(
|
|
38
40
|
'We’ve tried several times, but haven’t been able to take payment. Please update your payment details to keep your subscription.'
|
|
39
41
|
)
|
|
40
42
|
cy.get('[data-testid="buttonLink"]').should('be.visible')
|
|
43
|
+
cy.get('[data-testid="banner-close-button"]').should('be.visible')
|
|
41
44
|
cy.contains('Update payment details')
|
|
42
45
|
})
|
|
43
46
|
|
|
44
47
|
it('Should show terminated notice', () => {
|
|
45
|
-
cy.
|
|
48
|
+
cy.GetTnlAcsSession('tnl')
|
|
46
49
|
cy.mockConsent()
|
|
47
50
|
cy.visitAndOverrideNextData(
|
|
48
51
|
'/account',
|
|
49
52
|
'props.pageProps.user.paymentFailure',
|
|
50
53
|
paymentFailureTerminatedNotice
|
|
51
54
|
)
|
|
55
|
+
|
|
52
56
|
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
53
57
|
cy.contains('Your subscription has been terminated')
|
|
54
58
|
cy.contains(
|
|
55
|
-
'We didn’t receive payment for your subscription. To reactivate it, please call XXXX-XXX-XXXX.'
|
|
59
|
+
'We didn’t receive payment for your subscription. To reactivate it, please call XXXX-XXX-XXXX. Or click here.'
|
|
60
|
+
)
|
|
61
|
+
cy.get('[data-testid="banner-close-button"]').should('be.visible')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('Should show to be cancelled notice', () => {
|
|
65
|
+
cy.GetTnlAcsSession('tnl')
|
|
66
|
+
cy.mockConsent()
|
|
67
|
+
cy.visitAndOverrideNextData(
|
|
68
|
+
'/account',
|
|
69
|
+
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
70
|
+
serviceCancellationDate
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
74
|
+
cy.contains('Your subscription will end soon.')
|
|
75
|
+
cy.contains(
|
|
76
|
+
`You have cancelled your subscription and will lose access to all benefits on ${new Date(
|
|
77
|
+
serviceCancellationDate
|
|
78
|
+
).getDate()}/${
|
|
79
|
+
new Date(serviceCancellationDate).getMonth() + 1
|
|
80
|
+
}/${new Date(
|
|
81
|
+
serviceCancellationDate
|
|
82
|
+
).getFullYear()}. To re-activate your subscription call XXXX-XXX-XXXX.`
|
|
56
83
|
)
|
|
84
|
+
cy.get('[data-testid="banner-close-button"]').should('be.visible')
|
|
57
85
|
})
|
|
58
86
|
|
|
59
87
|
it('Should show expired subscription view with terminated notice', () => {
|
|
@@ -85,6 +113,7 @@ describe('Payment Failer', () => {
|
|
|
85
113
|
Cypress.on('uncaught:exception', (err, runnable) => {
|
|
86
114
|
return false
|
|
87
115
|
})
|
|
116
|
+
|
|
88
117
|
cy.contains('You’ve previously had a subscription that has now expired')
|
|
89
118
|
|
|
90
119
|
cy.contains(
|
|
@@ -99,4 +128,42 @@ describe('Payment Failer', () => {
|
|
|
99
128
|
.should('have.attr', 'href', '/title-subscription-options')
|
|
100
129
|
.contains('View subscription options')
|
|
101
130
|
})
|
|
131
|
+
|
|
132
|
+
it('Should not show banner once it has been dismissed', () => {
|
|
133
|
+
cy.GetAcsSession('withSub')
|
|
134
|
+
cy.mockConsent()
|
|
135
|
+
const date = new Date(Date.now() + 20 * 30 * 3600 * 1000)
|
|
136
|
+
|
|
137
|
+
cy.visitAndOverrideNextData(
|
|
138
|
+
'/account/subscription-and-billing',
|
|
139
|
+
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
140
|
+
date.toISOString()
|
|
141
|
+
)
|
|
142
|
+
cy.get('[data-testid="past-due-banner"]').should('be.visible')
|
|
143
|
+
cy.contains('Your subscription will end soon.').should('exist')
|
|
144
|
+
cy.get('[data-testid="banner-close-button"]').filter(':visible').click()
|
|
145
|
+
cy.reload()
|
|
146
|
+
cy.get('[data-testid="past-due-banner"]').should('not.exist')
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('Should not display banner if set date is passed current date', () => {
|
|
150
|
+
cy.GetAcsSession('withSub')
|
|
151
|
+
cy.mockConsent()
|
|
152
|
+
const date = new Date(Date.now() - 24 * 35 * 3600 * 1000)
|
|
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 has been cancelled.').then(() => {
|
|
160
|
+
window.localStorage.setItem(
|
|
161
|
+
'cancelledBanner',
|
|
162
|
+
new Date(new Date().setDate(new Date().getDate() - 7)).toDateString()
|
|
163
|
+
)
|
|
164
|
+
})
|
|
165
|
+
cy.reload()
|
|
166
|
+
cy.get('[data-testid="past-due-banner"]').should('not.exist')
|
|
167
|
+
cy.clearLocalStorage()
|
|
168
|
+
})
|
|
102
169
|
})
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { paymentFailure } from '../../fixtures/paymentFailure'
|
|
2
|
+
|
|
3
|
+
import { serviceCancellationDate } from '../../fixtures/paymentFailure'
|
|
4
|
+
|
|
5
|
+
describe('Cancellation page', () => {
|
|
6
|
+
describe('Find a better name', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
cy.GetTnlAcsSession('digitalCard')
|
|
9
|
+
cy.mockConsentAndVisit('/account/cancellation')
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('Should show user cancellation reasons', () => {
|
|
13
|
+
cy.contains('Please tell us why you want to cancel')
|
|
14
|
+
cy.contains(
|
|
15
|
+
'We value your opinion and this information will help us understand how we can improve our product and the services we provide.'
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
cy.contains('Select one option from the list below.')
|
|
19
|
+
|
|
20
|
+
cy.contains(
|
|
21
|
+
'label',
|
|
22
|
+
'I only subscribed to read a specific article/redeem an offer'
|
|
23
|
+
)
|
|
24
|
+
cy.contains(
|
|
25
|
+
'label',
|
|
26
|
+
'I cannot justify paying for my current subscription'
|
|
27
|
+
)
|
|
28
|
+
cy.contains(
|
|
29
|
+
'label',
|
|
30
|
+
'I do not have enough time to read the edition everyday'
|
|
31
|
+
)
|
|
32
|
+
cy.contains('label', 'I prefer another news subscription service')
|
|
33
|
+
cy.contains('label', 'I do not enjoy the journalism')
|
|
34
|
+
cy.contains('label', 'I am travelling or moving abroad')
|
|
35
|
+
cy.contains('label', 'Other')
|
|
36
|
+
cy.contains('label', 'Prefer not to say')
|
|
37
|
+
|
|
38
|
+
cy.contains('[data-testid="primary-button"]', 'Continue cancellation')
|
|
39
|
+
cy.contains('[data-testid="secondary-button"]', 'Keep subscription')
|
|
40
|
+
|
|
41
|
+
//Redirects to Subscription and Billing page
|
|
42
|
+
cy.get('[data-testid="secondary-button"]').click()
|
|
43
|
+
cy.location().should((loc) => {
|
|
44
|
+
expect(loc.pathname).to.eq('/account/subscription-and-billing')
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
it('Should show user text field when selecting Other as option', () => {
|
|
48
|
+
cy.contains('Select one option from the list below.')
|
|
49
|
+
cy.get('[type="radio"]').check('Other')
|
|
50
|
+
cy.contains('(please state)')
|
|
51
|
+
|
|
52
|
+
cy.get('textarea[name="other"]').clear()
|
|
53
|
+
cy.get('textarea[name="other"]').type('Thanks my business') //There is no validation for the text area
|
|
54
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
55
|
+
|
|
56
|
+
cy.contains('Are you sure you want to cancel your subscription?')
|
|
57
|
+
cy.contains('Cancel subscription')
|
|
58
|
+
})
|
|
59
|
+
it('Should cancel user subscription', () => {
|
|
60
|
+
cy.contains('Select one option from the list below.')
|
|
61
|
+
cy.contains(
|
|
62
|
+
'I only subscribed to read a specific article/redeem an offer'
|
|
63
|
+
).click()
|
|
64
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
65
|
+
|
|
66
|
+
//Cancelation confirmation modal
|
|
67
|
+
cy.contains('Are you sure you want to cancel your subscription?')
|
|
68
|
+
cy.contains(
|
|
69
|
+
'You will lose unlimited access to exclusive content and benefits.'
|
|
70
|
+
)
|
|
71
|
+
cy.contains('Please note:')
|
|
72
|
+
cy.contains(
|
|
73
|
+
'Your subscription full access will be revoked by the end of your current bill cycle.'
|
|
74
|
+
)
|
|
75
|
+
cy.contains('Cancel subscription')
|
|
76
|
+
cy.contains('Keep subscription')
|
|
77
|
+
|
|
78
|
+
cy.intercept('POST', '/api/account/mutate', {
|
|
79
|
+
statusCode: 200,
|
|
80
|
+
body: { data: { cancelSubscription: { success: true } } },
|
|
81
|
+
})
|
|
82
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
83
|
+
|
|
84
|
+
cy.contains(
|
|
85
|
+
'[data-testid="toast-container"]',
|
|
86
|
+
'Cancelling your subscription'
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
// Post-cancellation modal
|
|
90
|
+
cy.get('[data-testid="dialog-content"]').should('be.visible')
|
|
91
|
+
cy.contains('Subscription cancelled')
|
|
92
|
+
cy.contains(
|
|
93
|
+
'Sorry to see you go, cancellation will be effective immediately and any current subscription benefits will be removed from your account.'
|
|
94
|
+
)
|
|
95
|
+
cy.contains(
|
|
96
|
+
'If you change your mind or cancelled by mistake, speak to one of our advisors on XXXX-XXX-XXXX.'
|
|
97
|
+
)
|
|
98
|
+
cy.contains('Back to account')
|
|
99
|
+
|
|
100
|
+
cy.get('[data-testid="centered-button"]').click()
|
|
101
|
+
|
|
102
|
+
cy.location().should((loc) => {
|
|
103
|
+
expect(loc.pathname).to.eq('/account/subscription-and-billing')
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
cy.visitAndOverrideNextData(
|
|
107
|
+
'/account/subscription-and-billing',
|
|
108
|
+
'props.pageProps.user.subscriptions[0].serviceCancellationDate',
|
|
109
|
+
serviceCancellationDate
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
cy.get('[data-testid="inline-message"]').contains(
|
|
113
|
+
'Your subscription will end soon'
|
|
114
|
+
)
|
|
115
|
+
cy.get('[data-testid="inline-message"]').contains(
|
|
116
|
+
'If you change your mind or cancelled by mistake, speak to one of our advisors on XXXX-XXX-XXXX.'
|
|
117
|
+
)
|
|
118
|
+
cy.get('a[href="/account/cancellation"]').should('not.exist')
|
|
119
|
+
})
|
|
120
|
+
it('Should show validation error messages when user tries to cancell subscription without selecting a cancellation reason', () => {
|
|
121
|
+
cy.contains('Select one option from the list below.')
|
|
122
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
123
|
+
cy.contains('Please, select one option')
|
|
124
|
+
})
|
|
125
|
+
it('Should select only one cancellation reason', () => {
|
|
126
|
+
cy.contains('Select one option from the list below.')
|
|
127
|
+
|
|
128
|
+
cy.contains(
|
|
129
|
+
'I only subscribed to read a specific article/redeem an offer'
|
|
130
|
+
).click()
|
|
131
|
+
|
|
132
|
+
cy.get(
|
|
133
|
+
'input[value="I only subscribed to read a specific article/redeem an offer"]'
|
|
134
|
+
).should('be.checked')
|
|
135
|
+
cy.get(
|
|
136
|
+
'input[value="I cannot justify paying for my current subscription"]'
|
|
137
|
+
).should('not.be.checked')
|
|
138
|
+
cy.get(
|
|
139
|
+
'input[value="I do not have enough time to read the edition everyday"]'
|
|
140
|
+
).should('not.be.checked')
|
|
141
|
+
cy.get(
|
|
142
|
+
'input[value="I prefer another news subscription service"]'
|
|
143
|
+
).should('not.be.checked')
|
|
144
|
+
cy.get('input[value="I do not enjoy the journalism"]').should(
|
|
145
|
+
'not.be.checked'
|
|
146
|
+
)
|
|
147
|
+
cy.get('input[value="I am travelling or moving abroad"]').should(
|
|
148
|
+
'not.be.checked'
|
|
149
|
+
)
|
|
150
|
+
cy.get('input[value="Other"]').should('not.be.checked')
|
|
151
|
+
cy.get('input[value="Prefer not to say"]').should('not.be.checked')
|
|
152
|
+
|
|
153
|
+
cy.contains('I prefer another news subscription service').click()
|
|
154
|
+
|
|
155
|
+
cy.get(
|
|
156
|
+
'input[value="I only subscribed to read a specific article/redeem an offer"]'
|
|
157
|
+
).should('not.be.checked')
|
|
158
|
+
cy.get(
|
|
159
|
+
'input[value="I cannot justify paying for my current subscription"]'
|
|
160
|
+
).should('not.be.checked')
|
|
161
|
+
cy.get(
|
|
162
|
+
'input[value="I do not have enough time to read the edition everyday"]'
|
|
163
|
+
).should('not.be.checked')
|
|
164
|
+
cy.get(
|
|
165
|
+
'input[value="I prefer another news subscription service"]'
|
|
166
|
+
).should('be.checked')
|
|
167
|
+
cy.get('input[value="I do not enjoy the journalism"]').should(
|
|
168
|
+
'not.be.checked'
|
|
169
|
+
)
|
|
170
|
+
cy.get('input[value="I am travelling or moving abroad"]').should(
|
|
171
|
+
'not.be.checked'
|
|
172
|
+
)
|
|
173
|
+
cy.get('input[value="Other"]').should('not.be.checked')
|
|
174
|
+
cy.get('input[value="Prefer not to say"]').should('not.be.checked')
|
|
175
|
+
})
|
|
176
|
+
it('Should show error toast when canceling subscription if internal server error occures', () => {
|
|
177
|
+
cy.intercept('POST', '/api/account/mutate', { statusCode: 500 })
|
|
178
|
+
|
|
179
|
+
cy.contains('Select one option from the list below.')
|
|
180
|
+
cy.contains('I am travelling or moving abroad').click()
|
|
181
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
182
|
+
|
|
183
|
+
cy.contains(
|
|
184
|
+
'You will lose unlimited access to exclusive content and benefits.'
|
|
185
|
+
)
|
|
186
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
187
|
+
|
|
188
|
+
cy.contains(
|
|
189
|
+
'[data-testid="toast-container"]',
|
|
190
|
+
"Sorry, we're unable to save your cancellation right now. Please try again or come back later."
|
|
191
|
+
)
|
|
192
|
+
})
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
it('Should show outstanding payment modal for user in payment failure', () => {
|
|
196
|
+
cy.GetTnlAcsSession('digitalCard')
|
|
197
|
+
cy.mockConsent()
|
|
198
|
+
cy.visitAndOverrideNextData(
|
|
199
|
+
'/account/subscription-and-billing',
|
|
200
|
+
'props.pageProps.user.paymentFailure',
|
|
201
|
+
paymentFailure
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
cy.get('a[href="/account/cancellation"]').should('be.visible').click()
|
|
205
|
+
|
|
206
|
+
cy.contains('You have outstanding payments')
|
|
207
|
+
cy.contains(
|
|
208
|
+
'If you wish to cancel your subscription update your payment details or speak to one of our advisors on XXXX-XXX-XXXX.'
|
|
209
|
+
)
|
|
210
|
+
cy.contains('Update payment details')
|
|
211
|
+
|
|
212
|
+
cy.get('[data-testid="centered-button"]').click()
|
|
213
|
+
|
|
214
|
+
cy.location().should((loc) => {
|
|
215
|
+
expect(loc.pathname).to.eq('/account/payment')
|
|
216
|
+
})
|
|
217
|
+
cy.contains('Edit your payment method')
|
|
218
|
+
})
|
|
219
|
+
})
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/* eslint-disable no-only-tests/no-only-tests */
|
|
2
|
+
|
|
3
|
+
describe('Newsletters and alerts without/with account', () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cy.GetTnlAcsSession('digitalCard')
|
|
6
|
+
cy.mockConsentAndVisit('/account/newsletters-and-alerts')
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
it('Should display page header and description', () => {
|
|
10
|
+
cy.contains('Newsletters & Alerts')
|
|
11
|
+
cy.contains(
|
|
12
|
+
'Manage your newsletters, notifications and all other contact preferences.'
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('Should display page data', () => {
|
|
17
|
+
cy.contains('Newsletters')
|
|
18
|
+
cy.contains(
|
|
19
|
+
'Get the stories you want to read, direct to your inbox. Choose from a range of daily or weekly newsletters on the subjects that matter to you.'
|
|
20
|
+
)
|
|
21
|
+
cy.get('a[aria-label="Newsletters"]')
|
|
22
|
+
.should('have.attr', 'href')
|
|
23
|
+
.and('match', /\/newsletters/)
|
|
24
|
+
|
|
25
|
+
cy.contains('Commenting notifications')
|
|
26
|
+
cy.contains(
|
|
27
|
+
'We’ll keep you informed on conversations you contribute to or follow, by sending you email notifications. Just let us know when you’d like to be notified.'
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
cy.contains('Contact preferences')
|
|
31
|
+
cy.contains(
|
|
32
|
+
"We'd like to keep in touch, but only if you want us to. Manage how we contact you about marketing, special offers and promotions from our partners."
|
|
33
|
+
)
|
|
34
|
+
cy.get('a[aria-label="Contact preferences"]').should(
|
|
35
|
+
'have.attr',
|
|
36
|
+
'href',
|
|
37
|
+
'#'
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('Newsletters and alerts edit pages', () => {
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
cy.GetTnlAcsSession('digitalCard')
|
|
45
|
+
cy.mockConsentAndVisit('/account/newsletters-and-alerts')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
describe('Edit commenting notifications', () => {
|
|
49
|
+
it('Should show user commenting notifications', () => {
|
|
50
|
+
cy.get('a[href="/account/edit/commenting-notifications"]')
|
|
51
|
+
.should('be.visible')
|
|
52
|
+
.click()
|
|
53
|
+
|
|
54
|
+
cy.contains('Edit your commenting notifications')
|
|
55
|
+
cy.contains(
|
|
56
|
+
'We’ll send you email notifications you to keep you informed on conversations you contribute to or follow.'
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
cy.contains('Choose when you’d like to receive notifications:')
|
|
60
|
+
|
|
61
|
+
cy.contains('label', 'When someone mentions me in a comment')
|
|
62
|
+
cy.get('input[name="userMentioned"]').should('not.have.value', 'checked')
|
|
63
|
+
cy.contains('label', 'When someone likes one of my comments')
|
|
64
|
+
cy.get('input[name="likedYourMessage"]').should(
|
|
65
|
+
'not.have.value',
|
|
66
|
+
'checked'
|
|
67
|
+
)
|
|
68
|
+
cy.contains('label', 'When someone replies to one of my comments')
|
|
69
|
+
cy.get('input[name="repliedToMessage"]').should(
|
|
70
|
+
'not.have.value',
|
|
71
|
+
'checked'
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
cy.contains('[data-testid="primary-button"]', 'Save')
|
|
75
|
+
cy.contains('[data-testid="secondary-button"]', 'Cancel')
|
|
76
|
+
|
|
77
|
+
// Redirects to Newsletters and Alerts page
|
|
78
|
+
cy.get('[data-testid="secondary-button"]').click()
|
|
79
|
+
cy.location().should((loc) => {
|
|
80
|
+
expect(loc.pathname).to.eq('/account/newsletters-and-alerts')
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('Should change user commenting notifications', () => {
|
|
85
|
+
cy.get('a[href="/account/edit/commenting-notifications"]')
|
|
86
|
+
.should('be.visible')
|
|
87
|
+
.click()
|
|
88
|
+
|
|
89
|
+
cy.contains('When someone mentions me in a comment').click()
|
|
90
|
+
cy.contains('When someone likes one of my comments').click()
|
|
91
|
+
cy.contains('When someone replies to one of my comments').click()
|
|
92
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
93
|
+
|
|
94
|
+
cy.contains(
|
|
95
|
+
'[data-testid="toast-container"]',
|
|
96
|
+
'Updating your preferences...'
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
// Redirects to Newsletters and Alerts page
|
|
100
|
+
cy.location().should((loc) => {
|
|
101
|
+
expect(loc.pathname).to.eq('/account/newsletters-and-alerts')
|
|
102
|
+
})
|
|
103
|
+
cy.contains(
|
|
104
|
+
'[data-testid="toast-container"]',
|
|
105
|
+
'Your commenting notifications has been updated'
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
cy.visit('/account/edit/commenting-notifications')
|
|
109
|
+
cy.get('[data-testid="userMentioned"]').should('be.checked')
|
|
110
|
+
cy.get('[data-testid="likedYourMessage"]').should('be.checked')
|
|
111
|
+
cy.get('[data-testid="repliedToMessage"]').should('be.checked')
|
|
112
|
+
cy.contains('When someone mentions me in a comment').click()
|
|
113
|
+
cy.contains('When someone likes one of my comments').click()
|
|
114
|
+
cy.contains('When someone replies to one of my comments').click()
|
|
115
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
116
|
+
|
|
117
|
+
cy.contains(
|
|
118
|
+
'[data-testid="toast-container"]',
|
|
119
|
+
'Updating your preferences...'
|
|
120
|
+
)
|
|
121
|
+
cy.contains(
|
|
122
|
+
'[data-testid="toast-container"]',
|
|
123
|
+
'Your commenting notifications has been updated'
|
|
124
|
+
)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('Should show error toast when updating commenting notifications if internal server error occures', () => {
|
|
128
|
+
cy.intercept('POST', '/api/account/mutate', { statusCode: 500 })
|
|
129
|
+
|
|
130
|
+
cy.get('a[href="/account/edit/commenting-notifications"]')
|
|
131
|
+
.should('be.visible')
|
|
132
|
+
.click()
|
|
133
|
+
|
|
134
|
+
cy.get('[data-testid="userMentioned"]').check()
|
|
135
|
+
cy.get('[data-testid="likedYourMessage"]').check()
|
|
136
|
+
cy.get('[data-testid="repliedToMessage"]').check()
|
|
137
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
138
|
+
|
|
139
|
+
cy.contains(
|
|
140
|
+
'[data-testid="toast-container"]',
|
|
141
|
+
'Updating your preferences...'
|
|
142
|
+
)
|
|
143
|
+
cy.contains(
|
|
144
|
+
'[data-testid="toast-container"]',
|
|
145
|
+
"Sorry, we're unable to save your commenting notifications right now. Please try again or come back later."
|
|
146
|
+
)
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
})
|
|
@@ -3,6 +3,13 @@ describe('Personal details without user', () => {
|
|
|
3
3
|
cy.mockConsentAndVisit('/account')
|
|
4
4
|
})
|
|
5
5
|
|
|
6
|
+
it('Should display page header and description', () => {
|
|
7
|
+
cy.contains('Personal Details')
|
|
8
|
+
cy.contains(
|
|
9
|
+
'Your basic account info, including your name, contact details and log-in credentials.'
|
|
10
|
+
)
|
|
11
|
+
})
|
|
12
|
+
|
|
6
13
|
it('Should display default fallback values', () => {
|
|
7
14
|
cy.contains('[data-testid="ContentListIntroduction"]', 'Profile')
|
|
8
15
|
// cy.get('[data-testid="ContentListItems"]').should('have.length', 3)
|
|
@@ -43,6 +50,13 @@ describe('Personal details with account', () => {
|
|
|
43
50
|
cy.mockConsentAndVisit('/account')
|
|
44
51
|
})
|
|
45
52
|
|
|
53
|
+
it('Should display page header and description', () => {
|
|
54
|
+
cy.contains('Personal Details')
|
|
55
|
+
cy.contains(
|
|
56
|
+
'Your basic account info, including your name, contact details and log-in credentials.'
|
|
57
|
+
)
|
|
58
|
+
})
|
|
59
|
+
|
|
46
60
|
it('Should display logged-in user data', () => {
|
|
47
61
|
cy.contains('[data-testid="ContentListIntroduction"]', 'Profile')
|
|
48
62
|
cy.contains('Name')
|