Skip to content

Commit

Permalink
Merge branch 'dev' into feat/new-data-table
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Jan 25, 2024
2 parents 2b9198e + def0e0c commit 9edab24
Show file tree
Hide file tree
Showing 9 changed files with 616 additions and 485 deletions.
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: 12 additions & 0 deletions cypress/integration/mapDownload.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ describe('Map Download', () => {
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')
Expand Down
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
10 changes: 10 additions & 0 deletions cypress/integration/routes.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ context('Routes', () => {
'Viewing interpretation: ANC: LLITN coverage district and facility'
)
.should('be.visible')

cy.getByDataTest('interpretation-modal')
.find('canvas')
.should('be.visible')

cy.getByDataTest('interpretation-modal')
.contains(
'Koinadugu has a very high LLITN coverage despite low density of facilities providing nets.'
)
.should('be.visible')
})

it('loads with map id (legacy) and interpretationId uppercase', () => {
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"postinstall": "patch-package"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "^10.3.11",
"@dhis2/cli-app-scripts": "^10.4.0",
"@dhis2/cli-style": "^10.5.1",
"@dhis2/cypress-commands": "^10.0.3",
"@dhis2/cypress-plugins": "^10.0.3",
Expand All @@ -40,13 +40,13 @@
},
"dependencies": {
"@dhis2/analytics": "^26.2.0",
"@dhis2/app-runtime": "^3.9.4",
"@dhis2/app-runtime": "^3.10.2",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/app-service-alerts": "^3.9.4",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
"@dhis2/d2-i18n": "^1.1.3",
"@dhis2/maps-gl": "^3.8.6",
"@dhis2/ui": "^8.16.0",
"@dhis2/ui": "^9.2.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",
Expand Down Expand Up @@ -80,5 +80,8 @@
"redux-thunk": "^2.4.2",
"styled-jsx": "^4.0.1",
"url-polyfill": "^1.1.12"
},
"resolutions": {
"@dhis2/ui": "^9.2.0"
}
}
4 changes: 3 additions & 1 deletion src/components/core/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const Checkbox = ({
tooltip,
onChange,
className,
dataTest,
}) => (
<div className={cx(styles.checkbox, className)}>
<div className={cx(styles.checkbox, className)} data-test={dataTest}>
<UiCheckbox
label={label}
checked={checked}
Expand All @@ -34,6 +35,7 @@ Checkbox.propTypes = {
onChange: PropTypes.func.isRequired,
checked: PropTypes.bool,
className: PropTypes.string,
dataTest: PropTypes.string,
dense: PropTypes.bool,
disabled: PropTypes.bool,
label: PropTypes.string,
Expand Down
1 change: 1 addition & 0 deletions src/components/datatable/BottomPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const BottomPanel = () => {
ref={panelRef}
className={styles.bottomPanel}
style={{ height: tableHeight, width: tableWidth }}
data-test="bottom-panel"
>
<span
className={styles.closeIcon}
Expand Down
1 change: 1 addition & 0 deletions src/components/download/NorthArrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const NorthArrow = ({
className={cx(styles.northArrow, styles[position], {
[styles.downloadMapInfoOpen]: downloadMapInfoOpen,
})}
data-test="north-arrow"
>
<svg
width={width}
Expand Down
Loading

0 comments on commit 9edab24

Please sign in to comment.