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: event/enrollment ui changes to prepare for TEI cross-program support (DHIS2-15454) #415

Merged
merged 60 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
58ceb73
fix: filter programs by data access
martinkrulltott Jul 4, 2023
4dacda0
Merge branch 'master' into fix/DHIS2-15530-filter-programs
martinkrulltott Jul 5, 2023
49f05dc
Merge branch 'master' into fix/DHIS2-15530-filter-programs
martinkrulltott Jul 7, 2023
cc5051c
feat: move dimensions to new locations
martinkrulltott Jul 12, 2023
bd58546
feat: open input tab by default
martinkrulltott Jul 13, 2023
4a803ce
feat: new search placeholder
martinkrulltott Jul 13, 2023
f39ab81
feat: display selected program as subtitle
martinkrulltott Jul 13, 2023
4dff576
feat: move program and stage selection to the input section
martinkrulltott Jul 14, 2023
b08e6b9
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Aug 7, 2023
74c174a
chore: whitespace change to trigger redeploy
martinkrulltott Aug 9, 2023
93baa5f
fix: add prefix and margin to stage select
martinkrulltott Aug 9, 2023
8ce97cf
Merge branch 'master' into fix/DHIS2-15530-filter-programs
janhenrikoverland Aug 9, 2023
275734e
fix: display stage name in sidebar subtitle
martinkrulltott Aug 9, 2023
e4aeaae
chore: update PR template
martinkrulltott Aug 9, 2023
6cf333b
fix: auto-select first stage in list
martinkrulltott Aug 9, 2023
463e553
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Aug 10, 2023
49928ba
fix: disable user select in input sidebar
martinkrulltott Aug 14, 2023
c4309f0
fix: change error message description
martinkrulltott Aug 14, 2023
18bf1d4
fix: disable program dims when no program is selected
martinkrulltott Aug 14, 2023
e78096c
fix: prevent sidebar from opening empty
martinkrulltott Aug 14, 2023
69fea4a
chore: en.pot from prev commit
martinkrulltott Aug 14, 2023
e02dfa6
fix: move acc panel tab to redux to show input tab on file -> new
martinkrulltott Aug 14, 2023
c301f91
fix: filter your dimensions to only show ORGANISATION_UNIT_GROUP_SET
martinkrulltott Aug 15, 2023
d9cd99c
chore: add a TODO comment for the prev commit
martinkrulltott Aug 15, 2023
535a36d
fix: update clear logic, input/program - 'big clear', stage - 'small …
martinkrulltott Aug 15, 2023
d7a8800
refactor: remove code related to main (now global) dimensions being d…
martinkrulltott Aug 16, 2023
65a447b
test: remove lastUpdated from the list of time dimensions (now a 'glo…
martinkrulltott Aug 16, 2023
ebb71d5
test: uncomment unit tests for schedule date
martinkrulltott Aug 16, 2023
9c9b7e2
test: first batch of Cypress updates to facilitate the new ui (WIP)
martinkrulltott Aug 16, 2023
fc2e90d
test: second batch of Cypress updates to facilitate the new ui (WIP)
martinkrulltott Aug 16, 2023
6ad0655
test: update table.cy.js tests to facilitate the new ui
martinkrulltott Aug 16, 2023
ff59c28
test: update fileMenu.cy.js tests to facilitate the new ui
martinkrulltott Aug 16, 2023
b8d2c24
chore: remove the temp fix for your dimensions as backend is working …
martinkrulltott Aug 16, 2023
3668008
refactor: remove code related to time dimensions being disabled
martinkrulltott Aug 16, 2023
187a440
test: update time dimension tests to facilitate the new ui
martinkrulltott Aug 16, 2023
b44cc83
fix: re-add previously removed 'disabled' logic as 'hidden' logic
martinkrulltott Aug 17, 2023
1f0a1ef
test: update program dimension tests to facilitate the new ui
martinkrulltott Aug 17, 2023
0504ae7
test: filter out schedule date when not supported
martinkrulltott Aug 17, 2023
d7c457a
Merge branch 'master' into fix/DHIS2-15530-filter-programs
janhenrikoverland Aug 21, 2023
1a0450f
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Aug 23, 2023
18eb65d
chore: merge in 'fix/DHIS2-15530-filter-programs'
martinkrulltott Aug 23, 2023
98cfd84
fix: add missing metadata for program and event status (DHIS2-15753)
martinkrulltott Aug 25, 2023
4d213f8
fix: make stage select filterable and add noMatchText (DHIS2-15756)
martinkrulltott Aug 25, 2023
445ff6f
fix: add noMatchText to program select (DHIS2-15758)
martinkrulltott Aug 25, 2023
ce4fd3a
refactor: avoid warning with onClick receiving false
martinkrulltott Aug 25, 2023
3e97953
fix: count ou, statuses and periods in the program dimensions counter…
martinkrulltott Aug 28, 2023
97ac12d
fix: allow duplicates of data element ids when fetching metadata (DHI…
martinkrulltott Aug 28, 2023
ec6e6a2
test: add tests for the program dimensions counter
martinkrulltott Aug 28, 2023
d5bb1c2
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Sep 13, 2023
32666cd
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Sep 27, 2023
726bc4b
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Sep 28, 2023
8c346f9
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Oct 6, 2023
ddce619
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
janhenrikoverland Oct 19, 2023
3493494
fix: use programId in effect dep list for fetching DHIS2-15752
edoardo Oct 20, 2023
9230839
Merge branch 'master' into feat/DHIS2-15454-sidebar-ui-changes
martinkrulltott Oct 23, 2023
cbcf670
docs: update docs to reflect ui changes
martinkrulltott Oct 24, 2023
151ebe3
docs: improved descriptions
janhenrikoverland Oct 25, 2023
564fe6f
docs: update screenshot for dimension list
martinkrulltott Oct 25, 2023
45db2fa
docs: replace screenshot for adding a dimension
martinkrulltott Oct 25, 2023
7ae2881
fix: reduce bottom padding for the program dimensions panel
martinkrulltott Oct 25, 2023
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
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
- [ ] KFMT
- [ ] _task_

---
Expand Down
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = defineConfig({
openMode: 0,
},
defaultCommandTimeout: 15000,
experimentalRunAllSpecs: true,
},
env: {
dhis2DatatestPrefix: 'dhis2-linelisting',
Expand Down
2 changes: 1 addition & 1 deletion cypress/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const E2E_PROGRAM = {

export const CHILD_PROGRAM = {
programName: 'Child Programme',
stageName: 'Birth',
//stageName: 'Birth', // auto-selected as it's the first one
[DIMENSION_ID_EVENT_DATE]: 'Report date',
[DIMENSION_ID_ENROLLMENT_DATE]: 'Enrollment date',
[DIMENSION_ID_SCHEDULED_DATE]: 'Scheduled date',
Expand Down
33 changes: 19 additions & 14 deletions cypress/helpers/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ const INPUT_ENROLLMENT = 'enrollment'

const selectProgramAndStage = ({ inputType, programName, stageName }) => {
// select the desired type: Event or Enrollment
cy.getBySel('main-sidebar', EXTENDED_TIMEOUT).contains('Input:').click()
if (inputType === INPUT_EVENT) {
cy.getBySel('input-event').click()
} else {
cy.getBySel('input-enrollment').click()
}

// open the Program dimensions panel
cy.getBySel('main-sidebar').contains('Program dimensions').click()

// choose the program
if (programName) {
cy.getBySel('accessory-sidebar').contains('Choose a program').click()
Expand All @@ -23,21 +19,30 @@ const selectProgramAndStage = ({ inputType, programName, stageName }) => {

// choose the stage if relevant
if (stageName) {
cy.getBySel('accessory-sidebar').contains('Stage').click()
cy.getBySel('stage-select').click()
cy.containsExact(stageName).click()
}
}

export const selectEventWithProgram = ({ programName, stageName }) =>
selectProgramAndStage({ inputType: INPUT_EVENT, programName, stageName })

export const selectEnrollmentProgram = ({ programName, stageName }) =>
export const selectEnrollmentWithProgram = ({ programName }) =>
selectProgramAndStage({
inputType: INPUT_ENROLLMENT,
programName,
stageName,
})

export const openInputSidebar = () => {
cy.getBySel('main-sidebar').contains('Input:').click()
cy.getBySel('input-panel').should('be.visible')
}

export const openProgramDimensionsSidebar = () => {
cy.getBySel('main-sidebar').contains('Program dimensions').click()
cy.getBySel('program-dimensions').should('be.visible')
}

export const openDimension = (dimensionName) => {
cy.getBySel('program-dimensions-list', EXTENDED_TIMEOUT)
.contains(dimensionName)
Expand All @@ -57,6 +62,9 @@ export const clickAddRemoveMainDimension = (label) =>
clickAddRemoveDimension('main-sidebar', label)

export const clickAddRemoveProgramDimension = (label) =>
clickAddRemoveDimension('program-dimensions', label)

export const clickAddRemoveProgramDataDimension = (label) =>
clickAddRemoveDimension('program-dimensions-list', label)

const selectProgramDimensions = ({
Expand All @@ -67,13 +75,12 @@ const selectProgramDimensions = ({
}) => {
selectProgramAndStage({ inputType, programName, stageName })

openProgramDimensionsSidebar()

// add the dimensions as columns
dimensions.forEach((dimensionName) => {
clickAddRemoveProgramDimension(dimensionName)
clickAddRemoveProgramDataDimension(dimensionName)
})

// close the program dimensions panel
cy.getBySel('main-sidebar').contains('Program dimensions').click()
}

export const selectEventWithProgramDimensions = ({
Expand All @@ -88,15 +95,13 @@ export const selectEventWithProgramDimensions = ({
dimensions,
})

export const selectEnrollmentProgramDimensions = ({
export const selectEnrollmentWithProgramDimensions = ({
programName,
stageName,
dimensions,
}) =>
selectProgramDimensions({
inputType: INPUT_ENROLLMENT,
programName,
stageName,
dimensions,
})

Expand Down
15 changes: 12 additions & 3 deletions cypress/helpers/period.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// "Last updated on" is in the sidebar while all the others are in program dimensiions
const openPeriod = (label) => {
if (label === 'Last updated on') {
cy.getBySel('main-dimensions-sidebar').contains(label).click()
} else {
cy.getBySel('program-dimensions').contains(label).click()
}
}

const selectFixedPeriod = ({ label, period }) => {
cy.getBySel('main-sidebar').contains(label).click()
openPeriod(label)
cy.contains('Choose from presets').click()
cy.contains('Fixed periods').click()
if (period.type) {
Expand All @@ -22,7 +31,7 @@ const selectFixedPeriod = ({ label, period }) => {
}

const selectRelativePeriod = ({ label, period }) => {
cy.getBySel('main-sidebar').contains(label).click()
openPeriod(label)
cy.contains('Choose from presets').click()
cy.contains('Relative periods').click()

Expand All @@ -39,7 +48,7 @@ const selectRelativePeriod = ({ label, period }) => {
}

const unselectAllPeriods = ({ label }) => {
cy.getBySel('main-sidebar').contains(label).click()
openPeriod(label)
cy.contains('Choose from presets').click()

cy.getBySel('period-dimension-transfer-actions-removeall').click()
Expand Down
2 changes: 2 additions & 0 deletions cypress/integration/conditions/alphanumericConditions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '../../data/index.js'
import {
openDimension,
openProgramDimensionsSidebar,
selectEventWithProgram,
selectEventWithProgramDimensions,
} from '../../helpers/dimensions.js'
Expand Down Expand Up @@ -251,6 +252,7 @@ describe('alphanumeric types', { testIsolation: false }, () => {
goToStartPage()

selectEventWithProgram(E2E_PROGRAM)
openProgramDimensionsSidebar()
openDimension(type)

cy.getBySel('button-add-condition').click()
Expand Down
2 changes: 2 additions & 0 deletions cypress/integration/conditions/dateConditions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../../data/index.js'
import {
openDimension,
openProgramDimensionsSidebar,
selectEventWithProgram,
selectEventWithProgramDimensions,
} from '../../helpers/dimensions.js'
Expand Down Expand Up @@ -289,6 +290,7 @@ describe('date types', { testIsolation: false }, () => {
goToStartPage()

selectEventWithProgram(E2E_PROGRAM)
openProgramDimensionsSidebar()
openDimension(type)

cy.getBySel('button-add-condition').click()
Expand Down
3 changes: 3 additions & 0 deletions cypress/integration/conditions/numericConditions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '../../data/index.js'
import {
openDimension,
openProgramDimensionsSidebar,
selectEventWithProgram,
selectEventWithProgramDimensions,
} from '../../helpers/dimensions.js'
Expand Down Expand Up @@ -315,6 +316,7 @@ describe('preset options', { testIsolation: false }, () => {
goToStartPage()

selectEventWithProgram(E2E_PROGRAM)
openProgramDimensionsSidebar()
openDimension(dimensionName)
cy.contains('Add to Columns').click()

Expand Down Expand Up @@ -406,6 +408,7 @@ describe('numeric types', { testIsolation: false }, () => {
goToStartPage()

selectEventWithProgram(E2E_PROGRAM)
openProgramDimensionsSidebar()
openDimension(type)

cy.getBySel('button-add-condition').click()
Expand Down
5 changes: 5 additions & 0 deletions cypress/integration/conditions/optionSetCondition.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '../../data/index.js'
import {
openDimension,
openProgramDimensionsSidebar,
selectEventWithProgram,
} from '../../helpers/dimensions.js'
import {
Expand Down Expand Up @@ -37,6 +38,8 @@ describe('Option set condition', () => {

selectEventWithProgram(E2E_PROGRAM)

openProgramDimensionsSidebar()

selectRelativePeriod({
label: E2E_PROGRAM[DIMENSION_ID_EVENT_DATE],
period: TEST_REL_PE_LAST_YEAR,
Expand Down Expand Up @@ -91,6 +94,8 @@ describe('Option set condition', () => {

selectEventWithProgram(E2E_PROGRAM)

openProgramDimensionsSidebar()

selectRelativePeriod({
label: E2E_PROGRAM[DIMENSION_ID_EVENT_DATE],
period: TEST_REL_PE_LAST_YEAR,
Expand Down
3 changes: 3 additions & 0 deletions cypress/integration/conditions/orgunitCondition.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '../../data/index.js'
import {
openDimension,
openProgramDimensionsSidebar,
selectEventWithProgram,
} from '../../helpers/dimensions.js'
import {
Expand All @@ -24,6 +25,8 @@ const stageName = 'Stage 1 - Repeatable'
const setUpTable = () => {
selectEventWithProgram(trackerProgram)

openProgramDimensionsSidebar()

selectRelativePeriod({
label: periodLabel,
period: TEST_REL_PE_THIS_YEAR,
Expand Down
5 changes: 5 additions & 0 deletions cypress/integration/conditions/unsupportedTypes.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '../../data/index.js'
import {
openDimension,
openProgramDimensionsSidebar,
selectEventWithProgram,
} from '../../helpers/dimensions.js'
import {
Expand All @@ -25,6 +26,8 @@ const stageName = 'Stage 1 - Repeatable'
const setUpTable = () => {
selectEventWithProgram(event)

openProgramDimensionsSidebar()

selectRelativePeriod({
label: periodLabel,
period: TEST_REL_PE_THIS_YEAR,
Expand Down Expand Up @@ -52,6 +55,8 @@ describe('unsupported types', () => {

selectEventWithProgram(E2E_PROGRAM)

openProgramDimensionsSidebar()

openDimension(type.dimension)

cy.getBySel('button-add-condition').should('not.exist')
Expand Down
64 changes: 11 additions & 53 deletions cypress/integration/createEnrollment.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import {
TEST_DIM_TEXT,
TEST_FIX_PE_DEC_LAST_YEAR,
} from '../data/index.js'
import {
dimensionIsDisabled,
dimensionIsEnabled,
selectEnrollmentProgramDimensions,
} from '../helpers/dimensions.js'
import { selectEnrollmentWithProgramDimensions } from '../helpers/dimensions.js'
import { clickMenubarUpdateButton } from '../helpers/menubar.js'
import { selectFixedPeriod } from '../helpers/period.js'
import { goToStartPage } from '../helpers/startScreen.js'
Expand All @@ -21,65 +17,35 @@ import {
getTableHeaderCells,
expectTableToBeVisible,
} from '../helpers/table.js'
import { EXTENDED_TIMEOUT } from '../support/util.js'

const enrollment = E2E_PROGRAM
const dimensionName = TEST_DIM_TEXT
const periodLabel = enrollment[DIMENSION_ID_ENROLLMENT_DATE]

const setUpTable = ({ scheduledDateIsSupported } = {}) => {
// switch to Enrollment to toggle the enabled/disabled time dimensions
cy.getBySel('main-sidebar', EXTENDED_TIMEOUT)
.contains('Input: Event')
.click()
cy.getBySel('input-enrollment').click()
cy.getBySel('main-sidebar').contains('Input: Enrollment').click()

// check that the time dimensions are correctly disabled and named
dimensionIsDisabled('dimension-item-eventDate')
cy.getBySel('dimension-item-eventDate').contains('Event date')

dimensionIsEnabled('dimension-item-enrollmentDate')
cy.getBySel('dimension-item-enrollmentDate').contains('Enrollment date')

if (scheduledDateIsSupported) {
dimensionIsDisabled('dimension-item-scheduledDate')
cy.getBySel('dimension-item-scheduledDate').contains('Scheduled date')
}

dimensionIsDisabled('dimension-item-incidentDate')
cy.getBySel('dimension-item-incidentDate').contains('Incident date')

dimensionIsEnabled('dimension-item-lastUpdated')
cy.getBySel('dimension-item-lastUpdated').contains('Last updated on')
const setUpTable = () => {
cy.getBySel('dimension-item-lastUpdated').contains(
enrollment[DIMENSION_ID_LAST_UPDATED]
)

// select program
selectEnrollmentProgramDimensions({
// switch to Enrollment and select a program
selectEnrollmentWithProgramDimensions({
...enrollment,
dimensions: [dimensionName],
})

// check that the time dimensions disabled states and names are updated correctly

dimensionIsDisabled('dimension-item-eventDate')
cy.getBySel('dimension-item-eventDate').contains('Event date')
// check that the time dimensions are shown with the correct names
cy.getBySel('dimension-item-eventDate').should('not.exist')

dimensionIsEnabled('dimension-item-enrollmentDate')
cy.getBySel('dimension-item-enrollmentDate').contains(
enrollment[DIMENSION_ID_ENROLLMENT_DATE]
)

if (scheduledDateIsSupported) {
dimensionIsDisabled('dimension-item-scheduledDate')
cy.getBySel('dimension-item-scheduledDate').contains('Scheduled date')
}
cy.getBySel('dimension-item-scheduledDate').should('not.exist')

dimensionIsEnabled('dimension-item-incidentDate')
cy.getBySel('dimension-item-incidentDate').contains(
enrollment[DIMENSION_ID_INCIDENT_DATE]
)

dimensionIsEnabled('dimension-item-lastUpdated')
cy.getBySel('dimension-item-lastUpdated').contains(
enrollment[DIMENSION_ID_LAST_UPDATED]
)
Expand Down Expand Up @@ -184,15 +150,7 @@ const runTests = () => {
})
}

describe(['>=39'], 'enrollment', () => {
beforeEach(() => {
goToStartPage()
setUpTable({ scheduledDateIsSupported: true })
})
runTests()
})

describe(['<39'], 'enrollment', () => {
describe('enrollment', () => {
beforeEach(() => {
goToStartPage()
setUpTable()
Expand Down
Loading
Loading