diff --git a/cypress/helpers/orgUnit.js b/cypress/helpers/orgUnit.js index aa2a7bf7b..d20c2783a 100644 --- a/cypress/helpers/orgUnit.js +++ b/cypress/helpers/orgUnit.js @@ -1,6 +1,6 @@ import { EXTENDED_TIMEOUT } from '../support/util.js' -const orgUnitModalEl = 'fixed-dimension-ou-modal' +const orgUnitModalEl = 'ou-modal' const levelSelectEl = 'org-unit-level-select' const levelSelectOptionEl = 'org-unit-level-select-option' const groupSelectEl = 'org-unit-group-select' @@ -12,12 +12,12 @@ const orgUnitTreeNodeSelectEl = '[type="checkbox"]' const orgUnitTreeNodeToggleEl = 'org-unit-tree-node-toggle' export const clickOrgUnitDimensionModalUpdateButton = () => - cy.getBySel(`${orgUnitModalEl}-action-confirm`).click() + cy.getBySelLike(`${orgUnitModalEl}-action-confirm`).click() export const openOuDimension = () => cy.getBySelLike('layout-chip-ou').click() export const expectOrgUnitDimensionModalToBeVisible = () => - cy.getBySel(orgUnitModalEl).should('be.visible') + cy.getBySelLike(orgUnitModalEl).should('be.visible') export const expectOrgUnitDimensionToNotBeLoading = () => cy @@ -84,24 +84,24 @@ export const toggleOrgUnitGroup = (name) => { } export const selectUserOrgUnit = (name) => { - cy.getBySel(orgUnitModalEl) + cy.getBySelLike(orgUnitModalEl) .contains(name) .find('[type="checkbox"]') .should('not.be.checked') - cy.getBySel(orgUnitModalEl).contains(name).click() - cy.getBySel(orgUnitModalEl) + cy.getBySelLike(orgUnitModalEl).contains(name).click() + cy.getBySelLike(orgUnitModalEl) .contains(name) .find('[type="checkbox"]') .should('be.checked') } export const deselectUserOrgUnit = (name) => { - cy.getBySel(orgUnitModalEl) + cy.getBySelLike(orgUnitModalEl) .contains(name) .find('[type="checkbox"]') .should('be.checked') - cy.getBySel(orgUnitModalEl).contains(name).click() - cy.getBySel(orgUnitModalEl) + cy.getBySelLike(orgUnitModalEl).contains(name).click() + cy.getBySelLike(orgUnitModalEl) .contains(name) .find('[type="checkbox"]') .should('not.be.checked') diff --git a/cypress/integration/repeatedEvents.cy.js b/cypress/integration/repeatedEvents.cy.js index 41ab42acc..ea782610a 100644 --- a/cypress/integration/repeatedEvents.cy.js +++ b/cypress/integration/repeatedEvents.cy.js @@ -6,6 +6,7 @@ import { E2E_PROGRAM, TEST_REL_PE_LAST_YEAR } from '../data/index.js' import { goToAO } from '../helpers/common.js' import { clickAddRemoveProgramDataDimension, + clickAddRemoveProgramDimension, openDimension, openInputSidebar, openProgramDimensionsSidebar, @@ -18,6 +19,13 @@ import { } from '../helpers/dimensions.js' import { assertChipContainsText } from '../helpers/layout.js' import { clickMenubarUpdateButton } from '../helpers/menubar.js' +import { + clickOrgUnitDimensionModalUpdateButton, + expectOrgUnitDimensionModalToBeVisible, + expectOrgUnitDimensionToNotBeLoading, + openOrgUnitTreeItem, + selectOrgUnitTreeItem, +} from '../helpers/orgUnit.js' import { selectRelativePeriod } from '../helpers/period.js' import { goToStartPage } from '../helpers/startScreen.js' import { @@ -176,8 +184,7 @@ describe('repeated events', () => { // no repetition in header expectHeaderToContainExact(0, dimensionName) }) - // TODO: blocked by backend issues DHIS2-16886 and DHIS2-16709 - it.skip('can use repetition for TE', () => { + it('can use repetition for TE', () => { // switch to Tracked entity and select a type selectTrackedEntityWithType('Person') @@ -190,12 +197,29 @@ describe('repeated events', () => { clickAddRemoveProgramDataDimension(dimensionName) + // remove reg ou cy.getBySel('columns-axis') .findBySel('dimension-menu-button-ou') .click() + cy.contains('Remove').click() + + // add program ou + clickAddRemoveProgramDimension('Organisation unit') + + // move program ou to filter + cy.getBySel('columns-axis') + .findBySel('dimension-menu-button-J1QQtmzqhJz.ou') + .click() cy.contains('Move to Filter').click() - clickMenubarUpdateButton() + // filter program ou to Badjia + cy.getBySel('filters-axis').contains('Organisation unit').click() + expectOrgUnitDimensionModalToBeVisible() + expectOrgUnitDimensionToNotBeLoading() + openOrgUnitTreeItem('Bo') + openOrgUnitTreeItem('Badjia') + selectOrgUnitTreeItem('Njandama MCHP') + clickOrgUnitDimensionModalUpdateButton() expectTableToBeVisible() @@ -204,7 +228,6 @@ describe('repeated events', () => { // initially only has 1 column and 1 row getTableHeaderCells().its('length').should('equal', 1) getTableHeaderCells().eq(0).containsExact(dimensionName) - // TODO: everything below this is untested and needs to be updated to reflect the values that the backend actually returns getTableDataCells().eq(0).invoke('text').should('eq', '46') expectRepetitionToBe({ dimensionName, recent: 1, oldest: 0 }) @@ -260,25 +283,6 @@ describe('repeated events', () => { 3, 'E2E - Percentage, Stage 1 - Repeatable (most recent)' ) - - // switch back to event, check that repetition is cleared - openInputSidebar() - selectEventWithProgramDimensions({ - ...E2E_PROGRAM, - dimensions: [dimensionName], - }) - - selectRelativePeriod({ - label: E2E_PROGRAM[DIMENSION_ID_EVENT_DATE], - period: TEST_REL_PE_LAST_YEAR, - }) - - clickMenubarUpdateButton() - - expectTableToBeVisible() - - // no repetition in header - expectHeaderToContainExact(0, dimensionName) }) it('repetition out of bounds returns as empty value', () => { const dimensionName = 'E2E - Percentage'