2021-07-15 11:01:10 -07:00
|
|
|
// / <reference types="Cypress" />
|
|
|
|
|
|
|
|
describe('Census Block Group download', () => {
|
|
|
|
it('validate file download', () => {
|
2021-07-19 08:05:32 -07:00
|
|
|
const filename = `usa.zip`;
|
2021-07-15 11:01:10 -07:00
|
|
|
cy.visit('localhost:8000/en/cejst');
|
|
|
|
cy.get('#download-link').invoke('attr', 'target', '_blank');
|
2021-07-19 08:05:32 -07:00
|
|
|
cy.intercept(`https://justice40-data.s3.amazonaws.com/Score/${filename}`,
|
2021-07-15 11:01:10 -07:00
|
|
|
{
|
|
|
|
body: 'success',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'text/html; charset=utf-8',
|
|
|
|
'Content-Disposition': 'attachment',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
).as('downloadRequest');
|
|
|
|
cy.get('button[class*="downloadPacket"]').click();
|
|
|
|
cy.wait('@downloadRequest');
|
2021-07-19 08:05:32 -07:00
|
|
|
cy.readFile(`cypress/downloads/${filename}`).should('exist');
|
2021-07-15 11:01:10 -07:00
|
|
|
});
|
|
|
|
});
|