diff --git a/cypress/integration/dataTable.cy.js b/cypress/integration/dataTable.cy.js new file mode 100644 index 000000000..ecfff1d48 --- /dev/null +++ b/cypress/integration/dataTable.cy.js @@ -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) + }) +}) diff --git a/cypress/integration/mapDownload.cy.js b/cypress/integration/mapDownload.cy.js index ad7367475..93b23ed4a 100644 --- a/cypress/integration/mapDownload.cy.js +++ b/cypress/integration/mapDownload.cy.js @@ -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') diff --git a/cypress/integration/orgUnitInfo.cy.js b/cypress/integration/orgUnitInfo.cy.js index 2c69f29e1..cc7439f09 100644 --- a/cypress/integration/orgUnitInfo.cy.js +++ b/cypress/integration/orgUnitInfo.cy.js @@ -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') @@ -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') }) diff --git a/cypress/integration/routes.cy.js b/cypress/integration/routes.cy.js index 0e12826e4..0153b3054 100644 --- a/cypress/integration/routes.cy.js +++ b/cypress/integration/routes.cy.js @@ -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', () => { diff --git a/src/components/core/Checkbox.js b/src/components/core/Checkbox.js index e32ea0bfe..71cdeebad 100644 --- a/src/components/core/Checkbox.js +++ b/src/components/core/Checkbox.js @@ -13,8 +13,9 @@ const Checkbox = ({ tooltip, onChange, className, + dataTest, }) => ( -