diff --git a/tests/component/dataset/infrastructure/mappers/JSDatasetMapper.spec.ts b/tests/component/dataset/infrastructure/mappers/JSDatasetMapper.spec.ts index f5965039a..1c4d33408 100644 --- a/tests/component/dataset/infrastructure/mappers/JSDatasetMapper.spec.ts +++ b/tests/component/dataset/infrastructure/mappers/JSDatasetMapper.spec.ts @@ -219,7 +219,6 @@ const expectedDatasetAlternateVersion = { describe('JS Dataset Mapper', () => { it('maps jsDataset model to the domain Dataset model', () => { const mapped = JSDatasetMapper.toDataset(jsDataset, citation, datasetSummaryFields) - console.log(mapped) expect(expectedDataset).to.deep.equal(mapped) }) it('maps jsDataset model to the domain Dataset model for alternate version', () => { diff --git a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx index 3a31583fa..96d0cf3c2 100644 --- a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx +++ b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx @@ -419,54 +419,71 @@ describe('Dataset', () => { }) }) - it('downloads a file', () => { - cy.wrap( - DatasetHelper.createWithFiles(FileHelper.createMany(1)).then((dataset) => - DatasetHelper.publish(dataset.persistentId) + describe('Downloading files', () => { + it('downloads a file', () => { + cy.wrap( + DatasetHelper.createWithFiles(FileHelper.createMany(1)).then((dataset) => + DatasetHelper.publish(dataset.persistentId) + ) ) - ) - .its('persistentId') - .then((persistentId: string) => { - cy.wait(1500) // Wait for the dataset to be published - cy.visit(`/spa/datasets?persistentId=${persistentId}`) - cy.wait(1500) // Wait for the page to load - - cy.findByText('Files').should('exist') - - cy.findByRole('button', { name: 'Access File' }).should('exist').click() - - // Workaround for issue where Cypress gets stuck on the download - cy.window() - .document() - .then(function (doc) { - doc.addEventListener('click', () => { - setTimeout(function () { - doc.location.reload() - }, 5000) + .its('persistentId') + .then((persistentId: string) => { + cy.wait(1500) // Wait for the dataset to be published + cy.visit(`/spa/datasets?persistentId=${persistentId}`) + cy.wait(1500) // Wait for the page to load + + cy.findByText('Files').should('exist') + + cy.findByRole('button', { name: 'Access File' }).should('exist').click() + + // Workaround for issue where Cypress gets stuck on the download + cy.window() + .document() + .then(function (doc) { + doc.addEventListener('click', () => { + setTimeout(function () { + doc.location.reload() + }, 5000) + }) + cy.findByText('Plain Text').should('exist').click() }) - cy.findByText('Plain Text').should('exist').click() - }) - cy.findByText('1 Downloads').should('exist') - }) - }) + cy.findByText('1 Downloads').should('exist') + }) + }) - it.only('downloads multiple files', () => { - cy.wrap( - DatasetHelper.createWithFiles(FileHelper.createMany(3)).then((dataset) => - DatasetHelper.publish(dataset.persistentId) + it('downloads multiple files', () => { + cy.wrap( + DatasetHelper.createWithFiles(FileHelper.createMany(3)).then((dataset) => + DatasetHelper.publish(dataset.persistentId) + ) ) - ) - .its('persistentId') - .then((persistentId: string) => { - cy.visit(`/spa/datasets?persistentId=${persistentId}`) - cy.wait(1500) // Wait for the page to load + .its('persistentId') + .then((persistentId: string) => { + cy.wait(1500) // Wait for the page to load + cy.visit(`/spa/datasets?persistentId=${persistentId}`) + cy.wait(1500) // Wait for the page to load + + cy.findByText('Files').should('exist') - cy.findByText('Files').should('exist') + cy.get('table > thead > tr > th > input[type=checkbox]').click() - cy.get('table > thead > tr > th > input[type=checkbox]').click() + cy.findByRole('button', { name: 'Download' }).should('exist').click({ force: true }) - cy.findByRole('button', { name: 'Download' }).should('exist').click() - }) + // Workaround for issue where Cypress gets stuck on the download + cy.window() + .document() + .then(function (doc) { + doc.addEventListener('click', () => { + setTimeout(function () { + doc.location.reload() + }, 5000) + }) + cy.findByText('Original Format').should('exist').click() + }) + + cy.findAllByText('1 Downloads').should('exist') + }) + }) }) })