From 8a2d73f72ab96c5359d28f4a68b04f952e952b41 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Tue, 17 Sep 2024 18:20:01 +0100 Subject: [PATCH] Ensure we check for correct status code when testing cli download links --- cypress/e2e/tests/pages/generic/about.spec.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/tests/pages/generic/about.spec.ts b/cypress/e2e/tests/pages/generic/about.spec.ts index d5dd6500728..8c1a5a5ae7a 100644 --- a/cypress/e2e/tests/pages/generic/about.spec.ts +++ b/cypress/e2e/tests/pages/generic/about.spec.ts @@ -111,6 +111,9 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser', }); describe('CLI Downloads', () => { + // Shouldn't be needed with https://github.com/rancher/dashboard/issues/11393 + const expectedLinkStatusCode = 404; + // workaround to make the following CLI tests work https://github.com/cypress-io/cypress/issues/8089#issuecomment-1585159023 beforeEach(() => { aboutPage.goTo(); @@ -125,7 +128,7 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser', el.attr('download', ''); }).click(); cy.wait('@download').then(({ request, response }) => { - expect(response?.statusCode).to.eq(200); + expect(response?.statusCode).to.eq(expectedLinkStatusCode); expect(request.url).includes(macOsVersion); }); }); @@ -139,7 +142,7 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser', el.attr('download', ''); }).click(); cy.wait('@download').then(({ request, response }) => { - expect(response?.statusCode).to.eq(200); + expect(response?.statusCode).to.eq(expectedLinkStatusCode); expect(request.url).includes(linuxVersion); }); }); @@ -153,7 +156,7 @@ describe('About Page', { testIsolation: 'off', tags: ['@generic', '@adminUser', el.attr('download', ''); }).click(); cy.wait('@download').then(({ request, response }) => { - expect(response?.statusCode).to.eq(200); + expect(response?.statusCode).to.eq(expectedLinkStatusCode); expect(request.url).includes(windowsVersion); }); });