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

feat: use PeriodDimension in ThematicDialog #3407

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0ee3fad
feat: use PeriodDimension in ThematicDialog
BRaimbault Nov 18, 2024
537c0f7
Merge branch 'master' into feat/DHIS2-15796
BRaimbault Nov 18, 2024
06d6d71
feat: support multiple periods
BRaimbault Nov 19, 2024
67ff60d
fix: PeriodDimension style
BRaimbault Nov 20, 2024
7b3545a
fix: get default relative periods labels
BRaimbault Nov 25, 2024
b2be0ed
feat: use PeriodDimension in ThematicDialog
BRaimbault Dec 2, 2024
748150e
Merge branch 'master' into feat/DHIS2-15796
BRaimbault Dec 2, 2024
c224835
Merge branch 'master' into feat/DHIS2-15796
BRaimbault Dec 3, 2024
fcda751
feat: use PeriodDimension in ThematicDialog
BRaimbault Dec 3, 2024
c1c8a4a
feat: use PeriodDimension in ThematicDialog
BRaimbault Dec 4, 2024
12159df
Merge branch 'master' into feat/DHIS2-15796
BRaimbault Dec 5, 2024
68ac83b
fix: correct RenderingStrategy periods count
BRaimbault Dec 5, 2024
a4322fb
fix: use CalendarInput in StartEndDate
BRaimbault Dec 6, 2024
b80c33c
feat: handle multiple periods in timeline
BRaimbault Dec 6, 2024
dbd09ba
feat: use PeriodDimension in ThematicDialog
BRaimbault Dec 9, 2024
245848a
fix: add sumObjectValues helper and test
BRaimbault Dec 10, 2024
e744748
fix: add getPeriodsDurationByType util and test
BRaimbault Dec 10, 2024
25d9700
fix: refactor RenderingStrategy and add test
BRaimbault Dec 10, 2024
86e6f18
fix: refactor Timeline
BRaimbault Dec 10, 2024
c6c6fcf
fix: refactor Timeline
BRaimbault Dec 11, 2024
170ac85
fix: refactor Timeline
BRaimbault Dec 11, 2024
cd32b22
Merge branch 'master' into feat/DHIS2-15796
BRaimbault Dec 11, 2024
709a8ba
chore: clean-up
BRaimbault Dec 12, 2024
2d74cb0
chore: clean-up
BRaimbault Dec 12, 2024
051a9bd
fix: update periodError handling
BRaimbault Dec 12, 2024
5d7c55d
fix: handle multiple periods in interpretations
BRaimbault Dec 13, 2024
9f4ad67
fix: avoid defaulting to period tab
BRaimbault Dec 13, 2024
07dd32f
feat: add closing buttons "x"
BRaimbault Dec 13, 2024
1487d0b
feat: additional keyboard controls
BRaimbault Dec 13, 2024
aff5044
fix: timeline not visible in Firefox
BRaimbault Dec 18, 2024
c0d7028
chore: fix cypress tests
BRaimbault Dec 20, 2024
91a69bb
chore: fix cypress tests
BRaimbault Dec 20, 2024
5b09c6e
chore: cypress update
BRaimbault Dec 20, 2024
ddb7e98
chore: add useKeyDown jest test
BRaimbault Dec 23, 2024
7af9ac1
chore: add RadioGroup jest test
BRaimbault Dec 23, 2024
6756f8f
chore: fix lint error
BRaimbault Dec 23, 2024
5866c66
chore: fix jest tests
BRaimbault Dec 23, 2024
f5027c4
chore: refactor Timeline to functional component
BRaimbault Dec 24, 2024
340c227
fix: fix Timeline sorting
BRaimbault Dec 24, 2024
f6f71c9
chore: StartEndDate refactor and tests
BRaimbault Dec 27, 2024
f1f9029
chore: StartEndDate refactor
BRaimbault Dec 27, 2024
74adf06
chore: add jest test for StartEndDate
BRaimbault Dec 27, 2024
cc6ae9a
chore: constants clean-up
BRaimbault Dec 27, 2024
0213833
chore: add jest tests for util/periods.js
BRaimbault Dec 27, 2024
0ca7358
chore: add jest test for utils/analytics.js
BRaimbault Dec 27, 2024
12ac3a2
chore: update cypress tests
BRaimbault Dec 27, 2024
a059aec
chore: eventlayer cypress test fix
BRaimbault Dec 28, 2024
ca590a6
feat: backup and restore periods or dates when switching between peri…
BRaimbault Jan 9, 2025
921d99c
fix: prevent Calendar crashing when YYYY-MM-0 is typed and input is f…
BRaimbault Jan 9, 2025
3c270db
chore: update eventlayer cypress test
BRaimbault Jan 9, 2025
e241433
chore: support startDate endDate clear in Layer
BRaimbault Jan 10, 2025
af3a261
chore: fix eventlayer cypress test
BRaimbault Jan 10, 2025
ad4ad52
fix: periodError not shown on layer edit
BRaimbault Jan 10, 2025
3e6a753
fix: support hyphen typing in 5th and 8th place in StartEndDate
BRaimbault Jan 10, 2025
298371b
chore: fix lint error
BRaimbault Jan 10, 2025
98b01d8
fix: first period selection in Timeline and cypress tests
BRaimbault Jan 10, 2025
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
17 changes: 9 additions & 8 deletions cypress/elements/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Layer {
.contains(level)
.find('input')
.check()
cy.get('body').click() // Close the modal menu
cy.get('body').click()

return this
}
Expand All @@ -59,27 +59,28 @@ export class Layer {
.find('input')
.uncheck()

cy.get('body').click() // Close the modal menu
cy.get('body').click()

return this
}

