diff --git a/cypress/helpers/menubar.js b/cypress/helpers/menubar.js index b490ea75c..452fccd37 100644 --- a/cypress/helpers/menubar.js +++ b/cypress/helpers/menubar.js @@ -20,17 +20,17 @@ export const clickMenubarOptionsButton = () => export const openDataOptionsModal = () => { clickMenubarOptionsButton() - return cy.getBySel('options-menu-list').contains('Data').click() + cy.getBySel('options-menu-list').contains('Data').click() } export const openStyleOptionsModal = () => { clickMenubarOptionsButton() - return cy.getBySel('options-menu-list').contains('Style').click() + cy.getBySel('options-menu-list').contains('Style').click() } export const openLegendOptionsModal = () => { clickMenubarOptionsButton() - return cy.getBySel('options-menu-list').contains('Legend').click() + cy.getBySel('options-menu-list').contains('Legend').click() } export const clickMenubarInterpretationsButton = () => diff --git a/cypress/integration/conditions/numericConditions.cy.js b/cypress/integration/conditions/numericConditions.cy.js index 71ea037b4..ae9f9cb36 100644 --- a/cypress/integration/conditions/numericConditions.cy.js +++ b/cypress/integration/conditions/numericConditions.cy.js @@ -247,212 +247,197 @@ describe('number conditions (event)', { testIsolation: false }, () => { }) }) -// TODO: backend issue, adding a condition throws an error, uncomment once fixed -describe.skip( - ['>=41'], - 'number conditions (TE)', - { testIsolation: false }, - () => { - const dimensionName = 'Age (years)' - - beforeEach(() => { - goToStartPage() +describe(['>=41'], 'number conditions (TE)', { testIsolation: false }, () => { + const dimensionName = 'Age (years)' - selectTrackedEntityWithType('Malaria Entity') + beforeEach(() => { + goToStartPage() - cy.getBySel('main-sidebar') - .contains('Malaria Entity dimensions') - .click() - clickAddRemoveTrackedEntityTypeDimensions(dimensionName) + selectTrackedEntityWithType('Malaria Entity') - clickMenubarUpdateButton() + cy.getBySel('main-sidebar') + .contains('Malaria Entity dimensions') + .click() + clickAddRemoveTrackedEntityTypeDimensions(dimensionName) - expectTableToBeVisible() + clickMenubarUpdateButton() - assertChipContainsText(dimensionName, 'all') - }) + expectTableToBeVisible() - it('equal to', () => { - addConditions( - [{ conditionName: 'equal to (=)', value: '15' }], - dimensionName - ) + assertChipContainsText(dimensionName, 'all') + }) - expectTableToMatchRows(['15']) + it('equal to', () => { + addConditions( + [{ conditionName: 'equal to (=)', value: '15' }], + dimensionName + ) - assertChipContainsText(dimensionName, 1) + expectTableToMatchRows(['15']) - assertTooltipContainsEntries([stageName, 'Equal to (=): 15']) - }) + assertChipContainsText(dimensionName, 1) - it('greater than', () => { - addConditions( - [{ conditionName: 'greater than (>)', value: '43' }], - dimensionName - ) + assertTooltipContainsEntries(['Equal to (=): 15']) + }) - expectTableToMatchRows(['46', '64']) + it('greater than', () => { + addConditions( + [{ conditionName: 'greater than (>)', value: '43' }], + dimensionName + ) - assertChipContainsText(dimensionName, 1) + expectTableToMatchRows(['46', '64']) - assertTooltipContainsEntries([stageName, 'Greater than (>): 43']) - }) + assertChipContainsText(dimensionName, 1) - it('greater than or equal to', () => { - addConditions( - [{ conditionName: 'greater than or equal to', value: '43' }], - dimensionName - ) - expectTableToMatchRows(['43', '46', '64']) + assertTooltipContainsEntries(['Greater than (>): 43']) + }) - assertChipContainsText(dimensionName, 1) + it('greater than or equal to', () => { + addConditions( + [{ conditionName: 'greater than or equal to', value: '43' }], + dimensionName + ) + expectTableToMatchRows(['43', '46', '64']) - assertTooltipContainsEntries([ - stageName, - 'Greater than or equal to (≥): 43', - ]) - }) + assertChipContainsText(dimensionName, 1) - it('less than', () => { - addConditions( - [{ conditionName: 'less than (<)', value: '11' }], - dimensionName - ) - - expectTableToMatchRows([ - '0', - '0', - '0', - '0', - '0', - '0', - '0', - '6', - '9', - '9', - ]) - - assertChipContainsText(dimensionName, 1) - - assertTooltipContainsEntries([stageName, 'Less than (<): 11']) - }) + assertTooltipContainsEntries(['Greater than or equal to (≥): 43']) + }) - it('less than or equal to', () => { - addConditions( - [{ conditionName: 'less than or equal to', value: '11' }], - dimensionName - ) - - expectTableToMatchRows([ - '0', - '0', - '0', - '0', - '0', - '0', - '0', - '6', - '9', - '9', - '11', - ]) - - assertChipContainsText(dimensionName, 1) - - assertTooltipContainsEntries([ - stageName, - 'Less than or equal to (≤): 11', - ]) - }) + it('less than', () => { + addConditions( + [{ conditionName: 'less than (<)', value: '11' }], + dimensionName + ) - it('not equal to', () => { - openOuDimension(DIMENSION_ID_ORGUNIT) - expectOrgUnitDimensionModalToBeVisible() - expectOrgUnitDimensionToNotBeLoading() - deselectUserOrgUnit('User organisation unit') - openOrgUnitTreeItem('Bo') - openOrgUnitTreeItem('Badjia') - selectOrgUnitTreeItem('Njandama MCHP') - clickOrgUnitDimensionModalUpdateButton() + expectTableToMatchRows([ + '0', + '0', + '0', + '0', + '0', + '0', + '0', + '6', + '9', + '9', + ]) - addConditions( - [{ conditionName: 'not equal to', value: '11' }], - dimensionName - ) + assertChipContainsText(dimensionName, 1) - expectTableToMatchRows(['0', '0', '26', '36']) + assertTooltipContainsEntries(['Less than (<): 11']) + }) - assertChipContainsText(dimensionName, 1) + it('less than or equal to', () => { + addConditions( + [{ conditionName: 'less than or equal to', value: '11' }], + dimensionName + ) - assertTooltipContainsEntries([stageName, 'Not equal to (≠): 11']) - }) + expectTableToMatchRows([ + '0', + '0', + '0', + '0', + '0', + '0', + '0', + '6', + '9', + '9', + '11', + ]) - it('is empty / null', () => { - cy.getBySel('main-sidebar') - .contains('Malaria Entity dimensions') - .click() - clickAddRemoveTrackedEntityTypeDimensions('System Case ID') + assertChipContainsText(dimensionName, 1) - addConditions([{ conditionName: 'is empty / null' }], dimensionName) + assertTooltipContainsEntries(['Less than or equal to (≤): 11']) + }) - expectTableToMatchRows(['GFS397135', 'VCA989272', 'PVZ270497']) + it('not equal to', () => { + openOuDimension(DIMENSION_ID_ORGUNIT) + expectOrgUnitDimensionModalToBeVisible() + expectOrgUnitDimensionToNotBeLoading() + deselectUserOrgUnit('User organisation unit') + openOrgUnitTreeItem('Bo') + openOrgUnitTreeItem('Badjia') + selectOrgUnitTreeItem('Njandama MCHP') + clickOrgUnitDimensionModalUpdateButton() - getTableDataCells() - .eq(1) - .invoke('text') - .invoke('trim') - .should('equal', '') + addConditions( + [{ conditionName: 'not equal to', value: '11' }], + dimensionName + ) - assertChipContainsText(dimensionName, 1) + expectTableToMatchRows(['0', '0', '26', '36']) - assertTooltipContainsEntries([stageName, 'Is empty / null']) - }) + assertChipContainsText(dimensionName, 1) - it('is not empty / not null', () => { - openOuDimension(DIMENSION_ID_ORGUNIT) - expectOrgUnitDimensionModalToBeVisible() - expectOrgUnitDimensionToNotBeLoading() - deselectUserOrgUnit('User organisation unit') - openOrgUnitTreeItem('Bo') - openOrgUnitTreeItem('Badjia') - selectOrgUnitTreeItem('Ngelehun CHC') - clickOrgUnitDimensionModalUpdateButton() + assertTooltipContainsEntries(['Not equal to (≠): 11']) + }) - getTableRows().should('have.length', 32) + it('is empty / null', () => { + clickAddRemoveTrackedEntityTypeDimensions('System Case ID') - addConditions( - [{ conditionName: 'is not empty / not null' }], - dimensionName - ) + addConditions([{ conditionName: 'is empty / null' }], dimensionName) - getTableRows().should('have.length', 29) + expectTableToMatchRows(['GFS397135', 'VCA989272', 'PVZ270497']) - assertChipContainsText(dimensionName, 1) + getTableDataCells() + .eq(1) + .invoke('text') + .invoke('trim') + .should('equal', '') - assertTooltipContainsEntries([stageName, 'Is not empty / not null']) - }) + assertChipContainsText(dimensionName, 1) - it('2 conditions: greater than + less than', () => { - addConditions( - [ - { conditionName: 'greater than (>)', value: '21' }, - { conditionName: 'less than (<)', value: '24' }, - ], - dimensionName - ) + assertTooltipContainsEntries(['Is empty / null']) + }) - expectTableToMatchRows(['23']) + it('is not empty / not null', () => { + openOuDimension(DIMENSION_ID_ORGUNIT) + expectOrgUnitDimensionModalToBeVisible() + expectOrgUnitDimensionToNotBeLoading() + deselectUserOrgUnit('User organisation unit') + openOrgUnitTreeItem('Bo') + openOrgUnitTreeItem('Badjia') + selectOrgUnitTreeItem('Ngelehun CHC') + clickOrgUnitDimensionModalUpdateButton() - assertChipContainsText(dimensionName, 2) + getTableRows().should('have.length', 32) - assertTooltipContainsEntries([ - stageName, - 'Greater than (>): 21', - 'Less than (<): 24', - ]) - }) - } -) + addConditions( + [{ conditionName: 'is not empty / not null' }], + dimensionName + ) + + getTableRows().should('have.length', 29) + + assertChipContainsText(dimensionName, 1) + + assertTooltipContainsEntries(['Is not empty / not null']) + }) + + // TODO: unskip once backend issue DHIS2-16510 is fixed + it.skip('2 conditions: greater than + less than', () => { + addConditions( + [ + { conditionName: 'greater than (>)', value: '21' }, + { conditionName: 'less than (<)', value: '24' }, + ], + dimensionName + ) + + expectTableToMatchRows(['23']) + + assertChipContainsText(dimensionName, 2) + + assertTooltipContainsEntries([ + 'Greater than (>): 21', + 'Less than (<): 24', + ]) + }) +}) /* This test doesn't look like it needs `testIsolation: false` * but start failing once this is removed */ @@ -469,7 +454,7 @@ describe('integer', { testIsolation: false }, () => { selectRelativePeriod({ label: periodLabel, - period: TEST_REL_PE_THIS_YEAR, + period: TEST_REL_PE_LAST_YEAR, }) clickMenubarUpdateButton()