j40-cejst-2/client/cypress/e2e/downloadPacket.spec.js
Vim b3f63c29f6
Adds download packet to methodology page (Sprint 4 designs) (#578)
* adds responsive download packet

* adds tests and intl
2021-09-07 10:08:13 -07:00

22 lines
785 B
JavaScript

// / <reference types="Cypress" />
describe('Census Block Group download', () => {
it('validate file download', () => {
const filename = `Screening+Tool+Data.zip`;
cy.visit('localhost:8000/en/methodology');
cy.get('[data-cy="download-link"]').invoke('attr', 'target', '_blank');
cy.intercept(`https://justice40-data.s3.amazonaws.com/data-pipeline/data/score/downloadable/${filename}`,
{
body: 'success',
headers: {
'Content-Type': 'text/html; charset=utf-8',
'Content-Disposition': 'attachment',
},
},
).as('downloadRequest');
cy.get('button[class*="downloadPacket"]').click();
cy.wait('@downloadRequest');
cy.readFile(`cypress/downloads/${filename}`).should('exist');
});
});