From 085d528b19eb67eb799150b3c200452dd241cc9e Mon Sep 17 00:00:00 2001 From: martinkrulltott Date: Wed, 27 Dec 2023 18:13:39 +0000 Subject: [PATCH] test: add tests for program status in TE --- cypress/integration/eventStatus.cy.js | 4 +- cypress/integration/programStatus.cy.js | 83 +++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 cypress/integration/programStatus.cy.js diff --git a/cypress/integration/eventStatus.cy.js b/cypress/integration/eventStatus.cy.js index 6ba1e1618..fe381a1ef 100644 --- a/cypress/integration/eventStatus.cy.js +++ b/cypress/integration/eventStatus.cy.js @@ -23,9 +23,7 @@ import { const currentYear = getCurrentYearStr() -// TODO: add similar tests like this but for program status in TE - -describe('event status', () => { +describe('event status (event)', () => { const event = E2E_PROGRAM const dimensionName = 'Event status' diff --git a/cypress/integration/programStatus.cy.js b/cypress/integration/programStatus.cy.js new file mode 100644 index 000000000..0528927c3 --- /dev/null +++ b/cypress/integration/programStatus.cy.js @@ -0,0 +1,83 @@ +import { + clickAddRemoveProgramDimension, + openProgramDimensionsSidebar, + selectProgramForTE, + selectTrackedEntityWithType, +} from '../helpers/dimensions.js' +import { + assertChipContainsText, + assertTooltipContainsEntries, +} from '../helpers/layout.js' +import { clickMenubarUpdateButton } from '../helpers/menubar.js' +import { goToStartPage } from '../helpers/startScreen.js' +import { + getTableHeaderCells, + expectTableToBeVisible, + expectTableToMatchRows, + getTableRows, +} from '../helpers/table.js' + +describe(['>=41'], 'program status (tracked entity)', () => { + const dimensionName = 'Program status' + + const setUpTable = () => { + goToStartPage() + + selectTrackedEntityWithType('Malaria Entity') + + openProgramDimensionsSidebar() + + selectProgramForTE( + 'Malaria case diagnosis, treatment and investigation' + ) + + clickAddRemoveProgramDimension(dimensionName) + + clickMenubarUpdateButton() + + expectTableToBeVisible() + } + + it('can be filtered by status COMPLETED', () => { + setUpTable() + + clickMenubarUpdateButton() + + expectTableToBeVisible() + + 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') + .should('be.visible') + + cy.getBySel('columns-axis') + .findBySelLike('layout-chip') + .contains(`${dimensionName}: all`) + .should('be.visible') + + // Add filter 'Completed' + + cy.getBySel('columns-axis').contains(dimensionName).click() + + cy.getBySel('program-status-checkbox') + .contains('Completed') + .click() + .find('[type="checkbox"]') + .should('be.checked') + + cy.getBySelLike('programStatus-modal-action-confirm') + .contains('Update') + .click() + + expectTableToBeVisible() + + expectTableToMatchRows(['Completed']) + + assertChipContainsText(`${dimensionName}: 1 selected`) + + assertTooltipContainsEntries(['Completed']) + }) +})