Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: adapt tests to new database v38 #2984

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cypress/elements/dimensionsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const expectDimensionToNotHaveSelectedStyle = (dimensionId) =>
export const expectRecommendedIconToBeVisible = (dimensionId) =>
cy
.getBySel(getDimensionButtonById(dimensionId))
.scrollIntoView()
.findBySel(recommendedIconEl)
.should('have.length', 1)
.and('be.visible')
2 changes: 1 addition & 1 deletion cypress/integration/dimensions/data.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('Data dimension', () => {
{
name: 'Event data items',
testGroup: { name: 'Information Campaign', itemAmount: 6 },
testItem: { name: 'Diagnosis (ICD-10)' },
testItem: { name: 'E2E TE program 1 First name' },
defaultGroup: { name: 'All programs' },
endpoint: {
hasMultiplePages: true,
Expand Down
26 changes: 12 additions & 14 deletions cypress/integration/dimensions/dynamic.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,25 @@ import {
expectDimensionToHaveItemAmount,
} from '../../elements/layout.js'
import { goToStartPage } from '../../elements/startScreen.js'
import { TEST_DATA_ELEMENTS } from '../../utils/data.js'
import { getRandomArrayItem } from '../../utils/random.js'
import { expectWindowConfigSeriesToHaveLength } from '../../utils/window.js'

const TEST_DATA_ELEMENT_NAME = getRandomArrayItem(TEST_DATA_ELEMENTS).name
const TEST_DYNAMIC_DIMENSION = {
id: 'J5jldMd8OHv',
name: 'Facility type',
itemAmount: 5,
}

describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => {
it('navigates to the start page and adds a data item', () => {
it('can add and remove items, which persist after saving', () => {
cy.log('navigates to the start page and adds a data item')
goToStartPage()
openDimension(DIMENSION_ID_DATA)
selectDataElements([TEST_DATA_ELEMENT_NAME])
selectDataElements(['ANC 2nd visit'])
clickDimensionModalUpdateButton()
expectVisualizationToBeVisible(VIS_TYPE_COLUMN)
})
const TEST_ITEM = 'Hospital'
it('adds an item manually', () => {

const TEST_ITEM = 'Hospital'
cy.log('adds an item manually')
openDimension(TEST_DYNAMIC_DIMENSION.id)
expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id)
expectManualSelectionToBeChecked()
Expand All @@ -49,8 +47,8 @@ describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => {
expectVisualizationToBeVisible(VIS_TYPE_COLUMN)
expectWindowConfigSeriesToHaveLength(1)
expectDimensionToHaveItemAmount(TEST_DYNAMIC_DIMENSION.id, 1)
})
it('adds all items automatically', () => {

cy.log('adds all items automatically')
openDimension(TEST_DYNAMIC_DIMENSION.id)
expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id)
expectManualSelectionToBeChecked()
Expand All @@ -60,8 +58,8 @@ describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => {
expectVisualizationToBeVisible(VIS_TYPE_COLUMN)
expectWindowConfigSeriesToHaveLength(TEST_DYNAMIC_DIMENSION.itemAmount)
expectDimensionToHaveAllItemsSelected(TEST_DYNAMIC_DIMENSION.id)
})
it('switches back to manual and previous item is presisted', () => {

cy.log('switches back to manual and previous item is persisted')
openDimension(TEST_DYNAMIC_DIMENSION.id)
expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id)
expectAutomaticSelectionToBeChecked()
Expand All @@ -72,8 +70,8 @@ describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => {
expectVisualizationToBeVisible(VIS_TYPE_COLUMN)
expectWindowConfigSeriesToHaveLength(1)
expectDimensionToHaveItemAmount(TEST_DYNAMIC_DIMENSION.id, 1)
})
it('switches back to automatic, saving, the selection is presisted', () => {

cy.log('switches back to automatic, saving, the selection is persisted')
openDimension(TEST_DYNAMIC_DIMENSION.id)
expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id)
expectManualSelectionToBeChecked()
Expand Down
Loading