Skip to content

Commit

Permalink
test: change item for testing dynamic dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrulltott committed Feb 23, 2024
1 parent 3b4463d commit 7970dcf
Showing 1 changed file with 12 additions and 14 deletions.
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 presisted')
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 presisted')
openDimension(TEST_DYNAMIC_DIMENSION.id)
expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id)
expectManualSelectionToBeChecked()
Expand Down

0 comments on commit 7970dcf

Please sign in to comment.