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'); }); }); 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') + }) + }) +})