Skip to content

Commit

Permalink
Merge branch 'dev' into demo-reportportal-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrulltott authored Oct 13, 2023
2 parents c9c74e4 + d4d634e commit 6698c65
Show file tree
Hide file tree
Showing 26 changed files with 472 additions and 120 deletions.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ _text_

### TODO

- [ ] Cypress tests
- [ ] Update docs
- [ ] Manual testing
- [ ] _task_

---
Expand Down
1 change: 1 addition & 0 deletions cypress/elements/dimensionModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const expectSourceToNotBeLoading = () =>
.findBySelLike(transferLoadingEl)
.should('not.exist')

// FIXME: unused, remove?
export const expectSourceToBeLoading = () =>
cy
.getBySelLike(transferLeftContainerEl)
Expand Down
12 changes: 12 additions & 0 deletions cypress/elements/optionsModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const OPTIONS_TAB_AXES = 'Axes'
export const OPTIONS_TAB_OUTLIERS = 'Outliers'
export const OPTIONS_TAB_SERIES = 'Series'
export const OPTIONS_TAB_LEGEND = 'Legend'
export const OPTIONS_TAB_LIMIT_VALUES = 'Limit values'

export const clickOptionsTab = (name) =>
cy.getBySel(tabBarEl).contains(name).click()
Expand Down Expand Up @@ -89,3 +90,14 @@ export {
expectLegendKeyToBeVisible,
expectLegedKeyItemAmountToBe,
} from './legend.js'

export {
setMinValue,
setMaxValue,
changeMinOperator,
changeMaxOperator,
expectMinValueToBeValue,
expectMaxValueToBeValue,
expectMinOperatorToBeOption,
expectMaxOperatorToBeOption,
} from './limitValues.js'
7 changes: 2 additions & 5 deletions cypress/elements/optionsModal/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ export const toggleLegend = () =>
.click()

export const changeDisplayStrategyToFixed = () =>
cy
.getBySel(optionsModalContentEl)
.contains('Select a single legend for the entire visualization')
.click()
cy.getBySel(optionsModalContentEl).contains('Select a legend').click()

export const changeDisplayStrategyToByDataItem = () =>
cy
.getBySel(optionsModalContentEl)
.contains('Use pre-defined legend per data item')
.contains('Use pre-defined legend by data item')
.click()

export const changeDisplayStyleToText = () =>
Expand Down
34 changes: 34 additions & 0 deletions cypress/elements/optionsModal/limitValues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { typeInput } from '../common.js'

const minValueInput = 'measure-critiera-min-value'
const maxValueInput = 'measure-critiera-max-value'
const minOperatorSelect = 'measure-critiera-min-operator'
const minOperatorSelectOption = 'measure-critiera-min-operator-option'
const maxOperatorSelect = 'measure-critiera-max-operator'
const maxOperatorSelectOption = 'measure-critiera-max-operator-option'

export const setMinValue = (text) => typeInput(minValueInput, text)

export const setMaxValue = (text) => typeInput(maxValueInput, text)

export const changeMinOperator = (optionName) => {
cy.getBySel(minOperatorSelect).click()
cy.getBySelLike(minOperatorSelectOption).contains(optionName).click()
}

export const changeMaxOperator = (optionName) => {
cy.getBySel(maxOperatorSelect).click()
cy.getBySelLike(maxOperatorSelectOption).contains(optionName).click()
}

export const expectMinValueToBeValue = (value) =>
cy.getBySel(minValueInput).find('input').should('have.value', value)

export const expectMaxValueToBeValue = (value) =>
cy.getBySel(maxValueInput).find('input').should('have.value', value)

export const expectMinOperatorToBeOption = (optionName) =>
cy.getBySel(minOperatorSelect).containsExact(optionName)

