From 320c8b0c3470b24380e7a0cbde3f08d7836f6d0e Mon Sep 17 00:00:00 2001 From: Camille Moinier Date: Thu, 7 Dec 2023 16:53:48 +0100 Subject: [PATCH] fix(e2e): fix e2e test --- apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts b/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts index 0a0c695e94..a2d823b853 100644 --- a/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts @@ -373,15 +373,18 @@ describe('dataset pages', () => { }) }) it('downloads a file on click', () => { + cy.intercept( + 'GET', + 'https://www.geo2france.fr/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=csv' + ).as('downloadRequest') + cy.get('datahub-record-downloads') .find('gn-ui-download-item') .first() .click() - cy.exec('ls cypress/downloads').then((result) => { - const fileList = result.stdout.split('\n') - const isFileDownloaded = fileList[0] - expect(/\S/.test(isFileDownloaded)).to.be.true + cy.wait('@downloadRequest').then((interception) => { + expect(interception.response.statusCode).to.equal(200) }) }) it('displays the full list after clicking two times on one filter', () => {