Skip to content

Commit e78b711

Browse files
committed
Change tests to use a single finish page
1 parent 54269e6 commit e78b711

4 files changed

Lines changed: 19 additions & 38 deletions

File tree

cypress/e2e/errors.cy.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('On application start', () => {
1515
// Since the stepper is separate from the screen itself, it doesn't matter which screen we join
1616
const stepsWithExpectedErrors = ['start', 'authors']
1717
it('should have errors in start and authors, but not in any other steps', () => {
18-
cy.visit('/finish-advanced')
18+
cy.visit('/identifiers')
1919
stepsWithExpectedErrors.forEach((step) => {
2020
cy.checkThatStepperValidityIs(false, step)
2121
})
@@ -43,10 +43,9 @@ describe('From a fixed advanced app', () => {
4343
cy.visit('/authors')
4444
cy.dataCy('btn-add-author')
4545
.click()
46-
cy.visit('/finish-advanced')
46+
cy.visit('/identifiers')
4747
})
4848
it('should have no errors', () => {
49-
cy.visit('/finish-advanced')
5049
allStepNames.forEach((step) => {
5150
cy.checkThatStepperValidityIs(true, step)
5251
cy.dataCy('ta-cff-preview')

cypress/e2e/navigation.cy.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('App navigation', () => {
2929
cy.dataCy('btn-previous')
3030
.should('be.visible')
3131
})
32-
cy.url().should('include', '/finish-minimum')
32+
cy.url().should('include', '/finish')
3333
cy.dataCy('btn-next')
3434
.should('not.be.visible')
3535
Array.from(basicStepNames).reverse().forEach((step) => {
@@ -44,7 +44,7 @@ describe('App navigation', () => {
4444
.should('not.be.visible')
4545
})
4646
it('should be navigable through the stepper', () => {
47-
['finish-minimum', ...basicStepNames, ...[...basicStepNames].reverse()].forEach((step) => {
47+
['finish', ...basicStepNames, ...[...basicStepNames].reverse()].forEach((step) => {
4848
cy.visit(step === 'start' ? '/authors' : `/${step}`)
4949
cy.dataCy(`step-${step}`)
5050
.click()
@@ -62,7 +62,7 @@ describe('App navigation', () => {
6262
cy.visit('/authors')
6363
cy.dataCy('btn-add-author')
6464
.click()
65-
cy.visit('/finish-minimum')
65+
cy.visit('/finish')
6666
cy.dataCy('btn-add-more')
6767
.click()
6868
})
@@ -82,7 +82,7 @@ describe('App navigation', () => {
8282
cy.dataCy('btn-previous')
8383
.should('be.visible')
8484
})
85-
cy.url().should('include', '/finish-advanced')
85+
cy.url().should('include', '/finish')
8686
cy.dataCy('btn-next')
8787
.should('not.be.visible')
8888
Array.from(allStepNames).reverse().forEach((step) => {
@@ -97,7 +97,7 @@ describe('App navigation', () => {
9797
.should('not.be.visible')
9898
})
9999
it('should be navigable through the stepper', () => {
100-
['finish-advanced', ...allStepNames, ...[...allStepNames].reverse()].forEach((step) => {
100+
['finish', ...allStepNames, ...[...allStepNames].reverse()].forEach((step) => {
101101
cy.visit(step === 'start' ? '/authors' : `/${step}`)
102102
cy.dataCy(`step-${step}`)
103103
.click()
@@ -106,7 +106,7 @@ describe('App navigation', () => {
106106
})
107107
})
108108
describe('if there are no errors', () => {
109-
it('should jump from step to finish-advanced when finish is clicked', () => {
109+
it('should jump from step to finish when finish is clicked', () => {
110110
allStepNames.forEach((step) => {
111111
cy.visit(`/${step}`)
112112
// The next test is just to make sure the page loaded without using cy.wait
@@ -115,7 +115,7 @@ describe('App navigation', () => {
115115
.should('be.visible')
116116
.click()
117117
cy.url()
118-
.should('contain', '/finish-advanced')
118+
.should('contain', '/finish')
119119
})
120120
})
121121
})
@@ -153,8 +153,8 @@ describe('App navigation', () => {
153153
}
154154
})
155155
})
156-
it(`should have ${basicStepNames.length + 1} steps, visible previous, hidden next/finish for step finish-minimum`, () => {
157-
cy.visit('/finish-minimum')
156+
it(`should have ${basicStepNames.length + 1} steps, visible previous, hidden next/finish for step finish`, () => {
157+
cy.visit('/finish')
158158
cy.get('.q-stepper__tab')
159159
.should('have.length', basicStepNames.length + 1)
160160
cy.dataCy('btn-finish')
@@ -164,17 +164,6 @@ describe('App navigation', () => {
164164
cy.dataCy('btn-previous')
165165
.should('be.visible')
166166
})
167-
it(`should have ${advancedStepNames.length + 1} steps, visible previous, hidden next/finish for step finish-advanced`, () => {
168-
cy.visit('/finish-advanced')
169-
cy.get('.q-stepper__tab')
170-
.should('have.length', allStepNames.length + 1)
171-
cy.dataCy('btn-finish')
172-
.should('not.be.visible')
173-
cy.dataCy('btn-next')
174-
.should('not.be.visible')
175-
cy.dataCy('btn-previous')
176-
.should('be.visible')
177-
})
178167
})
179168

180169
describe('On the screen Authors', () => {

cypress/e2e/spec.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('Basic usage', () => {
7575
.click()
7676

7777
// Finish Minimum screen
78-
cy.url().should('include', '/finish-minimum')
78+
cy.url().should('include', '/finish')
7979
cy.dataCy('btn-download')
8080
.click()
8181
const downloadsFolder = Cypress.config('downloadsFolder')
@@ -131,7 +131,7 @@ describe('Basic usage', () => {
131131
.click()
132132

133133
// Finish Minimum screen
134-
cy.url().should('include', '/finish-minimum')
134+
cy.url().should('include', '/finish')
135135
cy.dataCy('btn-add-more')
136136
.click()
137137

@@ -241,7 +241,7 @@ describe('Basic usage', () => {
241241
.click()
242242

243243
// Finish Advanced screen
244-
cy.url().should('include', '/finish-advanced')
244+
cy.url().should('include', '/finish')
245245
cy.dataCy('btn-download')
246246
.click()
247247

test/jest/__tests__/store/app.jest.spec.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('useApp', () => {
6060
void navigateNext()
6161
expect(cannotGoBack.value).toBe(false)
6262
})
63-
expect(stepName.value).toBe('finish-minimum')
63+
expect(stepName.value).toBe('finish')
6464
expect(cannotGoForward.value).toBe(true)
6565
Array.from(basicStepNames).reverse().forEach((step) => {
6666
expect(cannotGoBack.value).toBe(false)
@@ -79,7 +79,7 @@ describe('useApp', () => {
7979
})
8080
const allSteps = [...basicStepNames, ...advancedStepNames]
8181
it(`should have ${allSteps.length} as lastIndex`, () => {
82-
expect(lastStepIndex.value).toBe(allSteps.length + 1) // Off-by-one numbering of steps
82+
expect(lastStepIndex.value).toBe(allSteps.length)
8383
})
8484
it('should be navigable with next and previous (except at boundaries)', () => {
8585
expect(cannotGoBack.value).toBe(true)
@@ -89,7 +89,7 @@ describe('useApp', () => {
8989
void navigateNext()
9090
expect(cannotGoBack.value).toBe(false)
9191
})
92-
expect(stepName.value).toBe('finish-advanced')
92+
expect(stepName.value).toBe('finish')
9393
expect(cannotGoForward.value).toBe(true)
9494
Array.from(allSteps).reverse().forEach((step) => {
9595
expect(cannotGoBack.value).toBe(false)
@@ -115,21 +115,14 @@ describe('useApp', () => {
115115
expect(cannotGoBack.value).toBe(false)
116116
})
117117
})
118-
it('should enable advanced mode for step finish-advanced and respect next/previous', () => {
119-
expect(showAdvanced.value).toBe(false)
120-
navigateDirect('finish-advanced')
121-
expect(showAdvanced.value).toBe(true)
122-
expect(cannotGoForward.value).toBe(true)
123-
expect(cannotGoBack.value).toBe(false)
124-
})
125-
it('should not enable advanced mode for basic steps and finish-minimum and respect next/previous', () => {
118+
it('should not enable advanced mode for basic steps and finish and respect next/previous', () => {
126119
basicStepNames.forEach((step) => {
127120
navigateDirect(step)
128121
expect(showAdvanced.value).toBe(false)
129122
expect(cannotGoForward.value).toBe(false)
130123
expect(cannotGoBack.value).toBe(step === 'start')
131124
})
132-
navigateDirect('finish-minimum')
125+
navigateDirect('finish')
133126
expect(showAdvanced.value).toBe(false)
134127
expect(cannotGoForward.value).toBe(true)
135128
expect(cannotGoBack.value).toBe(false)

0 commit comments

Comments
 (0)