export const expectMaxOperatorToBeOption = (optionName) =>
cy.getBySel(maxOperatorSelect).containsExact(optionName)
2 changes: 0 additions & 2 deletions cypress/integration/dimensions/data.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
expectSubGroupSelectToBeVisible,
expectSubGroupSelectToBe,
switchSubGroupTo,
expectSourceToBeLoading,
expectSourceToNotBeLoading,
unselectAllItemsByButton,
selectAllItemsByButton,
Expand Down Expand Up @@ -439,7 +438,6 @@ describe('Data dimension', () => {
cy.intercept('GET', DATA_ITEMS_URL).as('**/dataItems*')
}
switchDataTypeToAll()
expectSourceToBeLoading()
cy.wait('@**/dataItems*').then(({ request, response }) => {
expect(request.url).to.contain('page=1')
expect(response.statusCode).to.eq(200)
Expand Down
260 changes: 260 additions & 0 deletions cypress/integration/options/limitValues.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
import {
DIMENSION_ID_DATA,
DIMENSION_ID_PERIOD,
VIS_TYPE_PIVOT_TABLE,
visTypeDisplayNames,
} from '@dhis2/analytics'
import { expectVisualizationToBeVisible } from '../../elements/chart.js'
import { expectAppToNotBeLoading } from '../../elements/common.js'
import {
selectIndicators,
clickDimensionModalUpdateButton,
unselectAllItemsByButton,
selectFixedPeriods,
} from '../../elements/dimensionModal/index.js'
import { openDimension } from '../../elements/dimensionsPanel.js'
import {
createNewAO,
deleteAO,
saveNewAO,
} from '../../elements/fileMenu/index.js'
import { openOptionsModal } from '../../elements/menuBar.js'
import {
OPTIONS_TAB_LIMIT_VALUES,
changeMaxOperator,
changeMinOperator,
clickOptionsModalHideButton,
clickOptionsModalUpdateButton,
expectMaxOperatorToBeOption,
expectMaxValueToBeValue,
expectMinOperatorToBeOption,
expectMinValueToBeValue,
setMaxValue,
setMinValue,
} from '../../elements/optionsModal/index.js'
import {
expectStartScreenToBeVisible,
goToStartPage,
} from '../../elements/startScreen.js'
import { changeVisType } from '../../elements/visualizationTypeSelector.js'

const TEST_INDICATOR = 'ANC visits total'
const currentYear = new Date().getFullYear().toString()
const expectTableValueToBe = (value, position) =>
cy
.getBySel('visualization-container')
.find('tbody')
.find('tr')
.eq(position)
.find('td')
.invoke('text')
.invoke('trim')
.should('equal', value)

describe('limit values', () => {
beforeEach(() => {
goToStartPage()
createNewAO()
changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE])
openDimension(DIMENSION_ID_DATA)
selectIndicators([TEST_INDICATOR])
clickDimensionModalUpdateButton()
openDimension(DIMENSION_ID_PERIOD)
unselectAllItemsByButton()
selectFixedPeriods(
[
`January ${currentYear}`,
`February ${currentYear}`,
`March ${currentYear}`,
`April ${currentYear}`,
`May ${currentYear}`,
],
'Monthly'
)
clickDimensionModalUpdateButton()
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)

const expectedValues = [
'49 231',
'49 605',
'49 500',
'55 385',
'68 886',
]
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('')
expectMaxValueToBeValue('')
})
it('min and max value display correctly', () => {
// set limits
changeMinOperator('>=')
changeMaxOperator('<=')
setMinValue('49500')
setMaxValue('55385')
clickOptionsModalUpdateButton()

// verify limits are applied
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
const expectedValues = ['', '49 605', '49 500', '55 385', '']
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('49500')
expectMaxValueToBeValue('55385')
clickOptionsModalHideButton()

// save AO, verify limits are applied
saveNewAO(`TEST min max ${new Date().toLocaleString()}`)
expectAppToNotBeLoading()
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('49500')
expectMaxValueToBeValue('55385')
clickOptionsModalHideButton()

// clean up
deleteAO()
expectStartScreenToBeVisible()
})
it('min value only display correctly', () => {
// set limits
changeMinOperator('>=')
setMinValue('49500')
clickOptionsModalUpdateButton()

// verify limits are applied
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
const expectedValues = ['', '49 605', '49 500', '55 385', '68 886']
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
expectMaxValueToBeValue('')
clickOptionsModalHideButton()

// save AO, verify limits are applied
saveNewAO(`TEST min max ${new Date().toLocaleString()}`)
expectAppToNotBeLoading()
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
expectMaxValueToBeValue('')
clickOptionsModalHideButton()

// clean up
deleteAO()
expectStartScreenToBeVisible()
})
it('max value only display correctly', () => {
// set limits
changeMaxOperator('<=')
setMaxValue('55385')
clickOptionsModalUpdateButton()

// verify limits are applied
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
const expectedValues = ['49 231', '49 605', '49 500', '55 385', '']
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('')
expectMaxValueToBeValue('55385')
clickOptionsModalHideButton()

// save AO, verify limits are applied
saveNewAO(`TEST min max ${new Date().toLocaleString()}`)
expectAppToNotBeLoading()
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('')
expectMaxValueToBeValue('55385')
clickOptionsModalHideButton()

// clean up
deleteAO()
expectStartScreenToBeVisible()
})
it('equal value display correctly', () => {
// set limits
changeMinOperator('=')
setMinValue('49500')
clickOptionsModalUpdateButton()

// verify limits are applied
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
const expectedValues = ['', '', '49 500', '', '']
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
expectMaxValueToBeValue('')
clickOptionsModalHideButton()

// save AO, verify limits are applied
saveNewAO(`TEST min max ${new Date().toLocaleString()}`)
expectAppToNotBeLoading()
expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE)
expectedValues.forEach((value, index) =>
expectTableValueToBe(value, index)
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
expectMaxValueToBeValue('')
clickOptionsModalHideButton()

// clean up
deleteAO()
expectStartScreenToBeVisible()
})
})
10 changes: 5 additions & 5 deletions i18n/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2023-05-30T12:32:59.044Z\n"
"POT-Creation-Date: 2023-09-06T13:41:14.540Z\n"
"PO-Revision-Date: 2019-06-25 18:46+0000\n"
"Last-Translator: Viktor Varland <[email protected]>, 2022\n"
"Language-Team: Arabic (https://app.transifex.com/hisp-uio/teams/100509/ar/)\n"
Expand Down Expand Up @@ -485,11 +485,11 @@ msgstr "نمط وسيلة الإيضاح"
msgid "Legend type"
msgstr "نوع مفتاح الخريطة"

msgid "Use pre-defined legend per data item"
msgstr "استخدم مفتاح إيضاح معرف مسبقاً لكل عنصر بيانات"
msgid "Use pre-defined legend by data item"
msgstr ""

msgid "Select a single legend for the entire visualization"
msgstr "حدد مفتاح إيضاحي واحد للمخطط بالكامل"
msgid "Select a legend"
msgstr ""

msgid "Legend changes background color"
msgstr "المفتاح الإيضاحي يغير من لون الخلفية"
Expand Down
Loading

0 comments on commit 6698c65

Please sign in to comment.