From ed8723d8b63c0a70dad823cbb82c793850f376e1 Mon Sep 17 00:00:00 2001 From: Joshua Hawxwell Date: Fri, 13 Sep 2024 12:42:41 +0100 Subject: [PATCH 1/2] Use go(-2) instead of clicking back --- cypress/e2e/donor/choose-attorneys.cy.js | 15 +++++++-------- .../e2e/donor/choose-replacement-attorneys.cy.js | 15 +++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/donor/choose-attorneys.cy.js b/cypress/e2e/donor/choose-attorneys.cy.js index 2338087397..05a8d567ec 100644 --- a/cypress/e2e/donor/choose-attorneys.cy.js +++ b/cypress/e2e/donor/choose-attorneys.cy.js @@ -135,13 +135,12 @@ describe('Choose attorneys', () => { cy.contains('button', 'Save and continue').click(); cy.url().should('contain', '/choose-attorneys-address'); - // TODO workout why cypress with later versions of node breaks when using back links - // cy.contains('a', 'Back').click() - // cy.url().should('contain', '/choose-attorneys'); - // - // cy.get('#f-date-of-birth-year').clear().type(new Date().getFullYear() - 20); - // cy.contains('button', 'Save and continue').click(); - // - // cy.url().should('contain', '/choose-attorneys-address'); + cy.go(-2); + cy.url().should('contain', '/choose-attorneys'); + + cy.get('#f-date-of-birth-year').clear().type(new Date().getFullYear() - 20); + cy.contains('button', 'Save and continue').click(); + + cy.url().should('contain', '/choose-attorneys-address'); }); }); diff --git a/cypress/e2e/donor/choose-replacement-attorneys.cy.js b/cypress/e2e/donor/choose-replacement-attorneys.cy.js index bdef51b184..2c0c9d999b 100644 --- a/cypress/e2e/donor/choose-replacement-attorneys.cy.js +++ b/cypress/e2e/donor/choose-replacement-attorneys.cy.js @@ -138,13 +138,12 @@ describe('Choose replacement attorneys', () => { cy.contains('button', 'Save and continue').click(); cy.url().should('contain', '/choose-replacement-attorneys-address'); - // TODO workout why cypress with later versions of node breaks when using back links - // cy.contains('a', 'Back').click() - // cy.url().should('contain', '/choose-replacement-attorneys'); - // - // cy.get('#f-date-of-birth-year').clear().type(new Date().getFullYear() - 20); - // cy.contains('button', 'Save and continue').click(); - // - // cy.url().should('contain', '/choose-replacement-attorneys-address'); + cy.go(-2); + cy.url().should('contain', '/choose-replacement-attorneys'); + + cy.get('#f-date-of-birth-year').clear().type(new Date().getFullYear() - 20); + cy.contains('button', 'Save and continue').click(); + + cy.url().should('contain', '/choose-replacement-attorneys-address'); }); }); From 70dbb979cfc1c826c59fa414e959a3702534c955 Mon Sep 17 00:00:00 2001 From: Alex Saunders Date: Tue, 17 Sep 2024 15:22:46 +0100 Subject: [PATCH 2/2] MLPAB-2358 cover back links --- cypress/e2e/navigation.cy.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 cypress/e2e/navigation.cy.js diff --git a/cypress/e2e/navigation.cy.js b/cypress/e2e/navigation.cy.js new file mode 100644 index 0000000000..cbf24bc909 --- /dev/null +++ b/cypress/e2e/navigation.cy.js @@ -0,0 +1,16 @@ +describe('High level navigation', () => { + describe('back link', () => { + it('navigates to the previous page', () => { + cy.visit('/fixtures?redirect=/task-list&progress=provideYourDetails') + cy.contains('a', 'Choose your attorneys').click() + + cy.url().should('contain', '/choose-attorneys-guidance') + cy.contains('button', 'Continue').click() + + cy.url().should('contain', '/choose-attorneys') + cy.contains('a', 'Back').click() + + cy.url().should('contain', '/choose-attorneys-guidance') + }) + }) +})