typeStartDate(dateString) {
cy.get('label')
.contains('Start date')
.next()
cy.getByDataTest('calendar-clear-button').eq(0).click()
cy.getByDataTest('start-date-input-content')
.find('input')
.type(dateString)
cy.get('body').click(0, 0)

return this
}

typeEndDate(dateString) {
cy.get('label')
.contains('End date')
.next()
cy.getByDataTest('calendar-clear-button').eq(1).click()
cy.getByDataTest('end-date-input-content')
.find('input')
.type(dateString)
cy.get('body').click(0, 0)

return this
}

Expand Down
57 changes: 54 additions & 3 deletions cypress/elements/thematic_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,60 @@ export class ThematicLayer extends Layer {
return this
}

selectPeriodType(periodType) {
cy.get('[data-test="periodtypeselect"]').click()
cy.contains(periodType).click()
removeAllPeriods() {
cy.getByDataTest('period-dimension-transfer-actions-removeall').click()

return this
}

/* eslint-disable max-params */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe send an object instead of disabling max-params

selectPeriodType(
periodType,
periodDimension = 'fixed',
n = 'last',
removeAll = true
) {
cy.getByDataTest(
`period-dimension-${periodDimension}-periods-button`
).click()
cy.getByDataTest(
`period-dimension-${periodDimension}-period-filter${
periodDimension === 'fixed' ? '-period-type' : ''
}-content`
).click()
cy.get(`[data-value="${periodType}"]`).then(($el) => {
if ($el.hasClass('active')) {
cy.get('body').click('topLeft')
} else {
cy.wrap($el).click()
}
})
if (removeAll) {
cy.getByDataTest(
'period-dimension-transfer-actions-removeall'
).click()
}
if (n === 'last') {
cy.getByDataTest('period-dimension-transfer-option-content')
.last()
.dblclick()
} else {
cy.getByDataTest('period-dimension-transfer-option-content')
.eq(n)
.dblclick()
}

return this
}
/* eslint-enable max-params */

selectPresets() {
cy.contains('Choose from presets').click()

return this
}
selectStartEndDates() {
cy.contains('Define start - end dates').click()

return this
}
Expand Down
File renamed without changes.
82 changes: 64 additions & 18 deletions cypress/integration/layers/eventlayer.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
import { EventLayer } from '../../elements/event_layer.js'
import { EXTENDED_TIMEOUT } from '../../support/util.js'
import { CURRENT_YEAR, EXTENDED_TIMEOUT } from '../../support/util.js'

context('Event Layers', () => {
beforeEach(() => {
cy.visit('/', EXTENDED_TIMEOUT)
cy.visit('/')
})

const Layer = new EventLayer()

it('adds an event layer and applies style for boolean data element', () => {
Layer.openDialog('Events')
.selectProgram('E2E program')
.validateStage('Stage 1 - Repeatable')
.selectTab('Style')

cy.getByDataTest('style-by-data-element-select').click()

cy.getByDataTest('dhis2-uicore-singleselectoption')
.contains('E2E - Yes/no')
.click()

cy.getByDataTest('dhis2-uicore-modalactions')
.contains('Add layer')
.click()

Layer.validateDialogClosed(true)

Layer.validateCardTitle('Stage 1 - Repeatable')
Layer.validateCardItems(['Yes', 'No', 'Not set'])
})

it('shows error if no program selected', () => {
Layer.openDialog('Events').addToMap()

Expand All @@ -16,7 +38,24 @@ context('Event Layers', () => {
cy.contains('Program is required').should('be.visible')
})

it('adds an event layer', () => {
it('shows error if no endDate is specified', () => {
Layer.openDialog('Events')
.selectProgram('Inpatient morbidity and mortality')
.validateStage('Inpatient morbidity and mortality')
.selectTab('Period')
.selectPeriodType('Start/end dates')
.typeStartDate(`${CURRENT_YEAR - 5}-02-01`)
Copy link
Collaborator

@jenniferarnesen jenniferarnesen Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the use of the "-5" in several places I wonder if it might be informative to future us to create a test object, for example:

{
programName: 'Inpatient morbitity and mortality',
yearWithData: CURRENT_YEAR - 5
}

Maybe other properties as well?

.addToMap()

Layer.validateDialogClosed(false)
cy.contains('End date is invalid').should('be.visible')

Layer.selectTab('Period').typeEndDate('2')

cy.contains('End date is invalid').should('not.exist')
})

it('adds an event layer - relative period', () => {
Layer.openDialog('Events')
.selectProgram('Inpatient morbidity and mortality')
.validateStage('Inpatient morbidity and mortality')
Expand All @@ -31,32 +70,39 @@ context('Event Layers', () => {
Layer.validateCardItems(['Event'])
})

it('adds an event layer and applies style for boolean data element', () => {
it('adds an event layer - start-end dates', () => {
Layer.openDialog('Events')
.selectProgram('E2E program')
.validateStage('Stage 1 - Repeatable')
.selectProgram('Inpatient morbidity and mortality')
.validateStage('Inpatient morbidity and mortality')
.selectTab('Period')
.selectPeriodType('Start/end dates')
.typeStartDate(`${CURRENT_YEAR - 5}-00-00`)
.typeEndDate(`${CURRENT_YEAR}-11-30`)
.selectTab('Org Units')
.selectOu('Bombali')
.selectOu('Bo')
.selectTab('Style')

cy.getByDataTest('style-by-data-element-select').click()

cy.getByDataTest('dhis2-uicore-singleselectoption')
.contains('E2E - Yes/no')
.click()

cy.getByDataTest('dhis2-uicore-modalactions')
.contains('Add layer')
.click()
.selectViewAllEvents()
.addToMap()

Layer.validateDialogClosed(true)

Layer.validateCardTitle('Stage 1 - Repeatable')
Layer.validateCardItems(['Yes', 'No', 'Not set'])
Layer.validateCardTitle(
'Inpatient morbidity and mortality'
).validateCardPeriod(
`Jan 1, ${CURRENT_YEAR - 5} - Nov 30, ${CURRENT_YEAR}`
)
Layer.validateCardItems(['Event'])
})

it('opens an event popup', () => {
Layer.openDialog('Events')
.selectProgram('Inpatient morbidity and mortality')
.validateStage('Inpatient morbidity and mortality')
.selectTab('Period')
.selectPeriodType('Start/end dates')
.typeStartDate(`${CURRENT_YEAR - 5}-00-00`)
.typeEndDate(`${CURRENT_YEAR}-11-30`)
.selectTab('Style')
.selectViewAllEvents()
.selectTab('Org Units')
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/layers/multilayers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Multiple Layers', () => {
.selectIndicatorGroup('ANC')
.selectIndicator(INDICATOR_NAME)
.selectTab('Period')
.selectPeriodType('Yearly')
.selectPeriodType('YEARLY')
.selectTab('Org Units')
.selectOu('Sierra Leone')
.selectOuLevel('District')
Expand Down
Loading
Loading