diff --git a/cypress/helpers/layout.js b/cypress/helpers/layout.js index 9b0c4d4f4..4bf160bfd 100644 --- a/cypress/helpers/layout.js +++ b/cypress/helpers/layout.js @@ -27,21 +27,29 @@ export const expectAxisToNotHaveDimension = (axisId, dimensionId) => { export const assertTooltipContainsEntries = (entries) => entries.forEach((entry) => cy.getBySel('tooltip-content').contains(entry)) -export const assertChipContainsText = (dimensionName, suffix) => { - if (suffix) { +export const assertChipContainsText = (primary, items, secondary) => { + if (items) { cy.getBySelLike('layout-chip') - .containsExact(dimensionName, EXTENDED_TIMEOUT) + .containsExact(primary, EXTENDED_TIMEOUT) + .parent() .parent() .findBySelLike('chip-items') - .contains(suffix, EXTENDED_TIMEOUT) + .contains(items, EXTENDED_TIMEOUT) } else { cy.getBySelLike('layout-chip') - .containsExact(dimensionName, EXTENDED_TIMEOUT) + .containsExact(primary, EXTENDED_TIMEOUT) + .parent() .parent() .findBySelLike('chip-items') .should('not.exist') } + if (secondary) { + cy.getBySelLike('layout-chip').containsExact( + secondary, + EXTENDED_TIMEOUT + ) + } cy.getBySelLike('layout-chip') - .containsExact(dimensionName, EXTENDED_TIMEOUT) + .containsExact(primary, EXTENDED_TIMEOUT) .trigger('mouseover') } diff --git a/cypress/integration/programStatus.cy.js b/cypress/integration/programStatus.cy.js index c46560e94..7e5a0067f 100644 --- a/cypress/integration/programStatus.cy.js +++ b/cypress/integration/programStatus.cy.js @@ -18,20 +18,16 @@ import { } from '../helpers/table.js' describe(['>=41'], 'program status (TE)', () => { - const dimensionName = 'Program status' - const setUpTable = () => { goToStartPage() - selectTrackedEntityWithType('Malaria Entity') + selectTrackedEntityWithType('Person') openProgramDimensionsSidebar() - selectProgramForTE( - 'Malaria case diagnosis, treatment and investigation' - ) + selectProgramForTE('Child Programme') - clickAddRemoveProgramDimension(dimensionName) + clickAddRemoveProgramDimension('Program status') clickMenubarUpdateButton() @@ -47,17 +43,15 @@ describe(['>=41'], 'program status (TE)', () => { getTableRows().its('length').should('be.gte', 10) - // getTableHeaderCells().contains(dimensionName).should('be.visible') - // Backend issue, once resolved change back to the line above getTableHeaderCells() - .contains('Enrollment PROGRAM_STATUS') + .contains('Program status, Child Programme') .should('be.visible') - assertChipContainsText(dimensionName, 'all') + assertChipContainsText('Program status', 'all', 'Child Programme') // Add filter 'Completed' - cy.getBySel('columns-axis').contains(dimensionName).click() + cy.getBySel('columns-axis').contains('Program status').click() cy.getBySel('program-status-checkbox') .contains('Completed') @@ -71,9 +65,14 @@ describe(['>=41'], 'program status (TE)', () => { expectTableToBeVisible() - expectTableToMatchRows(['Completed']) + expectTableToMatchRows([ + 'Completed', + 'Completed', + 'Completed', + 'Completed', + ]) - assertChipContainsText(dimensionName, 1) + assertChipContainsText('Program status', 1, 'Child Programme') assertTooltipContainsEntries(['Completed']) })