diff --git a/cypress/integration/download.cy.js b/cypress/integration/download.cy.js index 362f8ba6c..7d6a48b38 100644 --- a/cypress/integration/download.cy.js +++ b/cypress/integration/download.cy.js @@ -2,6 +2,7 @@ import { E2E_PROGRAM } from '../data/index.js' import { selectEnrollmentWithProgram, selectEventWithProgram, + selectTrackedEntityWithType, } from '../helpers/dimensions.js' import { clickMenubarUpdateButton } from '../helpers/menubar.js' import { goToStartPage } from '../helpers/startScreen.js' @@ -48,4 +49,16 @@ describe('download', () => { downloadIsEnabled() }) + + it('download button disables when required dimensions are selected (tracked entity)', () => { + goToStartPage() + + downloadIsDisabled() + + selectTrackedEntityWithType('Person') + + clickMenubarUpdateButton() + + downloadIsEnabled() + }) }) diff --git a/src/modules/layoutValidation.js b/src/modules/layoutValidation.js index 3058df4e0..e3de4b990 100644 --- a/src/modules/layoutValidation.js +++ b/src/modules/layoutValidation.js @@ -39,13 +39,14 @@ export const validateLineListLayout = (layout, { dryRun } = {}) => { } // program - if (!layoutHasProgramId(layout)) { + if ( + layout.outputType !== OUTPUT_TYPE_TRACKED_ENTITY && + !layoutHasProgramId(layout) + ) { if (dryRun) { return false } - if (layout.outputType !== OUTPUT_TYPE_TRACKED_ENTITY) { - throw noProgramError() - } + throw noProgramError() } // columns