Skip to content

Commit

Permalink
Merge branch 'fix/use-raw-dim-id-in-PeriodDimension' of github.com:dh…
Browse files Browse the repository at this point in the history
…is2/line-listing-app into fix/use-raw-dim-id-in-PeriodDimension
  • Loading branch information
jenniferarnesen committed Feb 2, 2024
2 parents c154b85 + 3a9d948 commit 524f4d6
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 171 deletions.
6 changes: 3 additions & 3 deletions cypress/helpers/menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export const clickMenubarOptionsButton = () =>

export const openDataOptionsModal = () => {
clickMenubarOptionsButton()
return cy.getBySel('options-menu-list').contains('Data').click()
cy.getBySel('options-menu-list').contains('Data').click()
}

export const openStyleOptionsModal = () => {
clickMenubarOptionsButton()
return cy.getBySel('options-menu-list').contains('Style').click()
cy.getBySel('options-menu-list').contains('Style').click()
}

export const openLegendOptionsModal = () => {
clickMenubarOptionsButton()
return cy.getBySel('options-menu-list').contains('Legend').click()
cy.getBySel('options-menu-list').contains('Legend').click()
}

export const clickMenubarInterpretationsButton = () =>
Expand Down
321 changes: 153 additions & 168 deletions cypress/integration/conditions/numericConditions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,212 +247,197 @@ describe('number conditions (event)', { testIsolation: false }, () => {
})
})

