From 799fc23c7b3d3153df240f88d821f37afd30d6f4 Mon Sep 17 00:00:00 2001 From: Peter Hudec Date: Thu, 25 Jul 2024 15:57:43 +0100 Subject: [PATCH] Fixed broken component tests --- .../cypress/specs/ExportWins/Review.cy.jsx | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/test/component/cypress/specs/ExportWins/Review.cy.jsx b/test/component/cypress/specs/ExportWins/Review.cy.jsx index e0e633945c2..045ae593707 100644 --- a/test/component/cypress/specs/ExportWins/Review.cy.jsx +++ b/test/component/cypress/specs/ExportWins/Review.cy.jsx @@ -103,8 +103,9 @@ const assertReviewForm = ({ agree }) => { Experience: () => Promise.resolve(EXPERIENCE), MarketingSource: () => Promise.resolve(MARKETING_SOURCE), TASK_PATCH_EXPORT_WIN_REVIEW: () => Promise.resolve({}), + 'load cookie preference': () => 'granted', }, - initialPath: '/exportwins/review/123', + initialPath: '/123', }) assertHeader() @@ -337,16 +338,17 @@ describe('ExportWins/Review', () => { Experience: () => Promise.resolve(EXPERIENCE), MarketingSource: () => Promise.resolve(MARKETING_SOURCE), TASK_PATCH_EXPORT_WIN_REVIEW: () => Promise.resolve({}), + 'load cookie preference': () => 'granted', }, - initialPath: '/exportwins/review/123', + initialPath: '/123', }) cy.get('footer').within(() => { // There should be 3 links including the Crown copyright - cy.get('a').should('have.length', 3) + cy.get('a').should('have.length', 4) // Links should be in a particular order - cy.contains('Privacy Policy' + 'Accessibility Statement') + cy.contains('Privacy Policy' + 'Accessibility Statement' + 'Cookies') cy.contains('a', 'Privacy Policy').should( 'have.attr', @@ -358,6 +360,11 @@ describe('ExportWins/Review', () => { 'href', '/exportwins/review/accesibility-statement' ) + cy.contains('a', 'Cookies').should( + 'have.attr', + 'href', + '/exportwins/review/cookies' + ) }) }) @@ -369,8 +376,9 @@ describe('ExportWins/Review', () => { Promise.reject({ httpStatusCode: 404, }), - initialPath: '/exportwins/review/123', + 'load cookie preference': () => 'granted', }, + initialPath: '/123', }) assertHeader() @@ -388,8 +396,9 @@ describe('ExportWins/Review', () => { cy.mountWithProvider(, { tasks: { 'Export Win Review': () => Promise.reject({}), + 'load cookie preference': () => 'granted', }, - initialPath: '/exportwins/review/123', + initialPath: '/123', }) assertHeader()