in ui/cypress/support/utils/DataDownloadDialogUtils.ts [25:92]
public static testDownload(
exportConfig: ExportConfig,
resultFileLocation: string,
dataViewName: string,
) {
// const exportDate: Date;
DataLakeUtils.goToDatalake();
// select data view in edit mode
DataLakeUtils.editDataView(dataViewName);
// select download button
cy.dataCy('data-view-data-download-btn').click();
// download-customInterval, download-all, download-visible
cy.dataCy(
`download-configuration-${exportConfig.dataExportConfig.dataRangeConfiguration}`,
).within(() => {
cy.get('.mdc-radio').click();
});
// download-ignore, download-emtpy
cy.dataCy(
`download-configuration-${exportConfig.dataExportConfig.missingValueBehaviour}`,
).within(() => {
cy.get('.mdc-radio').click();
});
// click next
cy.dataCy('download-configuration-next-btn').click();
// Format
cy.dataCy(
`download-configuration-${exportConfig.formatExportConfig.format}`,
).within(() => {
cy.get('.mdc-radio').click();
});
if ('delimiter' in exportConfig.formatExportConfig) {
cy.dataCy(
`download-configuration-delimiter-${
(exportConfig.formatExportConfig as CsvFormatExportConfig)
.delimiter
}`,
).within(() => {
cy.get('.mdc-radio').click();
});
}
// click next
cy.dataCy('download-configuration-download-btn').click();
const fileNameService: FileNameService = new FileNameService();
const fileName = fileNameService.generateName(exportConfig, new Date());
const downloadsFolder = Cypress.config('downloadsFolder');
cy.readFile(downloadsFolder + '/' + fileName).then(
(downloadFileString: string) => {
cy.readFile(
`cypress/fixtures/dataDownloadDialog/${resultFileLocation}`,
).then(expectedResult => {
// Replace whitespaces on Windows systems
if (typeof expectedResult === 'string') {
expectedResult = expectedResult.replace(/\r/g, '');
}
expect(expectedResult).to.deep.equal(downloadFileString);
});
},
);
}