Skip to content

Commit

Permalink
fix(e2e): fix e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Dec 7, 2023
1 parent 81444e4 commit 2f19b52
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,30 @@ describe('dataset pages', () => {
})
})
it('downloads a file on click', () => {
// cy.get('datahub-record-downloads')
// .find('gn-ui-download-item')
// .first()
// .click()
// // eslint-disable-next-line cypress/no-unnecessary-waiting
// cy.wait(3000)
// 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.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') // Replace with your download URL

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) // Check if the download request was successful
})
})
it('displays the full list after clicking two times on one filter', () => {
Expand Down

0 comments on commit 2f19b52

Please sign in to comment.