Skip to content

Commit

Permalink
Merge branch 'master' into feat/DHIS2-15796
Browse files Browse the repository at this point in the history
  • Loading branch information
BRaimbault authored Dec 2, 2024
2 parents b2be0ed + 32a2fe9 commit 748150e
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 342 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ jobs:

- name: Test
run: yarn d2-app-scripts test
env:
REPORTPORTAL_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }}
REPORTPORTAL_ENDPOINT: ${{ vars.REPORTPORTAL_ENDPOINT }}
REPORTPORTAL_PROJECT: ${{ vars.REPORTPORTAL_PROJECT }}
CI_BUILD_ID: ${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
PR_TITLE: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || format('Direct push to {0}', github.ref_name) }}

call-workflow-e2e-prod:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
Expand All @@ -97,6 +90,3 @@ jobs:
username: ${{ secrets.CYPRESS_DHIS2_USERNAME }}
password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }}
recordkey: ${{ secrets.CYPRESS_RECORD_KEY }}
reportportal_api_key: ${{ secrets.REPORTPORTAL_API_KEY }}
reportportal_endpoint: ${{ vars.REPORTPORTAL_ENDPOINT }}
reportportal_project: ${{ vars.REPORTPORTAL_PROJECT }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [100.7.7](https://github.com/dhis2/maps-app/compare/v100.7.6...v100.7.7) (2024-11-29)


### Bug Fixes

* update 'No data' handling ([#3408](https://github.com/dhis2/maps-app/issues/3408)) ([d774e7a](https://github.com/dhis2/maps-app/commit/d774e7a2a849cf40bca3d039aca2d1c6ce1f5331))

## [100.7.6](https://github.com/dhis2/maps-app/compare/v100.7.5...v100.7.6) (2024-11-17)


Expand Down
28 changes: 0 additions & 28 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,6 @@ async function setupNodeEvents(on, config) {

module.exports = defineConfig({
projectId: 'r5jduj',
reporter: '@reportportal/agent-js-cypress',
reporterOptions: {
endpoint: process.env.REPORTPORTAL_ENDPOINT,
apiKey: process.env.REPORTPORTAL_API_KEY,
launch: 'maps_app',
project: process.env.REPORTPORTAL_PROJECT,
description: '',
autoMerge: true,
parallel: true,
debug: false,
restClientConfig: {
timeout: 660000,
},
attributes: [
{
key: 'version',
value: 'master',
},
{
key: 'app_name',
value: 'maps-app',
},
{
key: 'test_level',
value: 'e2e',
},
],
},
e2e: {
setupNodeEvents,
baseUrl: 'http://localhost:3000',
Expand Down
13 changes: 13 additions & 0 deletions cypress/elements/thematic_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,23 @@ export class ThematicLayer extends Layer {
return this
}

selectRelativePeriod(period) {
cy.get('[data-test="relative-period-select"]').click()
cy.contains(period).click()

return this
}

selectPeriodType(periodType) {
cy.get('[data-test="periodtypeselect"]').click()
cy.contains(periodType).click()

return this
}

selectIncludeNoDataOU() {
cy.contains('Include org units with no data').click()

return this
}
}
73 changes: 72 additions & 1 deletion cypress/integration/layers/thematiclayer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {
expectContextMenuOptions,
} from '../../elements/map_context_menu.js'
import { ThematicLayer } from '../../elements/thematic_layer.js'
import { CURRENT_YEAR, getApiBaseUrl } from '../../support/util.js'
import {
CURRENT_YEAR,
getApiBaseUrl,
EXTENDED_TIMEOUT,
} from '../../support/util.js'

const INDICATOR_NAME = 'VCCT post-test counselling rate'

Expand Down Expand Up @@ -95,6 +99,73 @@ context('Thematic Layers', () => {
getMaps().should('have.length', 1)
})

it('opens a thematic layer popup with data and nodata', () => {
Layer.openDialog('Thematic')
.selectIndicatorGroup('Stock')
.selectIndicator('BCG Stock PHU')
.selectTab('Period')
.selectRelativePeriod('This month')
.selectTab('Style')
.selectIncludeNoDataOU()
.selectTab('Org Units')
.unselectOuLevel('District')
.selectOuLevel('Facility')

cy.getByDataTest('org-unit-tree-node')
.contains('Western Area')
.parents('[data-test="org-unit-tree-node"]')
.first()
.within(() => {
cy.getByDataTest('org-unit-tree-node-toggle').click()
})

cy.getByDataTest('org-unit-tree-node')
.contains('Rural Western Area')
.parents('[data-test="org-unit-tree-node"]')
.first()
.within(() => {
cy.getByDataTest('org-unit-tree-node-toggle').click()
})

// Value: 0
cy.getByDataTest('org-unit-tree-node').contains('Tokeh MCHP').click()

cy.getByDataTest('layeredit-addbtn').click()

Layer.validateDialogClosed(true)

cy.wait(5000) // eslint-disable-line cypress/no-unnecessary-waiting
cy.get('#dhis2-map-container')
.findByDataTest('dhis2-uicore-componentcover', EXTENDED_TIMEOUT)
.should('not.exist')
cy.get('.dhis2-map').click('center') //Click somewhere on the map

cy.get('.maplibregl-popup').contains('Value: 0').should('be.visible')

// Value: No data
cy.getByDataTest('layer-edit-button').click()
Layer.selectTab('Org Units')

cy.getByDataTest('org-unit-tree-node').contains('Tokeh MCHP').click()
cy.getByDataTest('org-unit-tree-node')
.contains('Lakka Hospital')
.click()

cy.getByDataTest('layeredit-addbtn').click()

Layer.validateDialogClosed(true)

cy.wait(5000) // eslint-disable-line cypress/no-unnecessary-waiting
cy.get('#dhis2-map-container')
.findByDataTest('dhis2-uicore-componentcover', EXTENDED_TIMEOUT)
.should('not.exist')
cy.get('.dhis2-map').click('center') //Click somewhere on the map

cy.get('.maplibregl-popup')
.contains('Value: No data')
.should('be.visible')
})

it('adds a thematic layer with split view period', () => {
Layer.openDialog('Thematic')
.selectIndicatorGroup('ANC')
Expand Down
52 changes: 1 addition & 51 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,3 @@
const reportPortalConfig = [
'@reportportal/agent-js-jest',
{
apiKey: process.env.REPORTPORTAL_API_KEY,
endpoint: process.env.REPORTPORTAL_ENDPOINT,
project: process.env.REPORTPORTAL_PROJECT,
launch: 'maps_app',
attributes: [
{
key: 'dhis2_version',
value: 'master',
},
{
key: 'app_name',
value: 'maps-app',
},
{
key: 'test_level',
value: 'unit/integration',
},
{
key: 'BRANCH_NAME',
value: process.env.BRANCH_NAME,
},
{
key: 'CI_BUILD_ID',
value: process.env.CI_BUILD_ID,
},
{
key: 'PR_TITLE',
value: process.env.PR_TITLE,
},
],
description: '',
debug: false,
},
]

const isDependabotPR = process.env.GITHUB_ACTOR === 'dependabot[bot]'
const isGithubActionsRun = process.env.CI === 'true'
const isReportPortalSetup =
process.env.REPORTPORTAL_API_KEY !== undefined &&
process.env.REPORTPORTAL_ENDPOINT !== undefined &&
process.env.REPORTPORTAL_PROJECT !== undefined

module.exports = {
setupFilesAfterEnv: ['<rootDir>/config/testSetup.js'],
collectCoverageFrom: ['src/**/*.js'],
Expand All @@ -57,10 +12,5 @@ module.exports = {
snapshotSerializers: ['enzyme-to-json/serializer'],

testRunner: 'jest-circus/runner',
reporters: [
'default',
...(isGithubActionsRun && isReportPortalSetup && !isDependabotPR
? [reportPortalConfig]
: []),
],
reporters: ['default'],
}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maps-app",
"version": "100.7.6",
"version": "100.7.7",
"description": "DHIS2 Maps",
"license": "BSD-3-Clause",
"author": "Bjørn Sandvik",
Expand Down Expand Up @@ -45,11 +45,9 @@
"@dhis2/app-runtime": "^3.11.2",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
"@dhis2/maps-gl": "^4.0.0",
"@dhis2/maps-gl": "^4.0.1",
"@dhis2/ui": "^9.13.0",
"@krakenjs/post-robot": "^11.0.0",
"@reportportal/agent-js-cypress": "git+https://github.com/dhis2/agent-js-cypress.git#develop",
"@reportportal/agent-js-jest": "^5.0.7",
"@testing-library/react-hooks": "^8.0.1",
"abortcontroller-polyfill": "^1.7.5",
"array-move": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/layers/ThematicLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class ThematicLayer extends Layer {
<div>{indicator}</div>
<div>{periodName}</div>
<div>
{i18n.t('Value')}: {value ? value : i18n.t('No data')}
{i18n.t('Value')}: {value ?? i18n.t('No data')}
</div>
{aggregationType && aggregationType !== 'DEFAULT' && (
<div>{aggregationType}</div>
Expand Down
2 changes: 2 additions & 0 deletions src/util/labels.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import i18n from '@dhis2/d2-i18n'
import {
LABEL_FONT_SIZE,
LABEL_FONT_STYLE,
Expand All @@ -20,5 +21,6 @@ export const getLabelStyle = ({
lineHeight: parseInt(fontSize, 10) * 1.2 + 'px',
color: cssColor(labelFontColor) || LABEL_FONT_COLOR,
paddingTop: '10px',
labelNoData: i18n.t('No data'),
}
}
Loading

0 comments on commit 748150e

Please sign in to comment.