From 0440b9ba888ee4ea9ed17585f31ced6244fa1975 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Mon, 4 Sep 2023 13:48:33 +0200 Subject: [PATCH 1/6] fix: parse the ou filter correctly for all ou types --- src/components/Item/AppItem/Item.js | 16 +-- .../AppItem/__tests__/getIframeSrc.spec.js | 124 ++++++++++++++++++ src/components/Item/AppItem/getIframeSrc.js | 17 +++ 3 files changed, 142 insertions(+), 15 deletions(-) create mode 100644 src/components/Item/AppItem/__tests__/getIframeSrc.spec.js create mode 100644 src/components/Item/AppItem/getIframeSrc.js diff --git a/src/components/Item/AppItem/Item.js b/src/components/Item/AppItem/Item.js index 7681c5d00..00b0ee3d4 100644 --- a/src/components/Item/AppItem/Item.js +++ b/src/components/Item/AppItem/Item.js @@ -3,27 +3,13 @@ import { Divider, colors, spacers, IconQuestion24 } from '@dhis2/ui' import PropTypes from 'prop-types' import React from 'react' import { connect } from 'react-redux' -import { FILTER_ORG_UNIT } from '../../../actions/itemFilters.js' import { EDIT, isEditMode } from '../../../modules/dashboardModes.js' import { sGetItemFiltersRoot, DEFAULT_STATE_ITEM_FILTERS, } from '../../../reducers/itemFilters.js' import ItemHeader from '../ItemHeader/ItemHeader.js' - -const getIframeSrc = (appDetails, item, itemFilters) => { - let iframeSrc = `${appDetails.launchUrl}?dashboardItemId=${item.id}` - - if (itemFilters[FILTER_ORG_UNIT] && itemFilters[FILTER_ORG_UNIT].length) { - const ouIds = itemFilters[FILTER_ORG_UNIT].map( - (ouFilter) => ouFilter.path.split('/').slice(-1)[0] - ) - - iframeSrc += `&userOrgUnit=${ouIds.join(',')}` - } - - return iframeSrc -} +import { getIframeSrc } from './getIframeSrc.js' const AppItem = ({ dashboardMode, item, itemFilters }) => { const { d2 } = useD2() diff --git a/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js new file mode 100644 index 000000000..74f0b343f --- /dev/null +++ b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js @@ -0,0 +1,124 @@ +import { getIframeSrc } from '../getIframeSrc.js' + +const appDetails = { launchUrl: 'debug/dev' } +const dashboardItem = { id: 'rainbowdashitem' } + +describe('getIframeSrc', () => { + it('no ou filter', () => { + const ouFilter = [] + + const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) + expect(src).toEqual( + `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}` + ) + }) + + it('should return the correct iframe src', () => { + const ouFilter = [ + { + id: 'fdc6uOvgoji', + path: '/ImspTQPwCqd/fdc6uOvgoji', + name: 'Bombali', + }, + { + id: 'lc3eMKXaEfw', + path: '/ImspTQPwCqd/lc3eMKXaEfw', + name: 'Bonthe', + }, + ] + + const appDetails = { launchUrl: 'debug/dev' } + const dashboardItem = { id: 'rainbowdashitem' } + + const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) + expect(src).toEqual( + `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=fdc6uOvgoji,lc3eMKXaEfw` + ) + }) + + it('org unit group in filter', () => { + const ouFilter = [ + { + id: 'OU_GROUP-b0EsAxm8Nge', + name: 'Western Area', + }, + { + id: 'lc3eMKXaEfw', + path: '/ImspTQPwCqd/lc3eMKXaEfw', + name: 'Bonthe', + }, + ] + + const appDetails = { launchUrl: 'debug/dev' } + const dashboardItem = { id: 'rainbowdashitem' } + + const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) + expect(src).toEqual( + `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=OU_GROUP-b0EsAxm8Nge,lc3eMKXaEfw` + ) + }) + + it('org unit level in filter', () => { + const ouFilter = [ + { + id: 'LEVEL-m9lBJogzE95', + name: 'Facility', + }, + { + id: 'fdc6uOvgoji', + path: '/ImspTQPwCqd/fdc6uOvgoji', + name: 'Bombali', + }, + ] + + const appDetails = { launchUrl: 'debug/dev' } + const dashboardItem = { id: 'rainbowdashitem' } + + const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) + expect(src).toEqual( + `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=LEVEL-m9lBJogzE95,fdc6uOvgoji` + ) + }) + + it('user org unit in filter', () => { + const ouFilter = [ + { + id: 'USER_ORGUNIT', + displayName: 'User organisation unit', + }, + ] + + const appDetails = { launchUrl: 'debug/dev' } + const dashboardItem = { id: 'rainbowdashitem' } + + const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) + expect(src).toEqual( + `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=USER_ORGUNIT` + ) + }) + + it('all user org units in filter', () => { + const ouFilter = [ + { + id: 'USER_ORGUNIT_CHILDREN', + displayName: 'User sub-units', + }, + { + id: 'USER_ORGUNIT_GRANDCHILDREN', + displayName: 'User sub-x2-units', + }, + { + id: 'USER_ORGUNIT', + displayName: 'User organisation unit', + }, + ] + + const appDetails = { launchUrl: 'debug/dev' } + const dashboardItem = { id: 'rainbowdashitem' } + + const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) + expect(src).toEqual( + `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=USER_ORGUNIT_CHILDREN,USER_ORGUNIT_GRANDCHILDREN,USER_ORGUNIT` + ) + }) +}) diff --git a/src/components/Item/AppItem/getIframeSrc.js b/src/components/Item/AppItem/getIframeSrc.js new file mode 100644 index 000000000..42fe7d4bc --- /dev/null +++ b/src/components/Item/AppItem/getIframeSrc.js @@ -0,0 +1,17 @@ +import { FILTER_ORG_UNIT } from '../../../actions/itemFilters.js' + +export const getIframeSrc = (appDetails, item, itemFilters) => { + let iframeSrc = `${appDetails.launchUrl}?dashboardItemId=${item.id}` + + console.log('jj itemfilters', itemFilters) + + if (itemFilters[FILTER_ORG_UNIT] && itemFilters[FILTER_ORG_UNIT].length) { + const ouIds = itemFilters[FILTER_ORG_UNIT].map(({ id, path }) => + path ? path.split('/').slice(-1)[0] : id + ) + + iframeSrc += `&userOrgUnit=${ouIds.join(',')}` + } + + return iframeSrc +} From 42be6df28fe71cb22602f8a5b532ebefcecda213 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 5 Sep 2023 07:44:00 +0200 Subject: [PATCH 2/6] fix: test cleanup --- .../AppItem/__tests__/getIframeSrc.spec.js | 32 ++++--------------- src/components/Item/AppItem/getIframeSrc.js | 2 -- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js index 74f0b343f..c6ce9d1e3 100644 --- a/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js +++ b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js @@ -2,15 +2,14 @@ import { getIframeSrc } from '../getIframeSrc.js' const appDetails = { launchUrl: 'debug/dev' } const dashboardItem = { id: 'rainbowdashitem' } +const expectedSrc = `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}` describe('getIframeSrc', () => { it('no ou filter', () => { const ouFilter = [] const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) - expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}` - ) + expect(src).toEqual(expectedSrc) }) it('should return the correct iframe src', () => { @@ -27,12 +26,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=fdc6uOvgoji,lc3eMKXaEfw` + `${expectedSrc}&userOrgUnit=fdc6uOvgoji,lc3eMKXaEfw` ) }) @@ -49,12 +45,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=OU_GROUP-b0EsAxm8Nge,lc3eMKXaEfw` + `${expectedSrc}&userOrgUnit=OU_GROUP-b0EsAxm8Nge,lc3eMKXaEfw` ) }) @@ -71,12 +64,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=LEVEL-m9lBJogzE95,fdc6uOvgoji` + `${expectedSrc}&userOrgUnit=LEVEL-m9lBJogzE95,fdc6uOvgoji` ) }) @@ -88,13 +78,8 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) - expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=USER_ORGUNIT` - ) + expect(src).toEqual(`${expectedSrc}&userOrgUnit=USER_ORGUNIT`) }) it('all user org units in filter', () => { @@ -113,12 +98,9 @@ describe('getIframeSrc', () => { }, ] - const appDetails = { launchUrl: 'debug/dev' } - const dashboardItem = { id: 'rainbowdashitem' } - const src = getIframeSrc(appDetails, dashboardItem, { ou: ouFilter }) expect(src).toEqual( - `${appDetails.launchUrl}?dashboardItemId=${dashboardItem.id}&userOrgUnit=USER_ORGUNIT_CHILDREN,USER_ORGUNIT_GRANDCHILDREN,USER_ORGUNIT` + `${expectedSrc}&userOrgUnit=USER_ORGUNIT_CHILDREN,USER_ORGUNIT_GRANDCHILDREN,USER_ORGUNIT` ) }) }) diff --git a/src/components/Item/AppItem/getIframeSrc.js b/src/components/Item/AppItem/getIframeSrc.js index 42fe7d4bc..ae2b1c2c8 100644 --- a/src/components/Item/AppItem/getIframeSrc.js +++ b/src/components/Item/AppItem/getIframeSrc.js @@ -3,8 +3,6 @@ import { FILTER_ORG_UNIT } from '../../../actions/itemFilters.js' export const getIframeSrc = (appDetails, item, itemFilters) => { let iframeSrc = `${appDetails.launchUrl}?dashboardItemId=${item.id}` - console.log('jj itemfilters', itemFilters) - if (itemFilters[FILTER_ORG_UNIT] && itemFilters[FILTER_ORG_UNIT].length) { const ouIds = itemFilters[FILTER_ORG_UNIT].map(({ id, path }) => path ? path.split('/').slice(-1)[0] : id From c442c4534d19676cd008eeb8e718a173b4cd1e45 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 5 Sep 2023 07:47:31 +0200 Subject: [PATCH 3/6] chore: rename tests --- .../Item/AppItem/__tests__/getIframeSrc.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js index c6ce9d1e3..fd85d6037 100644 --- a/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js +++ b/src/components/Item/AppItem/__tests__/getIframeSrc.spec.js @@ -12,7 +12,7 @@ describe('getIframeSrc', () => { expect(src).toEqual(expectedSrc) }) - it('should return the correct iframe src', () => { + it('org units chosen from the tree', () => { const ouFilter = [ { id: 'fdc6uOvgoji', @@ -32,7 +32,7 @@ describe('getIframeSrc', () => { ) }) - it('org unit group in filter', () => { + it('org unit group and org unit from tree', () => { const ouFilter = [ { id: 'OU_GROUP-b0EsAxm8Nge', @@ -51,7 +51,7 @@ describe('getIframeSrc', () => { ) }) - it('org unit level in filter', () => { + it('org unit level and org unit from tree', () => { const ouFilter = [ { id: 'LEVEL-m9lBJogzE95', @@ -70,7 +70,7 @@ describe('getIframeSrc', () => { ) }) - it('user org unit in filter', () => { + it('user org unit', () => { const ouFilter = [ { id: 'USER_ORGUNIT', @@ -82,7 +82,7 @@ describe('getIframeSrc', () => { expect(src).toEqual(`${expectedSrc}&userOrgUnit=USER_ORGUNIT`) }) - it('all user org units in filter', () => { + it('all user org units', () => { const ouFilter = [ { id: 'USER_ORGUNIT_CHILDREN', From 8787705a643af776fb317ddd94c2dc0fdef16ce8 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 5 Sep 2023 09:07:47 +0200 Subject: [PATCH 4/6] chore: add cypress test --- .../common/view/add_a_FILTERTYPE_filter.js | 40 ++++++--- .../integration/view/dashboard_filter.feature | 8 +- .../view/dashboard_filter/create_dashboard.js | 88 +++++++++++++------ .../view/dashboard_filter/dashboard_filter.js | 17 ++++ cypress/support/commands.js | 25 ++++++ cypress/support/index.js | 1 + 6 files changed, 139 insertions(+), 40 deletions(-) create mode 100644 cypress/support/commands.js diff --git a/cypress/integration/common/view/add_a_FILTERTYPE_filter.js b/cypress/integration/common/view/add_a_FILTERTYPE_filter.js index dea5155bb..c7c2be135 100644 --- a/cypress/integration/common/view/add_a_FILTERTYPE_filter.js +++ b/cypress/integration/common/view/add_a_FILTERTYPE_filter.js @@ -13,18 +13,36 @@ const FACILITY_TYPE = 'Clinic' When('I add a {string} filter', (dimensionType) => { cy.contains('Add filter').click() - // open the dimensions modal - cy.get(filterDimensionsPanelSel).contains(dimensionType).click() - // select an item in the modal - if (dimensionType === 'Period') { - cy.get(unselectedItemsSel).contains(PERIOD).dblclick() - } else if (dimensionType === 'Organisation unit') { - cy.get(orgUnitTreeSel, EXTENDED_TIMEOUT) - .find('[type="checkbox"]', EXTENDED_TIMEOUT) - .check(OU_ID) - } else { - cy.get(unselectedItemsSel).contains(FACILITY_TYPE).dblclick() + switch (dimensionType) { + case 'Period': + cy.get(filterDimensionsPanelSel).contains(dimensionType).click() + cy.get(unselectedItemsSel).contains(PERIOD).dblclick() + break + case 'Organisation unit': + cy.get(filterDimensionsPanelSel).contains(dimensionType).click() + cy.get(orgUnitTreeSel, EXTENDED_TIMEOUT) + .find('[type="checkbox"]', EXTENDED_TIMEOUT) + .check(OU_ID) + break + case 'Org unit group': + cy.get(filterDimensionsPanelSel) + .contains('Organisation unit') + .click() + cy.getByDataTest('org-unit-group-select').click() + cy.getByDataTest('dhis2-uicore-select-menu-menuwrapper') + .contains('District') + .click() + // close the popup + cy.getByDataTest('dhis2-uicore-select-menu-menuwrapper') + .closest('[data-test="dhis2-uicore-layer"]') + // . closest() + .click('topLeft') + break + + default: + cy.get(filterDimensionsPanelSel).contains(dimensionType).click() + cy.get(unselectedItemsSel).contains(FACILITY_TYPE).dblclick() } // confirm to apply the filter diff --git a/cypress/integration/view/dashboard_filter.feature b/cypress/integration/view/dashboard_filter.feature index b40594040..dba070671 100644 --- a/cypress/integration/view/dashboard_filter.feature +++ b/cypress/integration/view/dashboard_filter.feature @@ -2,7 +2,7 @@ Feature: Dashboard filter Scenario: I add a Period filter When I start a new dashboard - And I add a MAP and a CHART and save + And I add items and save Then the dashboard displays in view mode When I add a "Period" filter Then the Period filter is applied to the dashboard @@ -19,6 +19,12 @@ Feature: Dashboard filter When I add a "Facility Type" filter Then the Facility Type filter is applied to the dashboard + Scenario: I add a Org unit group filter + Given I open existing dashboard + Then the dashboard displays in view mode + When I add a "Org unit group" filter + Then the Org unit group filter is applied to the dashboard + Scenario: I can access the dimensions modal from the filter badge Given I open existing dashboard When I add a "Period" filter diff --git a/cypress/integration/view/dashboard_filter/create_dashboard.js b/cypress/integration/view/dashboard_filter/create_dashboard.js index 3b8ad09ab..82af2a163 100644 --- a/cypress/integration/view/dashboard_filter/create_dashboard.js +++ b/cypress/integration/view/dashboard_filter/create_dashboard.js @@ -9,6 +9,7 @@ import { dashboardChipSel, dashboardTitleSel, } from '../../../elements/viewDashboard.js' +import { getApiBaseUrl } from '../../../support/server/utils.js' import { EXTENDED_TIMEOUT, createDashboardTitle, @@ -16,42 +17,70 @@ import { const TEST_DASHBOARD_TITLE = createDashboardTitle('af') -When('I add a MAP and a CHART and save', () => { - //add the title - cy.get('[data-test="dashboard-title-input"]').type(TEST_DASHBOARD_TITLE) +const customApp = { + name: 'Users-Role-Monitor-Widget', + id: '5e43908a-3105-4baa-9a00-87a94ebdc034', +} - // add items - cy.get('[data-test="item-search"]').click() - cy.get('[data-test="item-search"]') - .find('input') - .type('Inpatient', { force: true }) +When('I add items and save', () => { + // first install a custom app + cy.request('POST', `${getApiBaseUrl()}/api/appHub/${customApp.id}`).then( + (response) => { + expect(response.status).to.eq(204) - //chart - cy.get( - '[data-test="menu-item-Inpatient: BMI this year by districts"]' - ).click() + //add the dashboard title + cy.get('[data-test="dashboard-title-input"]').type( + TEST_DASHBOARD_TITLE + ) - cy.get('[data-test="dhis2-uicore-layer"]').click('topLeft') + // open item selector + cy.get('[data-test="item-search"]').click() + cy.get('[data-test="item-search"]') + .find('input') + .type('Inpatient', { force: true }) - cy.get('[data-test="item-search"]').click() - cy.get('[data-test="item-search"]') - .find('input') - .type('ipt 2', { force: true }) + //CHART + cy.get( + '[data-test="menu-item-Inpatient: BMI this year by districts"]' + ).click() - //map - cy.get('[data-test="menu-item-ANC: IPT 2 Coverage this year"]').click() + cy.get('[data-test="dhis2-uicore-layer"]').click('topLeft') - cy.get('[data-test="dhis2-uicore-layer"]').click('topLeft') + cy.get('[data-test="item-search"]').click() + cy.get('[data-test="item-search"]') + .find('input') + .type('ipt 2', { force: true }) - //move things so the dashboard is more compact - // eslint-disable-next-line cypress/unsafe-to-chain-command - cy.get(`${gridItemSel}.MAP`) - .trigger('mousedown') - .trigger('mousemove', { clientX: 650 }) - .trigger('mouseup') + //MAP + cy.get( + '[data-test="menu-item-ANC: IPT 2 Coverage this year"]' + ).click() - //save - cy.get('button').contains('Save changes', EXTENDED_TIMEOUT).click() + // close the item selector + cy.get('[data-test="dhis2-uicore-layer"]').click('topLeft') + + //add a custom app item + cy.get('[data-test="item-search"]').click() + cy.get('[data-test="item-search"]') + .find('input') + .type('Role Monitor', { force: true }) + + cy.contains('Role Monitor Widget').click() + + // close the item selector + cy.get('[data-test="dhis2-uicore-layer"]').click('topLeft') + + //move things so the dashboard is more compact + // eslint-disable-next-line cypress/unsafe-to-chain-command + cy.get(`${gridItemSel}.MAP`) + .trigger('mousedown') + .trigger('mousemove', { clientX: 650 }) + .trigger('mouseup') + + //save + cy.get('button').contains('Save changes', EXTENDED_TIMEOUT).click() + } + ) }) Given('I open existing dashboard', () => { @@ -84,4 +113,7 @@ Then('different dashboard displays in view mode', () => { cy.get(dashboardTitleSel) .should('be.visible') .and('not.contain', TEST_DASHBOARD_TITLE) + + // remove the custom app + // cy.request('DELETE', `${getApiBaseUrl()}/api/apps/${customApp.name}`) }) diff --git a/cypress/integration/view/dashboard_filter/dashboard_filter.js b/cypress/integration/view/dashboard_filter/dashboard_filter.js index 38439dde1..de4f51ea7 100644 --- a/cypress/integration/view/dashboard_filter/dashboard_filter.js +++ b/cypress/integration/view/dashboard_filter/dashboard_filter.js @@ -90,6 +90,23 @@ Then('the Facility Type filter is applied to the dashboard', () => { // .should('be.visible') }) +Then('the Org unit group filter is applied to the dashboard', () => { + // check that the filter badge is correct + cy.get(filterBadgeSel) + .contains('Organisation unit: District') + .should('be.visible') + + // check that the custom app is loaded (see ticket DHIS2-14544) + cy.get('iframe') + .invoke('attr', 'title') + .contains('Role Monitor Widget') + .scrollIntoView() + cy.get('iframe') + .invoke('attr', 'title') + .contains('Role Monitor Widget') + .should('be.visible') +}) + Then('the filter modal is opened', () => { cy.get(dimensionsModalSel, EXTENDED_TIMEOUT).should('be.visible') }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 000000000..bc732e6d7 --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,25 @@ +Cypress.Commands.add('getByDataTest', (selector, ...args) => + cy.get(`[data-test=${selector}]`, ...args) +) +Cypress.Commands.add( + 'findByDataTest', + { + prevSubject: true, + }, + (subject, selector, ...args) => + cy.wrap(subject).find(`[data-test="${selector}"]`, ...args) +) + +Cypress.Commands.add( + 'containsExact', + { + prevSubject: 'optional', + }, + (subject, selector) => + cy.wrap(subject).contains( + new RegExp( + `^${selector.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}$`, //eslint-disable-line no-useless-escape + 'gm' + ) + ) +) diff --git a/cypress/support/index.js b/cypress/support/index.js index 1b2720c19..356da91ea 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -1,6 +1,7 @@ import { enableAutoLogin } from '@dhis2/cypress-commands' import { enableNetworkShim } from './server/index.js' import { getDefaultMode, isStubMode } from './server/utils.js' +import './commands.js' enableNetworkShim() From 8122f93186a1af014c30d41b69d61fe02223d1a6 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 5 Sep 2023 09:34:03 +0200 Subject: [PATCH 5/6] chore: delete the app after the test is complete --- cypress/integration/view/dashboard_filter/create_dashboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/view/dashboard_filter/create_dashboard.js b/cypress/integration/view/dashboard_filter/create_dashboard.js index 82af2a163..55a200d99 100644 --- a/cypress/integration/view/dashboard_filter/create_dashboard.js +++ b/cypress/integration/view/dashboard_filter/create_dashboard.js @@ -115,5 +115,5 @@ Then('different dashboard displays in view mode', () => { .and('not.contain', TEST_DASHBOARD_TITLE) // remove the custom app - // cy.request('DELETE', `${getApiBaseUrl()}/api/apps/${customApp.name}`) + cy.request('DELETE', `${getApiBaseUrl()}/api/apps/${customApp.name}`) }) From cdc37127145bb10a9caab75ca0b65acc1bdd21dd Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 5 Sep 2023 14:44:19 +0200 Subject: [PATCH 6/6] chore: remove commented line --- cypress/integration/common/view/add_a_FILTERTYPE_filter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/integration/common/view/add_a_FILTERTYPE_filter.js b/cypress/integration/common/view/add_a_FILTERTYPE_filter.js index c7c2be135..76f1c1dca 100644 --- a/cypress/integration/common/view/add_a_FILTERTYPE_filter.js +++ b/cypress/integration/common/view/add_a_FILTERTYPE_filter.js @@ -36,7 +36,6 @@ When('I add a {string} filter', (dimensionType) => { // close the popup cy.getByDataTest('dhis2-uicore-select-menu-menuwrapper') .closest('[data-test="dhis2-uicore-layer"]') - // . closest() .click('topLeft') break