Skip to content

Commit

Permalink
Merge pull request #11941 from richard-cox/cli-download-e2e
Browse files Browse the repository at this point in the history
Ensure we check for correct status code when testing cli download links
  • Loading branch information
richard-cox authored Sep 18, 2024
2 parents c88be67 + 8a2d73f commit 3283c99
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cypress/e2e/tests/pages/generic/about.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
});
});
Expand All @@ -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);
});
});
Expand All @@ -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);
});
});
Expand Down

0 comments on commit 3283c99

Please sign in to comment.