From 9ec07e62214a405f92ad7fa85e84d48534e41298 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Wed, 9 Mar 2022 11:16:46 -0600 Subject: [PATCH 1/2] test: fix system-tests-firefox downloads flake --- system-tests/test/downloads_spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-tests/test/downloads_spec.ts b/system-tests/test/downloads_spec.ts index 1219fe97fa6e..23dff120abb1 100644 --- a/system-tests/test/downloads_spec.ts +++ b/system-tests/test/downloads_spec.ts @@ -23,7 +23,7 @@ describe('e2e downloads', () => { systemTests.it('allows changing the downloads folder', { project: 'downloads', - spec: '*', + spec: 'downloads_spec.ts', config: { downloadsFolder: 'cypress/dls', video: false, From 83d42b90718861dd41cbb078b63c64ab5538ede0 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Wed, 9 Mar 2022 15:33:38 -0600 Subject: [PATCH 2/2] tweak fix to system-tests-firefox downloads spec --- .../cypress/integration/downloads_spec.ts | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/system-tests/projects/downloads/cypress/integration/downloads_spec.ts b/system-tests/projects/downloads/cypress/integration/downloads_spec.ts index d2978d943187..aeba6baa966e 100644 --- a/system-tests/projects/downloads/cypress/integration/downloads_spec.ts +++ b/system-tests/projects/downloads/cypress/integration/downloads_spec.ts @@ -6,27 +6,7 @@ describe('downloads', () => { }) it('handles csv file download', () => { - // HACK: monkey-patching Cypress.downloads.end to ensure the download has - // finished before asserting on its contents. this test was flakey b/c - // sometimes file was read before the browser had written its contents. - // consider creating events for downloads or some API, so that this can - // be done without hacks - const awaitDownload = new Promise((resolve) => { - // @ts-ignore - const end = Cypress.downloads.end - - // @ts-ignore - Cypress.downloads.end = (arg) => { - resolve() - - return end(arg) - } - }) - - cy.get('[data-cy=download-csv]').click().then(() => { - return awaitDownload - }) - + cy.get('[data-cy=download-csv]').click() cy .readFile(`${Cypress.config('downloadsFolder')}/records.csv`) .should('contain', '"Joe","Smith"')