Skip to content

Commit

Permalink
Merge branch 'dev' into ee-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
turban committed Jan 25, 2024
2 parents 14c37a9 + def0e0c commit b2d6e71
Show file tree
Hide file tree
Showing 37 changed files with 1,690 additions and 1,108 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# [100.3.0](https://github.com/dhis2/maps-app/compare/v100.2.3...v100.3.0) (2024-01-12)


### Features

* add support for hash routing in line with other analytics apps [DHIS2-15762] ([#3009](https://github.com/dhis2/maps-app/issues/3009)) ([b25267d](https://github.com/dhis2/maps-app/commit/b25267d33a8ab5a136f34516ba1bc802ae9e51b3))

## [100.2.3](https://github.com/dhis2/maps-app/compare/v100.2.2...v100.2.3) (2023-12-21)


### Bug Fixes

* conditionally set PR title in dhis2-verify-app workflow ([#3089](https://github.com/dhis2/maps-app/issues/3089)) ([03eed2d](https://github.com/dhis2/maps-app/commit/03eed2d6fd3f697686183743ba30b079eb175f62))
* report as MAP_VIEW not VISUALIZATION_VIEW ([#3086](https://github.com/dhis2/maps-app/issues/3086)) ([008e7fe](https://github.com/dhis2/maps-app/commit/008e7fe32508b403d251cb1b617c23c5feaf8063))
* **translations:** sync translations from transifex (dev) ([dcf7743](https://github.com/dhis2/maps-app/commit/dcf7743af6ddbb4c12cef377e982c1ea0f45d3c6))
* **translations:** sync translations from transifex (dev) ([7d98a8a](https://github.com/dhis2/maps-app/commit/7d98a8abab9d71d90c2f51b1cb4eb01598661c3f))
* **translations:** sync translations from transifex (dev) ([6e8b82b](https://github.com/dhis2/maps-app/commit/6e8b82bbbb338883358e9c69311f0b3bbbe94224))

## [100.2.2](https://github.com/dhis2/maps-app/compare/v100.2.1...v100.2.2) (2023-11-03)


Expand Down
47 changes: 47 additions & 0 deletions cypress/integration/dataTable.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { EXTENDED_TIMEOUT } from '../support/util.js'

const map = {
id: 'eDlFx0jTtV9',
name: 'ANC: LLITN Cov Chiefdom this year',
downloadFileNamePrefix: 'ANC LLITN Cov Chiefdom this year',
cardTitle: 'ANC LLITN coverage',
}

describe('data table', () => {
it('opens data table', () => {
cy.visit(`/#/${map.id}`, EXTENDED_TIMEOUT)
cy.get('canvas', EXTENDED_TIMEOUT).should('be.visible')

cy.getByDataTest('moremenubutton').first().click()

cy.getByDataTest('more-menu')
.find('li')
.not('.disabled')
.should('have.length', 6)

cy.getByDataTest('more-menu')
.find('li')
.contains('Show data table')
.click()

//check that the bottom panel is present
cy.getByDataTest('bottom-panel').should('be.visible')

// check number of columns
cy.getByDataTest('bottom-panel')
.find('[role="columnheader"]')
.should('have.length', 10)

// try the filtering
cy.getByDataTest('bottom-panel')
.find('[role="columnheader"]')
.containsExact('Name')
.siblings('input')
.type('Kakua')

// check that the filter worked
cy.getByDataTest('bottom-panel')
.find('.ReactVirtualized__Table__row')
.should('have.length', 1)
})
})
12 changes: 10 additions & 2 deletions cypress/integration/interpretations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { EXTENDED_TIMEOUT } from '../support/util.js'
const MAP_TITLE = 'test ' + new Date().toUTCString().slice(-24, -4)
context('Interpretations', () => {
it('opens the interpretations panel for a map', () => {
cy.visit('/?id=ZBjCfSaLSqD', EXTENDED_TIMEOUT)
cy.visit('/#/ZBjCfSaLSqD', EXTENDED_TIMEOUT)
const Layer = new ThematicLayer()
Layer.validateCardTitle('ANC LLITN coverage')
cy.get('canvas.maplibregl-canvas').should('be.visible')
Expand Down Expand Up @@ -65,8 +65,12 @@ context('Interpretations', () => {
.find('canvas.maplibregl-canvas')
.should('be.visible')

cy.url().should('include', 'interpretationId=')

cy.get('button').contains('Hide interpretation').click()

cy.url().should('not.include', 'interpretationId=')

deleteMap()
})

Expand All @@ -75,7 +79,7 @@ context('Interpretations', () => {
'postDataStatistics'
)
cy.visit(
'/?id=ZBjCfSaLSqD&interpretationId=yKqhXZdeJ6a',
'/#/ZBjCfSaLSqD?interpretationId=yKqhXZdeJ6a',
EXTENDED_TIMEOUT
) //ANC: LLITN coverage district and facility

Expand All @@ -90,12 +94,16 @@ context('Interpretations', () => {
)
.should('be.visible')

cy.url().should('include', 'interpretationId=')

cy.getByDataTest('interpretation-modal')
.findByDataTest('dhis2-modal-close-button')
.click()

cy.getByDataTest('interpretation-modal').should('not.exist')

cy.url().should('not.include', 'interpretationId=')

cy.getByDataTest('interpretations-list').should('be.visible')
})
})
112 changes: 112 additions & 0 deletions cypress/integration/mapDownload.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import { EXTENDED_TIMEOUT } from '../support/util.js'

const mapWithThematicLayer = {
id: 'eDlFx0jTtV9',
name: 'ANC: LLITN Cov Chiefdom this year',
downloadFileName: 'ANC LLITN Cov Chiefdom this year.png',
cardTitle: 'ANC LLITN coverage',
}

const assertDownloadSettingChecked = (label, isChecked) => {
cy.getByDataTest('download-settings')
.find('label')
.contains(label)
.find('input')
.should(`${isChecked ? '' : 'not.'}be.checked`)
}

const clickDownloadSetting = (label) => {
cy.getByDataTest('download-settings')
.find('label')
.contains(label)
.find('input')
.click()
}

describe('Map Download', () => {
beforeEach(() => {
cy.task('emptyDownloadsFolder')
})

it('downloads a map', () => {
cy.visit(`/#/${mapWithThematicLayer.id}`, EXTENDED_TIMEOUT)
cy.get('canvas', EXTENDED_TIMEOUT).should('be.visible')

cy.get('[data-test="layercard"]')
.find('h2')
.contains(mapWithThematicLayer.cardTitle, EXTENDED_TIMEOUT)

cy.getByDataTest('dhis2-analytics-hovermenubar')
.find('button')
.contains('Download')
.click()

cy.log('confirm that download page is open')
cy.getByDataTest('download-settings').should('be.visible')
cy.get('canvas.maplibregl-canvas').should('be.visible')
cy.get('button').contains('Exit download mode').should('be.visible')
cy.url().should('contain', `/#/${mapWithThematicLayer.id}/download`)

// check the current settings
assertDownloadSettingChecked('Show map name', true)

cy.getByDataTest('download-map-info')
.find('h1')
.contains(mapWithThematicLayer.name)
.should('be.visible')

assertDownloadSettingChecked('Show map description', false)
assertDownloadSettingChecked('Show legend', true)
cy.getByDataTest('download-map-info')
.findByDataTest('download-legend-title')
.should('have.length', 1)

assertDownloadSettingChecked('Show overview map', true)
cy.getByDataTest('download-map-info')
.findByDataTest('overview-map')
.should('be.visible')

// make some changes
clickDownloadSetting('Show map name')
cy.getByDataTest('download-map-info').find('h1').should('not.exist')

clickDownloadSetting('Show north arrow')
cy.getByDataTest('north-arrow').should('not.exist')

clickDownloadSetting('Show overview map')
cy.getByDataTest('download-map-info')
.findByDataTest('overview-map')
.should('not.exist')

clickDownloadSetting('Show legend')
cy.getByDataTest('download-map-info').should('not.exist')

// and download the map
cy.getByDataTest('download-settings')
.find('button')
.contains('Download')
.click()

// check for downloaded file
cy.wait(3000) // eslint-disable-line cypress/no-unnecessary-waiting
cy.waitUntil(
() => cy.task('getLastDownloadFilePath').then((result) => result),
{ timeout: 3000, interval: 100 }
).then((filePath) => {
expect(filePath).to.include(mapWithThematicLayer.downloadFileName)

cy.readFile(filePath, EXTENDED_TIMEOUT).should((buffer) =>
expect(buffer.length).to.be.gt(10000)
)
})

// leave download mode
cy.get('button').contains('Exit download mode').click()
cy.url().should('contain', `/#/${mapWithThematicLayer.id}`)
cy.url().should('not.contain', '/download')
cy.getByDataTest('download-settings').should('not.exist')
cy.get('[data-test="layercard"]')
.find('h2')
.contains(mapWithThematicLayer.cardTitle, EXTENDED_TIMEOUT)
})
})
24 changes: 13 additions & 11 deletions cypress/integration/orgUnitInfo.cy.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
// import { ThematicLayer } from '../elements/thematic_layer.js'
import { EXTENDED_TIMEOUT } from '../support/util.js'
import { CURRENT_YEAR, EXTENDED_TIMEOUT } from '../support/util.js'

context('OrgUnitInfo', () => {
it.skip('opens the panel for an OrgUnit', () => {
cy.visit('/?id=ZBjCfSaLSqD', EXTENDED_TIMEOUT)
cy.wait(5000) // eslint-disable-line cypress/no-unnecessary-waiting
describe('OrgUnitInfo', () => {
it('opens the panel for an OrgUnit', () => {
cy.visit('/#/ZBjCfSaLSqD', EXTENDED_TIMEOUT)
cy.get('canvas').should('be.visible')

cy.wait(5000) // eslint-disable-line cypress/no-unnecessary-waiting
cy.getByDataTest('dhis2-map-container')
cy.get('#dhis2-map-container')
.findByDataTest('dhis2-uicore-componentcover', EXTENDED_TIMEOUT)
.should('not.exist')
cy.get('.dhis2-map').click(300, 100) //Bombali
cy.contains('View profile').click()
cy.get('.dhis2-map').click(350, 350) //Click somewhere on the map

cy.get('.maplibregl-popup').contains('View profile').click()

// check the Org Unit Profile panel
cy.getByDataTest('org-unit-profile').contains(
'Organisation unit profile'
)
cy.getByDataTest('org-unit-info').find('h3').contains('Bombali')

// // TODO - find a way to ensure that "Bombali" is the orgunit that was clicked on
// // cy.getByDataTest('org-unit-info').find('h3').contains('Bombali')

cy.getByDataTest('org-unit-data')
.findByDataTest('button-previous-year')
Expand All @@ -27,7 +29,7 @@ context('OrgUnitInfo', () => {
.findByDataTest('dhis2-uicore-circularloader')
.should('not.exist')

cy.getByDataTest('year-select').contains('2022')
cy.getByDataTest('year-select').contains(CURRENT_YEAR - 1)

cy.getByDataTest('org-unit-data-table').contains('Expected pregnancies')
})
Expand Down
Loading

0 comments on commit b2d6e71

Please sign in to comment.