-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for program status in TE
- Loading branch information
1 parent
c78af4e
commit 085d528
Showing
2 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) | ||
}) | ||
}) |