diff --git a/cypress/elements/layer.js b/cypress/elements/layer.js index 99a61b189..d9c16a0d9 100644 --- a/cypress/elements/layer.js +++ b/cypress/elements/layer.js @@ -65,6 +65,7 @@ export class Layer { } typeStartDate(dateString) { + cy.getByDataTest('calendar-clear-button').eq(0).click() cy.getByDataTest('start-date-input-content') .find('input') .type(dateString) @@ -74,6 +75,7 @@ export class Layer { } typeEndDate(dateString) { + cy.getByDataTest('calendar-clear-button').eq(1).click() cy.getByDataTest('end-date-input-content') .find('input') .type(dateString) diff --git a/cypress/integration/layers/eventlayer.cy.js b/cypress/integration/layers/eventlayer.cy.js index 432493e57..f31e5a5d6 100644 --- a/cypress/integration/layers/eventlayer.cy.js +++ b/cypress/integration/layers/eventlayer.cy.js @@ -3,11 +3,33 @@ import { EXTENDED_TIMEOUT } from '../../support/util.js' context('Event Layers', () => { beforeEach(() => { - cy.visit('/', EXTENDED_TIMEOUT) + cy.visit('/') }) const Layer = new EventLayer() + it('adds an event layer and applies style for boolean data element', () => { + Layer.openDialog('Events') + .selectProgram('E2E program') + .validateStage('Stage 1 - Repeatable') + .selectTab('Style') + + cy.getByDataTest('style-by-data-element-select').click() + + cy.getByDataTest('dhis2-uicore-singleselectoption') + .contains('E2E - Yes/no') + .click() + + cy.getByDataTest('dhis2-uicore-modalactions') + .contains('Add layer') + .click() + + Layer.validateDialogClosed(true) + + Layer.validateCardTitle('Stage 1 - Repeatable') + Layer.validateCardItems(['Yes', 'No', 'Not set']) + }) + it('shows error if no program selected', () => { Layer.openDialog('Events').addToMap() @@ -31,28 +53,6 @@ context('Event Layers', () => { Layer.validateCardItems(['Event']) }) - it('adds an event layer and applies style for boolean data element', () => { - Layer.openDialog('Events') - .selectProgram('E2E program') - .validateStage('Stage 1 - Repeatable') - .selectTab('Style') - - cy.getByDataTest('style-by-data-element-select').click() - - cy.getByDataTest('dhis2-uicore-singleselectoption') - .contains('E2E - Yes/no') - .click() - - cy.getByDataTest('dhis2-uicore-modalactions') - .contains('Add layer') - .click() - - Layer.validateDialogClosed(true) - - Layer.validateCardTitle('Stage 1 - Repeatable') - Layer.validateCardItems(['Yes', 'No', 'Not set']) - }) - it('opens an event popup', () => { Layer.openDialog('Events') .selectProgram('Inpatient morbidity and mortality') diff --git a/cypress/integration/layers/multilayers.cy.js b/cypress/integration/layers/multilayers.cy.js index 94ddf64fd..d3c4bafee 100644 --- a/cypress/integration/layers/multilayers.cy.js +++ b/cypress/integration/layers/multilayers.cy.js @@ -17,7 +17,7 @@ describe('Multiple Layers', () => { .selectIndicatorGroup('ANC') .selectIndicator(INDICATOR_NAME) .selectTab('Period') - .selectPeriodType('Yearly') + .selectPeriodType('YEARLY') .selectTab('Org Units') .selectOu('Sierra Leone') .selectOuLevel('District') diff --git a/cypress/integration/layers/telayer.cy.js b/cypress/integration/layers/telayer.cy.js index f1a41e993..f9b1025df 100644 --- a/cypress/integration/layers/telayer.cy.js +++ b/cypress/integration/layers/telayer.cy.js @@ -3,31 +3,11 @@ import { EXTENDED_TIMEOUT } from '../../support/util.js' describe('Tracked Entity Layers', () => { beforeEach(() => { - cy.visit('/', EXTENDED_TIMEOUT) + cy.visit('/') }) const Layer = new TeLayer() - it('adds a tracked entity layer', () => { - Layer.openDialog('Tracked entities') - .selectTab('Data') - .selectTeType('Malaria Entity') - .selectTeProgram( - 'Malaria case diagnosis, treatment and investigation' - ) - .selectTab('Org Units') - .selectOu('Bombali') - .selectOu('Bo') - .addToMap() - - Layer.validateDialogClosed(true) - - Layer.validateCardTitle( - 'Malaria case diagnosis, treatment and investigation' - ) - Layer.validateCardItems(['Malaria Entity']) - }) - it('opens a tracked entity layer popup', () => { Layer.openDialog('Tracked entities') .selectTab('Data') @@ -80,4 +60,24 @@ describe('Tracked Entity Layers', () => { Layer.validateCardTitle('Malaria focus investigation') Layer.validateCardItems(['Focus area']) }) + + it('adds a tracked entity layer', () => { + Layer.openDialog('Tracked entities') + .selectTab('Data') + .selectTeType('Malaria Entity') + .selectTeProgram( + 'Malaria case diagnosis, treatment and investigation' + ) + .selectTab('Org Units') + .selectOu('Bombali') + .selectOu('Bo') + .addToMap() + + Layer.validateDialogClosed(true) + + Layer.validateCardTitle( + 'Malaria case diagnosis, treatment and investigation' + ) + Layer.validateCardItems(['Malaria Entity']) + }) }) diff --git a/src/components/periods/StartEndDate.js b/src/components/periods/StartEndDate.js index 493d29d04..acbeb7924 100644 --- a/src/components/periods/StartEndDate.js +++ b/src/components/periods/StartEndDate.js @@ -138,6 +138,7 @@ const StartEndDate = (props) => { placeholder="YYYY-MM-DD" dataTest="start-date-input" strictValidation={true} + clearable={true} />