// TODO: backend issue, adding a condition throws an error, uncomment once fixed
describe.skip(
['>=41'],
'number conditions (TE)',
{ testIsolation: false },
() => {
const dimensionName = 'Age (years)'

beforeEach(() => {
goToStartPage()
describe(['>=41'], 'number conditions (TE)', { testIsolation: false }, () => {
const dimensionName = 'Age (years)'

selectTrackedEntityWithType('Malaria Entity')
beforeEach(() => {
goToStartPage()

cy.getBySel('main-sidebar')
.contains('Malaria Entity dimensions')
.click()
clickAddRemoveTrackedEntityTypeDimensions(dimensionName)
selectTrackedEntityWithType('Malaria Entity')

clickMenubarUpdateButton()
cy.getBySel('main-sidebar')
.contains('Malaria Entity dimensions')
.click()
clickAddRemoveTrackedEntityTypeDimensions(dimensionName)

expectTableToBeVisible()
clickMenubarUpdateButton()

assertChipContainsText(dimensionName, 'all')
})
expectTableToBeVisible()

it('equal to', () => {
addConditions(
[{ conditionName: 'equal to (=)', value: '15' }],
dimensionName
)
assertChipContainsText(dimensionName, 'all')
})

expectTableToMatchRows(['15'])
it('equal to', () => {
addConditions(
[{ conditionName: 'equal to (=)', value: '15' }],
dimensionName
)

assertChipContainsText(dimensionName, 1)
expectTableToMatchRows(['15'])

assertTooltipContainsEntries([stageName, 'Equal to (=): 15'])
})
assertChipContainsText(dimensionName, 1)

it('greater than', () => {
addConditions(
[{ conditionName: 'greater than (>)', value: '43' }],
dimensionName
)
assertTooltipContainsEntries(['Equal to (=): 15'])
})

expectTableToMatchRows(['46', '64'])
it('greater than', () => {
addConditions(
[{ conditionName: 'greater than (>)', value: '43' }],
dimensionName
)

assertChipContainsText(dimensionName, 1)
expectTableToMatchRows(['46', '64'])

assertTooltipContainsEntries([stageName, 'Greater than (>): 43'])
})
assertChipContainsText(dimensionName, 1)

it('greater than or equal to', () => {
addConditions(
[{ conditionName: 'greater than or equal to', value: '43' }],
dimensionName
)
expectTableToMatchRows(['43', '46', '64'])
assertTooltipContainsEntries(['Greater than (>): 43'])
})

assertChipContainsText(dimensionName, 1)
it('greater than or equal to', () => {
addConditions(
[{ conditionName: 'greater than or equal to', value: '43' }],
dimensionName
)
expectTableToMatchRows(['43', '46', '64'])

assertTooltipContainsEntries([
stageName,
'Greater than or equal to (≥): 43',
])
})
assertChipContainsText(dimensionName, 1)

it('less than', () => {
addConditions(
[{ conditionName: 'less than (<)', value: '11' }],
dimensionName
)

expectTableToMatchRows([
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'6',
'9',
'9',
])

assertChipContainsText(dimensionName, 1)

assertTooltipContainsEntries([stageName, 'Less than (<): 11'])
})
assertTooltipContainsEntries(['Greater than or equal to (≥): 43'])
})

it('less than or equal to', () => {
addConditions(
[{ conditionName: 'less than or equal to', value: '11' }],
dimensionName
)

expectTableToMatchRows([
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'6',
'9',
'9',
'11',
])

assertChipContainsText(dimensionName, 1)

assertTooltipContainsEntries([
stageName,
'Less than or equal to (≤): 11',
])
})
it('less than', () => {
addConditions(
[{ conditionName: 'less than (<)', value: '11' }],
dimensionName
)

it('not equal to', () => {
openOuDimension(DIMENSION_ID_ORGUNIT)
expectOrgUnitDimensionModalToBeVisible()
expectOrgUnitDimensionToNotBeLoading()
deselectUserOrgUnit('User organisation unit')
openOrgUnitTreeItem('Bo')
openOrgUnitTreeItem('Badjia')
selectOrgUnitTreeItem('Njandama MCHP')
clickOrgUnitDimensionModalUpdateButton()
expectTableToMatchRows([
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'6',
'9',
'9',
])

addConditions(
[{ conditionName: 'not equal to', value: '11' }],
dimensionName
)
assertChipContainsText(dimensionName, 1)

expectTableToMatchRows(['0', '0', '26', '36'])
assertTooltipContainsEntries(['Less than (<): 11'])
})

assertChipContainsText(dimensionName, 1)
it('less than or equal to', () => {
addConditions(
[{ conditionName: 'less than or equal to', value: '11' }],
dimensionName
)

assertTooltipContainsEntries([stageName, 'Not equal to (≠): 11'])
})
expectTableToMatchRows([
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'6',
'9',
'9',
'11',
])

it('is empty / null', () => {
cy.getBySel('main-sidebar')
.contains('Malaria Entity dimensions')
.click()
clickAddRemoveTrackedEntityTypeDimensions('System Case ID')
assertChipContainsText(dimensionName, 1)

addConditions([{ conditionName: 'is empty / null' }], dimensionName)
assertTooltipContainsEntries(['Less than or equal to (≤): 11'])
})

expectTableToMatchRows(['GFS397135', 'VCA989272', 'PVZ270497'])
it('not equal to', () => {
openOuDimension(DIMENSION_ID_ORGUNIT)
expectOrgUnitDimensionModalToBeVisible()
expectOrgUnitDimensionToNotBeLoading()
deselectUserOrgUnit('User organisation unit')
openOrgUnitTreeItem('Bo')
openOrgUnitTreeItem('Badjia')
selectOrgUnitTreeItem('Njandama MCHP')
clickOrgUnitDimensionModalUpdateButton()

getTableDataCells()
.eq(1)
.invoke('text')
.invoke('trim')
.should('equal', '')
addConditions(
[{ conditionName: 'not equal to', value: '11' }],
dimensionName
)

assertChipContainsText(dimensionName, 1)
expectTableToMatchRows(['0', '0', '26', '36'])

assertTooltipContainsEntries([stageName, 'Is empty / null'])
})
assertChipContainsText(dimensionName, 1)

it('is not empty / not null', () => {
openOuDimension(DIMENSION_ID_ORGUNIT)
expectOrgUnitDimensionModalToBeVisible()
expectOrgUnitDimensionToNotBeLoading()
deselectUserOrgUnit('User organisation unit')
openOrgUnitTreeItem('Bo')
openOrgUnitTreeItem('Badjia')
selectOrgUnitTreeItem('Ngelehun CHC')
clickOrgUnitDimensionModalUpdateButton()
assertTooltipContainsEntries(['Not equal to (≠): 11'])
})

getTableRows().should('have.length', 32)
it('is empty / null', () => {
clickAddRemoveTrackedEntityTypeDimensions('System Case ID')

addConditions(
[{ conditionName: 'is not empty / not null' }],
dimensionName
)
addConditions([{ conditionName: 'is empty / null' }], dimensionName)

getTableRows().should('have.length', 29)
expectTableToMatchRows(['GFS397135', 'VCA989272', 'PVZ270497'])

assertChipContainsText(dimensionName, 1)
getTableDataCells()
.eq(1)
.invoke('text')
.invoke('trim')
.should('equal', '')

assertTooltipContainsEntries([stageName, 'Is not empty / not null'])
})
assertChipContainsText(dimensionName, 1)

it('2 conditions: greater than + less than', () => {
addConditions(
[
{ conditionName: 'greater than (>)', value: '21' },
{ conditionName: 'less than (<)', value: '24' },
],
dimensionName
)
assertTooltipContainsEntries(['Is empty / null'])
})

expectTableToMatchRows(['23'])
it('is not empty / not null', () => {
openOuDimension(DIMENSION_ID_ORGUNIT)
expectOrgUnitDimensionModalToBeVisible()
expectOrgUnitDimensionToNotBeLoading()
deselectUserOrgUnit('User organisation unit')
openOrgUnitTreeItem('Bo')
openOrgUnitTreeItem('Badjia')
selectOrgUnitTreeItem('Ngelehun CHC')
clickOrgUnitDimensionModalUpdateButton()

assertChipContainsText(dimensionName, 2)
getTableRows().should('have.length', 32)

assertTooltipContainsEntries([
stageName,
'Greater than (>): 21',
'Less than (<): 24',
])
})
}
)
addConditions(
[{ conditionName: 'is not empty / not null' }],
dimensionName
)

getTableRows().should('have.length', 29)

assertChipContainsText(dimensionName, 1)

assertTooltipContainsEntries(['Is not empty / not null'])
})

// TODO: unskip once backend issue DHIS2-16510 is fixed
it.skip('2 conditions: greater than + less than', () => {
addConditions(
[
{ conditionName: 'greater than (>)', value: '21' },
{ conditionName: 'less than (<)', value: '24' },
],
dimensionName
)

expectTableToMatchRows(['23'])

assertChipContainsText(dimensionName, 2)

assertTooltipContainsEntries([
'Greater than (>): 21',
'Less than (<): 24',
])
})
})

/* This test doesn't look like it needs `testIsolation: false`
* but start failing once this is removed */
Expand All @@ -469,7 +454,7 @@ describe('integer', { testIsolation: false }, () => {

selectRelativePeriod({
label: periodLabel,
period: TEST_REL_PE_THIS_YEAR,
period: TEST_REL_PE_LAST_YEAR,
})

clickMenubarUpdateButton()
Expand Down

0 comments on commit 524f4d6

Please sign in to comment.