Skip to content

Commit

Permalink
test: add tests for program status in TE
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrulltott committed Dec 27, 2023
1 parent c78af4e commit 085d528
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 3 deletions.
4 changes: 1 addition & 3 deletions cypress/integration/eventStatus.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
83 changes: 83 additions & 0 deletions cypress/integration/programStatus.cy.js
Original file line number Diff line number Diff line change
@@ -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'])
})
})

0 comments on commit 085d528

Please sign in to comment.