@newskit-render/core 4.20.4 → 4.20.5-alpha.1
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.
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
_sp_user_consent_7377,
|
|
7
7
|
_sp_non_keyed_local_state,
|
|
8
8
|
} from './consentValues'
|
|
9
|
+
import { userMap } from './users'
|
|
9
10
|
|
|
10
11
|
const setConentLocalStorage = () => {
|
|
11
12
|
localStorage.setItem('_sp_local_state', JSON.stringify(_sp_local_state))
|
|
@@ -30,53 +31,6 @@ Cypress.Commands.add('mockConsent', () => {
|
|
|
30
31
|
setConentLocalStorage()
|
|
31
32
|
})
|
|
32
33
|
|
|
33
|
-
const userMap = {
|
|
34
|
-
default: {
|
|
35
|
-
username: 'render.e2e.default@yopmail.com',
|
|
36
|
-
password: 'Ad45p0-swq151@',
|
|
37
|
-
},
|
|
38
|
-
noSub: {
|
|
39
|
-
username: 'render.e2e.no-sub@yopmail.com',
|
|
40
|
-
password: 'Ad45p0-swq151@',
|
|
41
|
-
},
|
|
42
|
-
expiredSub: {
|
|
43
|
-
username: 'tim.newsuk3@yopmail.com',
|
|
44
|
-
password: 'Ad45p0-swq151@',
|
|
45
|
-
},
|
|
46
|
-
withSub: {
|
|
47
|
-
username: 'render-e2e-subscription@yopmail.com',
|
|
48
|
-
password: 'Testing123$',
|
|
49
|
-
},
|
|
50
|
-
paypalSub: {
|
|
51
|
-
username: 'render-paypal-payment@yopmail.com',
|
|
52
|
-
password: 'testing123',
|
|
53
|
-
},
|
|
54
|
-
tnl: {
|
|
55
|
-
username: 'cmp1aug2022printstag@yopmail.com',
|
|
56
|
-
password: 'Password123',
|
|
57
|
-
},
|
|
58
|
-
print: {
|
|
59
|
-
//dtc=true
|
|
60
|
-
username: 'cmp-dtc-card-20-09-22@yopmail.com',
|
|
61
|
-
password: 'Password123',
|
|
62
|
-
},
|
|
63
|
-
printVouchers: {
|
|
64
|
-
//dtc=false
|
|
65
|
-
username: 'cmp-test-direct-20-09-22@yopmail.com',
|
|
66
|
-
password: 'Password123',
|
|
67
|
-
},
|
|
68
|
-
digiprint: {
|
|
69
|
-
//dtc=true
|
|
70
|
-
username: 'digi-print.dtc.test@yopmail.com',
|
|
71
|
-
password: 'Password123',
|
|
72
|
-
},
|
|
73
|
-
digiprintVouchers: {
|
|
74
|
-
//dtc=false
|
|
75
|
-
username: 'digi-print-card-15-11-22@yopmail.com',
|
|
76
|
-
password: 'Password123',
|
|
77
|
-
},
|
|
78
|
-
}
|
|
79
|
-
|
|
80
34
|
Cypress.Commands.add('GetAcsSession', (user = 'default') => {
|
|
81
35
|
const { username, password } = userMap[user]
|
|
82
36
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const userMap = {
|
|
2
|
+
default: {
|
|
3
|
+
username: 'render.e2e.default@yopmail.com',
|
|
4
|
+
password: 'Ad45p0-swq151@',
|
|
5
|
+
},
|
|
6
|
+
noSub: {
|
|
7
|
+
username: 'render.e2e.no-sub@yopmail.com',
|
|
8
|
+
password: 'Ad45p0-swq151@',
|
|
9
|
+
},
|
|
10
|
+
expiredSub: {
|
|
11
|
+
username: 'tim.newsuk3@yopmail.com',
|
|
12
|
+
password: 'Ad45p0-swq151@',
|
|
13
|
+
},
|
|
14
|
+
withSub: {
|
|
15
|
+
username: 'render-e2e-subscription@yopmail.com',
|
|
16
|
+
password: 'Testing123$',
|
|
17
|
+
},
|
|
18
|
+
paypalSub: {
|
|
19
|
+
username: 'render-paypal-payment@yopmail.com',
|
|
20
|
+
password: 'testing123',
|
|
21
|
+
},
|
|
22
|
+
tnl: {
|
|
23
|
+
username: 'cmp1aug2022printstag@yopmail.com',
|
|
24
|
+
password: 'Password123',
|
|
25
|
+
},
|
|
26
|
+
digital: {
|
|
27
|
+
//dtc=false
|
|
28
|
+
username: 'cmp-digi-card-20-09-22@yopmail.com',
|
|
29
|
+
password: 'Password123',
|
|
30
|
+
},
|
|
31
|
+
print: {
|
|
32
|
+
//dtc=true
|
|
33
|
+
username: 'cmp-dtc-card-20-09-22@yopmail.com',
|
|
34
|
+
password: 'Password123',
|
|
35
|
+
},
|
|
36
|
+
printVouchers: {
|
|
37
|
+
//dtc=false
|
|
38
|
+
username: 'cmp-test-direct-20-09-22@yopmail.com',
|
|
39
|
+
password: 'Password123',
|
|
40
|
+
},
|
|
41
|
+
digiprint: {
|
|
42
|
+
//dtc=true
|
|
43
|
+
username: 'digi-print.dtc.test@yopmail.com',
|
|
44
|
+
password: 'Password123',
|
|
45
|
+
},
|
|
46
|
+
digiprintVouchers: {
|
|
47
|
+
//dtc=false
|
|
48
|
+
username: 'digi-print-card-15-11-22@yopmail.com',
|
|
49
|
+
password: 'Password123',
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.5-alpha.1",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@newskit-render/checkout": "^3.9.1",
|
|
48
48
|
"@newskit-render/feature-flags": "^1.7.0",
|
|
49
49
|
"@newskit-render/feed": "^1.8.4",
|
|
50
|
-
"@newskit-render/my-account": "^7.20.
|
|
50
|
+
"@newskit-render/my-account": "^7.20.3-alpha.0",
|
|
51
51
|
"@newskit-render/shared-components": "^4.10.1",
|
|
52
52
|
"@newskit-render/standalone-components": "^3.19.1",
|
|
53
53
|
"@newskit-render/validation": "^1.13.0",
|
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
describe('Account without user', () => {
|
|
2
|
-
beforeEach(() => {
|
|
3
|
-
cy.mockConsentAndVisit('/account')
|
|
4
|
-
})
|
|
5
|
-
|
|
6
|
-
it('Should Display default fallback values', () => {
|
|
7
|
-
cy.get('[data-testid="ContentListIntroduction"]').should('have.length', 3)
|
|
8
|
-
cy.get('[data-testid="ContentListItems"]').should('have.length', 3)
|
|
9
|
-
cy.contains('Please enter your name')
|
|
10
|
-
cy.contains('Please call customer service on xxxx-xxx-xxxx')
|
|
11
|
-
cy.contains('Please enter your display name')
|
|
12
|
-
cy.contains(
|
|
13
|
-
'Your display name is used across our websites or apps when leaving comments on articles'
|
|
14
|
-
)
|
|
15
|
-
cy.contains('[email@address]')
|
|
16
|
-
cy.contains('******************')
|
|
17
|
-
cy.contains('Please enter your mobile telephone number')
|
|
18
|
-
cy.contains('Please enter your landline telephone number')
|
|
19
|
-
cy.contains('Please enter your address')
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
describe('My account personal details', () => {
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
cy.GetAcsSession()
|
|
26
|
-
cy.mockConsentAndVisit('/account')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('Should Display Personal details page', () => {
|
|
30
|
-
cy.get('[data-testid="ContentListIntroduction"]').should('have.length', 3)
|
|
31
|
-
cy.get('[data-testid="ContentListItems"]').should('have.length', 3)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('Should go to edit page and change first name', () => {
|
|
35
|
-
cy.get('a[href="/account/edit/name"]')
|
|
36
|
-
.should('be.visible')
|
|
37
|
-
.click({ force: true })
|
|
38
|
-
cy.get('[name="firstName"]').clear().type('John')
|
|
39
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
40
|
-
cy.contains('[data-testid="toast-container"]', 'Updating your name...')
|
|
41
|
-
|
|
42
|
-
// Redirects to Personal details page
|
|
43
|
-
cy.contains('John').should('have.length', 1)
|
|
44
|
-
cy.contains('[data-testid="toast-container"]', 'Your name has been updated')
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('Should show error toast when updating name', () => {
|
|
48
|
-
cy.intercept('POST', '/api/account/mutate', { statusCode: 500 })
|
|
49
|
-
cy.get('a[href="/account/edit/name"]')
|
|
50
|
-
.should('be.visible')
|
|
51
|
-
.click({ force: true })
|
|
52
|
-
cy.get('[name="firstName"]').clear().type('John')
|
|
53
|
-
cy.get('[name="lastName"]').clear().type('Cena')
|
|
54
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
55
|
-
cy.contains('[data-testid="toast-container"]', 'Updating your name...')
|
|
56
|
-
|
|
57
|
-
cy.contains(
|
|
58
|
-
'[data-testid="toast-container"]',
|
|
59
|
-
"Sorry, we're unable to save your name right now. Please try again or come back later."
|
|
60
|
-
)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('Should go to edit page and change last name', () => {
|
|
64
|
-
cy.get('a[href="/account/edit/name"]')
|
|
65
|
-
.should('be.visible')
|
|
66
|
-
.click({ force: true })
|
|
67
|
-
cy.get('[name="lastName"]').clear().type('Smith')
|
|
68
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
69
|
-
cy.contains('[data-testid="toast-container"]', 'Updating your name...')
|
|
70
|
-
|
|
71
|
-
// Redirects to Personal details page
|
|
72
|
-
cy.contains('Smith').should('have.length', 1)
|
|
73
|
-
cy.contains('[data-testid="toast-container"]', 'Your name has been updated')
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('Should go to the edit Name page, add invalid value and expect error labels', () => {
|
|
77
|
-
cy.get('a[href="/account/edit/name"]')
|
|
78
|
-
.should('be.visible')
|
|
79
|
-
.click({ force: true })
|
|
80
|
-
cy.get('[name="firstName"]').clear().type('?')
|
|
81
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
82
|
-
|
|
83
|
-
cy.contains(
|
|
84
|
-
'Your first name can’t contain special characters. Please try again.'
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
cy.get('[name="firstName"]').clear()
|
|
88
|
-
cy.get('[name="lastName"]').clear().type('Henry 8')
|
|
89
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
90
|
-
|
|
91
|
-
cy.contains(
|
|
92
|
-
'That doesn’t look right. Please check your First Name and try again.'
|
|
93
|
-
).should('not.exist')
|
|
94
|
-
|
|
95
|
-
cy.contains('Please enter your First Name')
|
|
96
|
-
|
|
97
|
-
cy.contains(
|
|
98
|
-
'Your last name can’t contain special characters. Please try again.'
|
|
99
|
-
)
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
// TODO: Uncomment and change the dob when we have a test account with date of birth. Current one fails because it's set to null
|
|
103
|
-
// it('Should Display date of birth', () => {
|
|
104
|
-
// cy.contains('21/03/1988')
|
|
105
|
-
// })
|
|
106
|
-
|
|
107
|
-
// it('Should go to edit page and change email', () => {
|
|
108
|
-
// const currentEmail = 'render.e2e.default@yopmail.com'
|
|
109
|
-
// const newEmail = 'render.e2e.default2@yopmail.com'
|
|
110
|
-
|
|
111
|
-
// cy.get('a[href="/account/edit/email"]')
|
|
112
|
-
// .should('be.visible')
|
|
113
|
-
// .click({ force: true })
|
|
114
|
-
|
|
115
|
-
// cy.contains(currentEmail)
|
|
116
|
-
// cy.get('[name="email"]').clear().type(newEmail)
|
|
117
|
-
|
|
118
|
-
// cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
119
|
-
// cy.contains(
|
|
120
|
-
// '[data-testid="toast-container"]',
|
|
121
|
-
// 'Your email address was successfully updated'
|
|
122
|
-
// )
|
|
123
|
-
|
|
124
|
-
// // Redirects to Personal details page
|
|
125
|
-
// cy.contains(newEmail).should('have.length', 1)
|
|
126
|
-
// cy.get('a[href="/account/edit/email"]')
|
|
127
|
-
// .should('be.visible')
|
|
128
|
-
// .click({ force: true })
|
|
129
|
-
|
|
130
|
-
// // Check the message for verification link
|
|
131
|
-
// cy.contains(
|
|
132
|
-
// `Email sent to ${newEmail} with a verification link. If you haven't received it yet, check again later or contact customer services on xxxx-xxx-xxxx`
|
|
133
|
-
// )
|
|
134
|
-
|
|
135
|
-
// // Change email back to the previous email
|
|
136
|
-
// cy.get('[name="email"]').clear().type(currentEmail)
|
|
137
|
-
// cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
138
|
-
// })
|
|
139
|
-
|
|
140
|
-
it('Should go to edit page and change password', () => {
|
|
141
|
-
cy.get('a[href="/account/edit/password"]')
|
|
142
|
-
.should('be.visible')
|
|
143
|
-
.click({ force: true })
|
|
144
|
-
|
|
145
|
-
cy.get('[data-testid="primary-button"]').should('have.text', 'Send link')
|
|
146
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
147
|
-
|
|
148
|
-
cy.get('[data-testid="primary-button"]').should('not.exist')
|
|
149
|
-
cy.get('a[href="/account/edit/password"]')
|
|
150
|
-
.should('be.visible')
|
|
151
|
-
.click({ force: true })
|
|
152
|
-
cy.get('[data-testid="inline-message"]')
|
|
153
|
-
.children()
|
|
154
|
-
.should(
|
|
155
|
-
'contain',
|
|
156
|
-
'Email sent to render.e2e.default@yopmail.com with a password reset link. If you haven’t received it in a couple of minutes, you may request a new link by clicking on the button below.'
|
|
157
|
-
)
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
it('Should show success toast when resetting password', () => {
|
|
161
|
-
cy.get('a[href="/account/edit/password"]')
|
|
162
|
-
.should('be.visible')
|
|
163
|
-
.click({ force: true })
|
|
164
|
-
|
|
165
|
-
cy.get('[data-testid="primary-button"]').should('have.text', 'Send link')
|
|
166
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
167
|
-
cy.contains(
|
|
168
|
-
'[data-testid="toast-container"]',
|
|
169
|
-
'Email sent with a password reset link'
|
|
170
|
-
)
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
it('Should go to edit page and change landline', () => {
|
|
174
|
-
cy.get('a[href="/account/edit/landline"]')
|
|
175
|
-
.should('be.visible')
|
|
176
|
-
.click({ force: true })
|
|
177
|
-
cy.get('[data-testid="primary-button"]').should('have.text', 'Save')
|
|
178
|
-
cy.get('.PhoneInputCountrySelect').select('IE')
|
|
179
|
-
cy.get('.PhoneInputCountryIconImg').should('have.attr', 'alt', 'Ireland')
|
|
180
|
-
cy.get('.PhoneInputInput').clear()
|
|
181
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
182
|
-
cy.contains('Please enter your landline telephone number')
|
|
183
|
-
|
|
184
|
-
cy.get('.PhoneInputInput').click().type('07777 777778')
|
|
185
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
186
|
-
cy.contains(
|
|
187
|
-
'That doesn’t look like a valid phone number. Please try again.'
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
cy.get('.PhoneInputCountrySelect').select('GB')
|
|
191
|
-
cy.get('.PhoneInputCountryIconImg').should(
|
|
192
|
-
'have.attr',
|
|
193
|
-
'alt',
|
|
194
|
-
'United Kingdom'
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
198
|
-
cy.contains(
|
|
199
|
-
'[data-testid="toast-container"]',
|
|
200
|
-
'Your landline telephone number has been updated.'
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
cy.contains('07777 777778')
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
it('Should throw error when editing landline', () => {
|
|
207
|
-
cy.intercept('POST', '/api/account/mutate', { statusCode: 500 })
|
|
208
|
-
cy.get('a[href="/account/edit/landline"]')
|
|
209
|
-
.should('be.visible')
|
|
210
|
-
.click({ force: true })
|
|
211
|
-
cy.get('[data-testid="primary-button"]').should('have.text', 'Save')
|
|
212
|
-
|
|
213
|
-
cy.get('.PhoneInputCountrySelect').select('GB')
|
|
214
|
-
cy.get('.PhoneInputCountryIconImg').should(
|
|
215
|
-
'have.attr',
|
|
216
|
-
'alt',
|
|
217
|
-
'United Kingdom'
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
221
|
-
cy.contains(
|
|
222
|
-
'[data-testid="toast-container"]',
|
|
223
|
-
"Sorry, we're unable to save your landline telephone number right now. Please try again or come back later."
|
|
224
|
-
)
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
it('Should go to edit page and change address', () => {
|
|
228
|
-
cy.get('a[href="/account/edit/address"]')
|
|
229
|
-
.should('be.visible')
|
|
230
|
-
.click({ force: true })
|
|
231
|
-
|
|
232
|
-
cy.get('input[name="line1"]').clear().type('News UK')
|
|
233
|
-
cy.get('input[name="line2"]').clear().type('1 London Bridge Street')
|
|
234
|
-
cy.get('input[name="line3"]').clear().type('Buckie;')
|
|
235
|
-
cy.get('input[name="city"]').clear().type('London')
|
|
236
|
-
cy.get('input[name="county"]').clear().type('Kent')
|
|
237
|
-
cy.get('input[name="postcode"]').clear().type('SE1 9GF')
|
|
238
|
-
cy.get('[data-testid="select-chevron-button"]').click({ force: true })
|
|
239
|
-
cy.get('[data-testid="United States of America"]').click({
|
|
240
|
-
multiple: true,
|
|
241
|
-
force: true,
|
|
242
|
-
})
|
|
243
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
244
|
-
cy.contains(
|
|
245
|
-
'Your address can’t contain special characters. Please try again.'
|
|
246
|
-
)
|
|
247
|
-
cy.get('input[name="line3"]').type('{backspace} 2')
|
|
248
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
249
|
-
cy.contains('[data-testid="toast-container"]', 'Updating your address...')
|
|
250
|
-
cy.get('a[href="/account/edit/address"]')
|
|
251
|
-
.children()
|
|
252
|
-
.should('contain', 'News UK')
|
|
253
|
-
.and('contain', '1 London Bridge Street')
|
|
254
|
-
.and('contain', 'Buckie 2')
|
|
255
|
-
.and('contain', 'London')
|
|
256
|
-
.and('contain', 'Kent')
|
|
257
|
-
.and('contain', 'SE1 9GF')
|
|
258
|
-
cy.contains(
|
|
259
|
-
'[data-testid="toast-container"]',
|
|
260
|
-
'Your address was successfully updated'
|
|
261
|
-
)
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
it('Should throw error when editing address', () => {
|
|
265
|
-
cy.intercept('POST', '/api/account/mutate', { statusCode: 500 })
|
|
266
|
-
cy.get('a[href="/account/edit/address"]')
|
|
267
|
-
.should('be.visible')
|
|
268
|
-
.click({ force: true })
|
|
269
|
-
|
|
270
|
-
cy.get('input[name="line1"]').clear().type('News UK')
|
|
271
|
-
cy.get('input[name="line2"]').clear().type('1 London Bridge Street')
|
|
272
|
-
cy.get('input[name="line3"]').clear().type('Buckie')
|
|
273
|
-
cy.get('input[name="city"]').clear().type('London')
|
|
274
|
-
cy.get('input[name="county"]').clear().type('Kent')
|
|
275
|
-
cy.get('input[name="postcode"]').clear().type('SE1 9GF')
|
|
276
|
-
cy.get('[data-testid="select-chevron-button"]').click({ force: true })
|
|
277
|
-
cy.get('[data-testid="United States of America"]').click({
|
|
278
|
-
multiple: true,
|
|
279
|
-
force: true,
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
283
|
-
cy.contains('[data-testid="toast-container"]', 'Updating your address...')
|
|
284
|
-
cy.contains(
|
|
285
|
-
'[data-testid="toast-container"]',
|
|
286
|
-
"Sorry, we're unable to save your address right now. Please try again or come back later."
|
|
287
|
-
)
|
|
288
|
-
})
|
|
289
|
-
})
|
|
290
|
-
|
|
291
|
-
describe('My account personal details - Display name', () => {
|
|
292
|
-
beforeEach(() => {
|
|
293
|
-
cy.GetTnlAcsSession('tnl')
|
|
294
|
-
cy.mockConsentAndVisit('/account')
|
|
295
|
-
})
|
|
296
|
-
|
|
297
|
-
it('Should go to edit page and change display name ', () => {
|
|
298
|
-
cy.get('a[href="/account/edit/displayName"]')
|
|
299
|
-
.should('be.visible')
|
|
300
|
-
.click({ force: true })
|
|
301
|
-
cy.get('[name="displayName"]').clear().type('NKDN')
|
|
302
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
303
|
-
cy.contains(
|
|
304
|
-
'[data-testid="toast-container"]',
|
|
305
|
-
'Updating your display name...'
|
|
306
|
-
)
|
|
307
|
-
// Redirects to Personal details page
|
|
308
|
-
cy.contains(
|
|
309
|
-
'[data-testid="toast-container"]',
|
|
310
|
-
'Your display name has been updated.'
|
|
311
|
-
)
|
|
312
|
-
})
|
|
313
|
-
|
|
314
|
-
it('Should show error toast when updating display name', () => {
|
|
315
|
-
cy.intercept('POST', '/api/account/mutate', { statusCode: 500 })
|
|
316
|
-
cy.get('a[href="/account/edit/displayName"]')
|
|
317
|
-
.should('be.visible')
|
|
318
|
-
.click({ force: true })
|
|
319
|
-
cy.get('[name="displayName"]').clear().type('Rock')
|
|
320
|
-
cy.get('[data-testid="primary-button"]')
|
|
321
|
-
.scrollIntoView()
|
|
322
|
-
.click({ force: true })
|
|
323
|
-
cy.contains(
|
|
324
|
-
'[data-testid="toast-container"]',
|
|
325
|
-
'Updating your display name...'
|
|
326
|
-
)
|
|
327
|
-
cy.contains(
|
|
328
|
-
'[data-testid="toast-container"]',
|
|
329
|
-
"Sorry, we're unable to save your display name right now. Please try again or come back later."
|
|
330
|
-
)
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
it('Should show error message when display name is empty', () => {
|
|
334
|
-
cy.get('a[href="/account/edit/displayName"]')
|
|
335
|
-
.should('be.visible')
|
|
336
|
-
.click({ force: true })
|
|
337
|
-
cy.get('[name="displayName"]').clear()
|
|
338
|
-
cy.get('[data-testid="primary-button"]').scrollIntoView().click()
|
|
339
|
-
cy.contains('Please enter your Display Name')
|
|
340
|
-
})
|
|
341
|
-
|
|
342
|
-
it('Should go back to Personal Details on clicking cancel button', () => {
|
|
343
|
-
cy.get('a[href="/account/edit/displayName"]')
|
|
344
|
-
.should('be.visible')
|
|
345
|
-
.click({ force: true })
|
|
346
|
-
cy.get('[data-testid="secondary-button"]')
|
|
347
|
-
.should('be.visible')
|
|
348
|
-
.click({ force: true })
|
|
349
|
-
cy.location().should((loc) => {
|
|
350
|
-
expect(loc.pathname).to.eq('/account')
|
|
351
|
-
})
|
|
352
|
-
})
|
|
353
|
-
})
|
|
354
|
-
|
|
355
|
-
describe('My account personal details - Edit address - Outside delivery area modal', () => {
|
|
356
|
-
//print
|
|
357
|
-
it('Should show modal when postcode is outside delivery area and user has print subscription', () => {
|
|
358
|
-
cy.GetTnlAcsSession('print')
|
|
359
|
-
cy.mockConsentAndVisit('/account')
|
|
360
|
-
|
|
361
|
-
cy.get('a[href="/account/edit/address"]').click({ force: true })
|
|
362
|
-
|
|
363
|
-
cy.get('input[name="line1"]').clear().type('Buckingham Palace')
|
|
364
|
-
cy.get('input[name="city"]').clear().type('London')
|
|
365
|
-
cy.get('input[name="postcode"]').clear().type('SW1A')
|
|
366
|
-
|
|
367
|
-
cy.contains('Save').click()
|
|
368
|
-
|
|
369
|
-
cy.get('[data-testid="modal"]')
|
|
370
|
-
.should('exist')
|
|
371
|
-
.should('have.length.of.at.most', 1)
|
|
372
|
-
cy.contains(
|
|
373
|
-
'[data-testid="introduction-title"]',
|
|
374
|
-
'Address Outside Delivery Area'
|
|
375
|
-
).should('exist')
|
|
376
|
-
cy.contains(
|
|
377
|
-
'[data-testid="description-block"]',
|
|
378
|
-
'Unfortunately the address you entered is outside of our delivery area so cannot be updated online.'
|
|
379
|
-
).should('exist')
|
|
380
|
-
cy.contains('[data-testid="primary-button"]', 'Return to My Account')
|
|
381
|
-
.should('exist')
|
|
382
|
-
.click({ multiple: true })
|
|
383
|
-
cy.contains(
|
|
384
|
-
'[data-testid="toast-container"]',
|
|
385
|
-
'As your new address is outside of our delivery area it has not been updated.'
|
|
386
|
-
)
|
|
387
|
-
cy.url().should('eq', 'http://localhost:3000/account')
|
|
388
|
-
})
|
|
389
|
-
|
|
390
|
-
//digiprint
|
|
391
|
-
it('Should show modal when postcode is outside delivery area and user has digi-print subscription', () => {
|
|
392
|
-
cy.GetTnlAcsSession('digiprint')
|
|
393
|
-
cy.mockConsentAndVisit('/account')
|
|
394
|
-
|
|
395
|
-
cy.get('a[href="/account/edit/address"]').click({ force: true })
|
|
396
|
-
|
|
397
|
-
cy.get('input[name="line1"]').clear().type('1 London Bridge Street')
|
|
398
|
-
cy.get('input[name="city"]').clear().type('London')
|
|
399
|
-
cy.get('input[name="postcode"]').clear().type('SE1')
|
|
400
|
-
|
|
401
|
-
cy.contains('Save').click()
|
|
402
|
-
|
|
403
|
-
cy.get('[data-testid="modal"]')
|
|
404
|
-
.should('exist')
|
|
405
|
-
.should('have.length.of.at.most', 1)
|
|
406
|
-
cy.contains(
|
|
407
|
-
'[data-testid="introduction-title"]',
|
|
408
|
-
'Address Outside Delivery Area'
|
|
409
|
-
).should('exist')
|
|
410
|
-
cy.contains(
|
|
411
|
-
'[data-testid="description-block"]',
|
|
412
|
-
'Unfortunately the address you entered is outside of our delivery area so cannot be updated online.'
|
|
413
|
-
).should('exist')
|
|
414
|
-
cy.contains('[data-testid="primary-button"]', 'Return to My Account')
|
|
415
|
-
.should('exist')
|
|
416
|
-
.click({ multiple: true })
|
|
417
|
-
cy.contains(
|
|
418
|
-
'[data-testid="toast-container"]',
|
|
419
|
-
'As your new address is outside of our delivery area it has not been updated.'
|
|
420
|
-
)
|
|
421
|
-
cy.url().should('eq', 'http://localhost:3000/account')
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
//printVouchers
|
|
425
|
-
it('Should not show modal when postcode is outside delivery area and user has print with vouchers subscription', () => {
|
|
426
|
-
cy.GetTnlAcsSession('printVouchers')
|
|
427
|
-
cy.mockConsentAndVisit('/account')
|
|
428
|
-
|
|
429
|
-
cy.get('a[href="/account/edit/address"]').click({ force: true })
|
|
430
|
-
|
|
431
|
-
cy.get('input[name="line1"]').clear().type('2 Tuke House')
|
|
432
|
-
cy.get('input[name="line2"]').clear().type('Cromwell Road')
|
|
433
|
-
cy.get('input[name="city"]').clear().type('York')
|
|
434
|
-
cy.get('input[name="county"]').clear().type('North Yorkshire')
|
|
435
|
-
cy.get('input[name="postcode"]').clear().type('YO1 6DJ')
|
|
436
|
-
|
|
437
|
-
cy.contains('Save').click()
|
|
438
|
-
|
|
439
|
-
cy.get('[data-testid="modal"]').should('not.exist')
|
|
440
|
-
cy.contains(
|
|
441
|
-
'[data-testid="introduction-title"]',
|
|
442
|
-
'Address Outside Delivery Area'
|
|
443
|
-
).should('not.exist')
|
|
444
|
-
cy.contains(
|
|
445
|
-
'[data-testid="description-block"]',
|
|
446
|
-
'Unfortunately the address you entered is outside of our delivery area so cannot be updated online.'
|
|
447
|
-
).should('not.exist')
|
|
448
|
-
cy.contains(
|
|
449
|
-
'[data-testid="primary-button"]',
|
|
450
|
-
'Return to My Account'
|
|
451
|
-
).should('not.exist')
|
|
452
|
-
cy.contains(
|
|
453
|
-
'[data-testid="toast-container"]',
|
|
454
|
-
'Your address was successfully updated'
|
|
455
|
-
)
|
|
456
|
-
cy.url().should('eq', 'http://localhost:3000/account')
|
|
457
|
-
})
|
|
458
|
-
|
|
459
|
-
//digiprintVouchers
|
|
460
|
-
it('Should not show modal when postcode is outside delivery area and user has digi-print with vouchers subscription', () => {
|
|
461
|
-
cy.GetTnlAcsSession('digiprintVouchers')
|
|
462
|
-
cy.mockConsentAndVisit('/account')
|
|
463
|
-
|
|
464
|
-
cy.get('a[href="/account/edit/address"]').click({ force: true })
|
|
465
|
-
|
|
466
|
-
cy.get('input[name="line1"]').clear().type('Harpercollins Publishers')
|
|
467
|
-
cy.get('input[name="line2"]').clear().type('1 London Bridge Street')
|
|
468
|
-
cy.get('input[name="city"]').clear().type('London')
|
|
469
|
-
cy.get('input[name="postcode"]').clear().type('SE1')
|
|
470
|
-
|
|
471
|
-
cy.contains('Save').click()
|
|
472
|
-
|
|
473
|
-
cy.get('[data-testid="modal"]').should('not.exist')
|
|
474
|
-
cy.contains(
|
|
475
|
-
'[data-testid="introduction-title"]',
|
|
476
|
-
'Address Outside Delivery Area'
|
|
477
|
-
).should('not.exist')
|
|
478
|
-
cy.contains(
|
|
479
|
-
'[data-testid="description-block"]',
|
|
480
|
-
'Unfortunately the address you entered is outside of our delivery area so cannot be updated online.'
|
|
481
|
-
).should('not.exist')
|
|
482
|
-
cy.contains(
|
|
483
|
-
'[data-testid="primary-button"]',
|
|
484
|
-
'Return to My Account'
|
|
485
|
-
).should('not.exist')
|
|
486
|
-
cy.contains(
|
|
487
|
-
'[data-testid="toast-container"]',
|
|
488
|
-
'Your address was successfully updated'
|
|
489
|
-
)
|
|
490
|
-
cy.url().should('eq', 'http://localhost:3000/account')
|
|
491
|
-
})
|
|
492
|
-
|
|
493
|
-
//digital
|
|
494
|
-
it('Should not show modal when postcode is outside delivery area and user has digital subscription', () => {
|
|
495
|
-
cy.GetTnlAcsSession('tnl')
|
|
496
|
-
cy.mockConsentAndVisit('/account')
|
|
497
|
-
|
|
498
|
-
cy.get('a[href="/account/edit/address"]').click({ force: true })
|
|
499
|
-
|
|
500
|
-
cy.get('input[name="line1"]').clear().type('News UK')
|
|
501
|
-
cy.get('input[name="line2"]').clear().type('1 London Bridge Street')
|
|
502
|
-
cy.get('input[name="city"]').clear().type('London')
|
|
503
|
-
cy.get('input[name="postcode"]').clear().type('SE1')
|
|
504
|
-
|
|
505
|
-
cy.contains('Save').click()
|
|
506
|
-
|
|
507
|
-
cy.get('[data-testid="modal"]').should('not.exist')
|
|
508
|
-
cy.contains(
|
|
509
|
-
'[data-testid="introduction-title"]',
|
|
510
|
-
'Address Outside Delivery Area'
|
|
511
|
-
).should('not.exist')
|
|
512
|
-
cy.contains(
|
|
513
|
-
'[data-testid="description-block"]',
|
|
514
|
-
'Unfortunately the address you entered is outside of our delivery area so cannot be updated online.'
|
|
515
|
-
).should('not.exist')
|
|
516
|
-
cy.contains(
|
|
517
|
-
'[data-testid="primary-button"]',
|
|
518
|
-
'Return to My Account'
|
|
519
|
-
).should('not.exist')
|
|
520
|
-
cy.contains(
|
|
521
|
-
'[data-testid="toast-container"]',
|
|
522
|
-
'Your address was successfully updated'
|
|
523
|
-
)
|
|
524
|
-
cy.url().should('eq', 'http://localhost:3000/account')
|
|
525
|
-
})
|
|
526
|
-
})
|