@newskit-render/core 4.22.1 → 4.22.2-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.
- package/CHANGELOG.md +8 -0
- package/cypress/e2e/account/holiday-stop.cy.js +51 -129
- package/cypress/fixtures/testDates.js +26 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [4.22.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@4.22.1-alpha.0...@newskit-render/core@4.22.1) (2024-02-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @newskit-render/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [4.22.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@4.22.0-alpha.1...@newskit-render/core@4.22.0) (2024-02-07)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @newskit-render/core
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getTestDates } from '../../fixtures/testDates'
|
|
2
|
+
|
|
1
3
|
describe('Book a Holiday Stop', () => {
|
|
2
4
|
beforeEach(() => {
|
|
3
5
|
cy.GetTnlAcsSession('tnl')
|
|
@@ -11,96 +13,70 @@ describe('Book a Holiday Stop', () => {
|
|
|
11
13
|
})
|
|
12
14
|
})
|
|
13
15
|
|
|
14
|
-
describe('
|
|
16
|
+
describe('Add a Holiday Stop', () => {
|
|
15
17
|
beforeEach(() => {
|
|
16
|
-
cy.clock(Date.UTC(2022, 10, 30), ['Date'])
|
|
17
18
|
cy.GetTnlAcsSession('tnl')
|
|
18
|
-
cy.mockConsentAndVisit('/account/holiday-stop')
|
|
19
|
+
cy.mockConsentAndVisit('/account/add/holiday-stop')
|
|
19
20
|
})
|
|
20
21
|
|
|
21
|
-
it('should display
|
|
22
|
-
cy.get('
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
cy.get('[data-testid="content-list"] > ul > li').should(
|
|
26
|
-
'have.length.of.at.least',
|
|
27
|
-
6
|
|
28
|
-
)
|
|
29
|
-
})
|
|
22
|
+
it('should display add Holiday Stop page', () => {
|
|
23
|
+
cy.get('[data-testid="introduction-title"]').contains('Add a Holiday Stop')
|
|
24
|
+
cy.get('[data-testid="create-holiday-stop"]').should('exist')
|
|
25
|
+
cy.get('[data-testid="create-holiday-stop"]').contains('Choose your dates')
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
cy.wait(1000)
|
|
34
|
-
cy.get('a[href="/account/holiday-stop/upcoming-holiday-stops"]').click()
|
|
35
|
-
cy.url().should('match', /account\/holiday-stop\/upcoming-holiday-stops/)
|
|
36
|
-
})
|
|
37
|
-
})
|
|
27
|
+
cy.get('[id="startDate"]').should('exist')
|
|
28
|
+
cy.get('[id="endDate"]').should('exist')
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
cy.mockConsentAndVisit('/account/holiday-stop')
|
|
30
|
+
cy.get('[data-testid="primary-button"]').should('exist')
|
|
31
|
+
cy.get('[data-testid="secondary-button"]')
|
|
32
|
+
.should('have.attr', 'href', '/account/holiday-stop')
|
|
33
|
+
.contains('Cancel')
|
|
44
34
|
})
|
|
45
35
|
|
|
46
|
-
it('should
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
cy.get('[
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.
|
|
55
|
-
.click()
|
|
56
|
-
cy.get('[data-testid="
|
|
57
|
-
cy.contains(
|
|
58
|
-
|
|
59
|
-
'
|
|
36
|
+
it('should add a new Holiday Stop', () => {
|
|
37
|
+
const [startDate, endDate] = getTestDates()
|
|
38
|
+
|
|
39
|
+
cy.get('[id="startDate"]').should('be.visible').click({ force: true })
|
|
40
|
+
cy.get('input[name="startDate"]').type(startDate)
|
|
41
|
+
cy.get('input[name="endDate"]').type(endDate)
|
|
42
|
+
|
|
43
|
+
cy.get('[data-testid="primary-button"]')
|
|
44
|
+
.should('be.visible')
|
|
45
|
+
.click({ force: true })
|
|
46
|
+
cy.get('[data-testid="modal"]').should('exist')
|
|
47
|
+
cy.get('[data-testid="introduction-title"]').contains('Holiday Stop added')
|
|
48
|
+
cy.get('[data-testid="description-block"]').contains(
|
|
49
|
+
'You have successfully added a Holiday Stop to your account. Your account will be credited no more than 8 weeks after the holiday start date.'
|
|
60
50
|
)
|
|
51
|
+
cy.get('[aria-label="Retun to Holiday Stops"]').click()
|
|
61
52
|
})
|
|
62
53
|
})
|
|
63
54
|
|
|
64
|
-
describe
|
|
55
|
+
describe('Upcoming Holiday Stops - edit button', () => {
|
|
65
56
|
beforeEach(() => {
|
|
66
|
-
cy.clock(Date.UTC(2022, 10, 30), ['Date'])
|
|
67
57
|
cy.GetTnlAcsSession('tnl')
|
|
68
58
|
cy.mockConsentAndVisit('/account/holiday-stop')
|
|
69
59
|
})
|
|
70
60
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
body: { data: { updateUserHolidayStop: { success: true } } },
|
|
75
|
-
})
|
|
61
|
+
const [startDate] = getTestDates(0, false)
|
|
62
|
+
const [fullStartDate, fullEndDate] = getTestDates()
|
|
63
|
+
const [newStartDate, newEndDate] = getTestDates(1)
|
|
76
64
|
|
|
65
|
+
it('should show redirect to edit page and show corresponding data', () => {
|
|
77
66
|
cy.get('[data-testid="content-list"] > ul > li')
|
|
78
|
-
.contains(
|
|
67
|
+
.contains(startDate)
|
|
79
68
|
.parents('li')
|
|
80
69
|
.contains('Edit')
|
|
81
70
|
.click()
|
|
82
71
|
cy.url().should('match', /\/account\/edit\/holiday-stop?/)
|
|
83
72
|
|
|
84
|
-
cy.get('[name="startDate"]').invoke('val').should('equal',
|
|
85
|
-
cy.get('[name="endDate"]').invoke('val').should('equal',
|
|
73
|
+
cy.get('[name="startDate"]').invoke('val').should('equal', fullStartDate)
|
|
74
|
+
cy.get('[name="endDate"]').invoke('val').should('equal', fullEndDate)
|
|
86
75
|
|
|
87
|
-
const dateFormatOptions = {
|
|
88
|
-
year: 'numeric',
|
|
89
|
-
month: 'numeric',
|
|
90
|
-
day: 'numeric',
|
|
91
|
-
}
|
|
92
76
|
cy.get('[id="startDate"]').should('be.visible').click({ force: true })
|
|
93
77
|
|
|
94
|
-
cy.get('input[name="startDate"]')
|
|
95
|
-
|
|
96
|
-
.type(
|
|
97
|
-
new Date('21/01/2023').toLocaleDateString('en-GB', dateFormatOptions)
|
|
98
|
-
)
|
|
99
|
-
cy.get('input[name="endDate"]')
|
|
100
|
-
.clear()
|
|
101
|
-
.type(
|
|
102
|
-
new Date('31/01/2023').toLocaleDateString('en-GB', dateFormatOptions)
|
|
103
|
-
)
|
|
78
|
+
cy.get('input[name="startDate"]').type(`0{selectAll}${newStartDate}`)
|
|
79
|
+
cy.get('input[name="endDate"]').type(`0{selectAll}${newEndDate}`)
|
|
104
80
|
|
|
105
81
|
cy.get('body').click({ force: true })
|
|
106
82
|
cy.contains('[data-testid="primary-button"]', 'Save').click()
|
|
@@ -110,78 +86,24 @@ describe.skip('Edit button Holiday Stop', () => {
|
|
|
110
86
|
})
|
|
111
87
|
})
|
|
112
88
|
|
|
113
|
-
describe('
|
|
89
|
+
describe('Cancel Holiday Stop', () => {
|
|
114
90
|
beforeEach(() => {
|
|
115
91
|
cy.GetTnlAcsSession('tnl')
|
|
116
|
-
cy.mockConsentAndVisit('/account/
|
|
92
|
+
cy.mockConsentAndVisit('/account/holiday-stop')
|
|
117
93
|
})
|
|
118
|
-
it('should display add Holiday Stop page', () => {
|
|
119
|
-
cy.get('[data-testid="introduction-title"]').contains('Add a Holiday Stop')
|
|
120
|
-
cy.get('[data-testid="create-holiday-stop"]').should('exist')
|
|
121
|
-
cy.get('[data-testid="create-holiday-stop"]').contains('Choose your dates')
|
|
122
94
|
|
|
123
|
-
|
|
124
|
-
|
|
95
|
+
it('should show popup and cancel Holiday Stop', () => {
|
|
96
|
+
const [newStartDate] = getTestDates(1, false)
|
|
125
97
|
|
|
126
|
-
cy.get('[data-testid="
|
|
127
|
-
|
|
128
|
-
.
|
|
98
|
+
cy.get('[data-testid="content-list"] > ul > li')
|
|
99
|
+
.contains(newStartDate)
|
|
100
|
+
.parents('li')
|
|
129
101
|
.contains('Cancel')
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
day: 'numeric',
|
|
136
|
-
}
|
|
137
|
-
cy.get('[id="startDate"]').should('be.visible').click({ force: true })
|
|
138
|
-
|
|
139
|
-
cy.get('input[name="startDate"]').type(
|
|
140
|
-
new Date('10/18/2022').toLocaleDateString('en-GB', dateFormatOptions)
|
|
141
|
-
)
|
|
142
|
-
cy.get('input[name="endDate"]').type(
|
|
143
|
-
new Date('10/20/2022').toLocaleDateString('en-GB', dateFormatOptions)
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
cy.intercept('POST', '/api/account/mutate', {
|
|
147
|
-
statusCode: 200,
|
|
148
|
-
body: { data: { createUserHolidayStop: { success: true } } },
|
|
149
|
-
})
|
|
150
|
-
cy.get('[data-testid="primary-button"]')
|
|
151
|
-
.should('be.visible')
|
|
152
|
-
.click({ force: true })
|
|
153
|
-
cy.get('[data-testid="modal"]').should('exist')
|
|
154
|
-
cy.get('[data-testid="introduction-title"]').contains('Holiday Stop added')
|
|
155
|
-
cy.get('[data-testid="description-block"]').contains(
|
|
156
|
-
'You have successfully added a Holiday Stop to your account. Your account will be credited no more than 8 weeks after the holiday start date.'
|
|
157
|
-
)
|
|
158
|
-
cy.get('[aria-label="Retun to Holiday Stops"]').click()
|
|
159
|
-
})
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
describe('Edit Holiday Stops', () => {
|
|
163
|
-
beforeEach(() => {
|
|
164
|
-
cy.GetTnlAcsSession('tnl')
|
|
165
|
-
cy.visitAndOverrideNextData(
|
|
166
|
-
'/account/edit/holiday-stop?id=a2U7Y000001r8aSUAQ',
|
|
167
|
-
'props.pageProps.data.fields',
|
|
168
|
-
[
|
|
169
|
-
{
|
|
170
|
-
value: [
|
|
171
|
-
{
|
|
172
|
-
id: 'a2U7Y000001r8aSUAQ',
|
|
173
|
-
startDate: '2022-10-12T00:00:00',
|
|
174
|
-
endDate: '2022-10-13T00:00:00',
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
},
|
|
178
|
-
]
|
|
102
|
+
.click()
|
|
103
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
104
|
+
cy.contains(
|
|
105
|
+
'[data-testid="toast-container"]',
|
|
106
|
+
'Your Holiday Stop was successfully cancelled. Cancelled Holiday Stops will not be displayed.'
|
|
179
107
|
)
|
|
180
108
|
})
|
|
181
|
-
it('should display edit Holiday Stop page', () => {
|
|
182
|
-
cy.get('[data-testid="introduction-title"]').contains('Edit a Holiday Stop')
|
|
183
|
-
cy.get('[data-testid="update-holiday-stop"]').should('exist')
|
|
184
|
-
cy.get('[name="startDate"]').invoke('val').should('equal', '12/10/2022')
|
|
185
|
-
cy.get('[name="endDate"]').invoke('val').should('equal', '13/10/2022')
|
|
186
|
-
})
|
|
187
109
|
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const getTestDates = (modifier = 0, fullYear = true) => {
|
|
2
|
+
const dateFormatOptions = {
|
|
3
|
+
year: 'numeric',
|
|
4
|
+
month: '2-digit',
|
|
5
|
+
day: '2-digit',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (!fullYear) {
|
|
9
|
+
dateFormatOptions.year = '2-digit'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const today = new Date()
|
|
13
|
+
|
|
14
|
+
const startDate = new Date(today)
|
|
15
|
+
startDate.setDate(today.getDate() + 2 + modifier)
|
|
16
|
+
startDate.setMonth(today.getMonth() + 1)
|
|
17
|
+
|
|
18
|
+
const endDate = new Date(today)
|
|
19
|
+
endDate.setDate(today.getDate() + 4 + modifier)
|
|
20
|
+
endDate.setMonth(today.getMonth() + 1)
|
|
21
|
+
|
|
22
|
+
return [
|
|
23
|
+
startDate.toLocaleDateString('en-GB', dateFormatOptions),
|
|
24
|
+
endDate.toLocaleDateString('en-GB', dateFormatOptions),
|
|
25
|
+
]
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "4.22.1",
|
|
3
|
+
"version": "4.22.2-alpha.1",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"@newrelic/winston-enricher": "4.0.1",
|
|
45
45
|
"@newskit-render/api": "^1.11.0",
|
|
46
46
|
"@newskit-render/auth": "^1.8.0",
|
|
47
|
-
"@newskit-render/checkout": "^3.9.
|
|
47
|
+
"@newskit-render/checkout": "^3.9.6-alpha.0",
|
|
48
48
|
"@newskit-render/feature-flags": "^1.7.0",
|
|
49
49
|
"@newskit-render/feed": "^1.8.5",
|
|
50
|
-
"@newskit-render/my-account": "^7.
|
|
51
|
-
"@newskit-render/shared-components": "^4.
|
|
52
|
-
"@newskit-render/standalone-components": "^3.19.
|
|
53
|
-
"@newskit-render/validation": "^1.
|
|
50
|
+
"@newskit-render/my-account": "^7.24.0-alpha.0",
|
|
51
|
+
"@newskit-render/shared-components": "^4.13.0-alpha.0",
|
|
52
|
+
"@newskit-render/standalone-components": "^3.19.6-alpha.0",
|
|
53
|
+
"@newskit-render/validation": "^1.14.0-alpha.0",
|
|
54
54
|
"cross-fetch": "3.1.5",
|
|
55
55
|
"graphql": "16.6.0",
|
|
56
56
|
"lodash.get": "4.4.2",
|