diff --git a/cypress/elements/common.js b/cypress/elements/common.js index 2ff7ba0562..8bbf07033f 100644 --- a/cypress/elements/common.js +++ b/cypress/elements/common.js @@ -35,14 +35,12 @@ export const replacePeriodItems = ( if (isYearOverYear(visType)) { const TEST_PERIOD = !useAltData ? 'Last 2 six-months' - : 'Quarters per year' + : 'Last 4 quarters' selectYoyCategoryOption(TEST_PERIOD) clickMenuBarUpdateButton() } else { const TEST_PERIOD_TYPE = !useAltData ? 'Six-months' : 'Quarters' - const TEST_PERIOD = !useAltData - ? 'Last 2 six-month' - : 'Quarters this year' + const TEST_PERIOD = !useAltData ? 'Last 2 six-month' : 'Last 4 quarters' openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() selectRelativePeriods([TEST_PERIOD], TEST_PERIOD_TYPE) diff --git a/cypress/elements/dimensionModal/index.js b/cypress/elements/dimensionModal/index.js index 42a8d2d064..335a85e00f 100644 --- a/cypress/elements/dimensionModal/index.js +++ b/cypress/elements/dimensionModal/index.js @@ -139,6 +139,7 @@ export { export { selectRelativePeriods, + selectFixedPeriodYear, selectFixedPeriods, expectPeriodDimensionModalToBeVisible, expectRelativePeriodTypeToBe, diff --git a/cypress/elements/dimensionModal/periodDimension.js b/cypress/elements/dimensionModal/periodDimension.js index e5e4aa7782..d3f10b7528 100644 --- a/cypress/elements/dimensionModal/periodDimension.js +++ b/cypress/elements/dimensionModal/periodDimension.js @@ -41,6 +41,13 @@ export const selectFixedPeriods = (periods, periodType) => { periods.forEach((item) => clickSourceOption(item)) } +export const selectFixedPeriodYear = (year) => { + switchToFixedPeriods() + cy.getBySel('period-dimension-fixed-period-filter-year-content') + .clear() + .type(year) +} + const clickSourceOption = (itemName) => cy.getBySel(selectableItemsEl).contains(itemName).dblclick() diff --git a/cypress/helpers/period.js b/cypress/helpers/period.js new file mode 100644 index 0000000000..2af779fcf1 --- /dev/null +++ b/cypress/helpers/period.js @@ -0,0 +1,5 @@ +const getPreviousYearStr = () => (new Date().getFullYear() - 1).toString() + +const getCurrentYearStr = () => new Date().getFullYear().toString() + +export { getPreviousYearStr, getCurrentYearStr } diff --git a/cypress/integration/customErrors/visualizationError.cy.js b/cypress/integration/customErrors/visualizationError.cy.js index 669d1d6847..cecb535818 100644 --- a/cypress/integration/customErrors/visualizationError.cy.js +++ b/cypress/integration/customErrors/visualizationError.cy.js @@ -38,10 +38,10 @@ describe('Visualization error', () => { goToStartPage() changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) - // select period 'This year' + // select period 'Last year' openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() - selectRelativePeriods(['This year'], 'Years') + selectRelativePeriods(['Last year'], 'Years') clickDimensionModalUpdateButton() // select a narrative item diff --git a/cypress/integration/interpretations.cy.js b/cypress/integration/interpretations.cy.js index c710a3d4a3..a2a2889314 100644 --- a/cypress/integration/interpretations.cy.js +++ b/cypress/integration/interpretations.cy.js @@ -1,4 +1,4 @@ -import { VIS_TYPE_BAR } from '@dhis2/analytics' +import { VIS_TYPE_LINE } from '@dhis2/analytics' import { expectAOTitleToBeValue, expectVisualizationToBeVisible, @@ -9,8 +9,8 @@ import { goToStartPage } from '../elements/startScreen.js' describe('Interpretations', () => { it('opens the interpretations modal on a saved AO', () => { const ao = { - name: 'ANC: 1 and 3 coverage Yearly', - type: VIS_TYPE_BAR, + name: 'ANC: 1-3 trend lines last 12 months', + type: VIS_TYPE_LINE, } // Open the saved AO diff --git a/cypress/integration/options/cumulativeValues.cy.js b/cypress/integration/options/cumulativeValues.cy.js index dd0102460a..2758ae8b88 100644 --- a/cypress/integration/options/cumulativeValues.cy.js +++ b/cypress/integration/options/cumulativeValues.cy.js @@ -23,6 +23,7 @@ import { selectDataItems, selectFixedPeriods, unselectAllItemsByButton, + selectFixedPeriodYear, } from '../../elements/dimensionModal/index.js' import { openDimension } from '../../elements/dimensionsPanel.js' import { clickContextMenuMove, openContextMenu } from '../../elements/layout.js' @@ -53,6 +54,7 @@ import { } from '../../elements/pivotTable.js' import { goToStartPage } from '../../elements/startScreen.js' import { changeVisType } from '../../elements/visualizationTypeSelector.js' +import { getPreviousYearStr } from '../../helpers/period.js' import { TEST_DATA_ELEMENTS } from '../../utils/data.js' const cumulativeValuesOptionEl = 'option-cumulative-values' @@ -175,10 +177,11 @@ describe('Options - Cumulative values', () => { openContextMenu(DIMENSION_ID_PERIOD) clickContextMenuMove(DIMENSION_ID_PERIOD, AXIS_ID_COLUMNS) - const year = new Date().getFullYear().toString() + const year = getPreviousYearStr() openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() + selectFixedPeriodYear(year) selectFixedPeriods( [`October ${year}`, `November ${year}`, `December ${year}`], 'Monthly' @@ -251,9 +254,10 @@ describe('Options - Cumulative values', () => { selectDataItems(['BCG doses']) clickDimensionModalHideButton() - const year = new Date().getFullYear().toString() + const year = getPreviousYearStr() openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() + selectFixedPeriodYear(year) selectFixedPeriods([`October ${year}`], 'Monthly') clickDimensionModalHideButton() diff --git a/cypress/integration/options/limitValues.cy.js b/cypress/integration/options/limitValues.cy.js index 33dce7fe02..3f05d3c762 100644 --- a/cypress/integration/options/limitValues.cy.js +++ b/cypress/integration/options/limitValues.cy.js @@ -11,6 +11,7 @@ import { clickDimensionModalUpdateButton, unselectAllItemsByButton, selectFixedPeriods, + selectFixedPeriodYear, } from '../../elements/dimensionModal/index.js' import { openDimension } from '../../elements/dimensionsPanel.js' import { @@ -37,9 +38,10 @@ import { goToStartPage, } from '../../elements/startScreen.js' import { changeVisType } from '../../elements/visualizationTypeSelector.js' +import { getPreviousYearStr } from '../../helpers/period.js' const TEST_INDICATOR = 'ANC visits total' -const currentYear = new Date().getFullYear().toString() +const year = getPreviousYearStr() const expectTableValueToBe = (value, position) => cy .getBySel('visualization-container') @@ -61,13 +63,14 @@ describe('limit values', () => { clickDimensionModalUpdateButton() openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() + selectFixedPeriodYear(year) selectFixedPeriods( [ - `January ${currentYear}`, - `February ${currentYear}`, - `March ${currentYear}`, - `April ${currentYear}`, - `May ${currentYear}`, + `January ${year}`, + `February ${year}`, + `March ${year}`, + `April ${year}`, + `May ${year}`, ], 'Monthly' ) diff --git a/cypress/integration/options/totals.cy.js b/cypress/integration/options/totals.cy.js index 6c00216af8..2f8acdea10 100644 --- a/cypress/integration/options/totals.cy.js +++ b/cypress/integration/options/totals.cy.js @@ -16,6 +16,7 @@ import { selectAllItemsByButton, selectDataElements, selectDataItems, + selectFixedPeriodYear, selectFixedPeriods, unselectAllItemsByButton, } from '../../elements/dimensionModal/index.js' @@ -42,6 +43,7 @@ import { } from '../../elements/pivotTable.js' import { goToStartPage } from '../../elements/startScreen.js' import { changeVisType } from '../../elements/visualizationTypeSelector.js' +import { getPreviousYearStr } from '../../helpers/period.js' import { TEST_CUSTOM_DIMENSIONS } from '../../utils/data.js' const AREA_DIMENSION = TEST_CUSTOM_DIMENSIONS.find((dim) => dim.name === 'Area') @@ -68,9 +70,10 @@ describe('Options - Column totals', () => { selectDataElements(['ART enrollment stage 1']) clickDimensionModalHideButton() - const year = new Date().getFullYear().toString() + const year = getPreviousYearStr() openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() + selectFixedPeriodYear(year) selectFixedPeriods( [`May ${year}`, `June ${year}`, `July ${year}`], 'Monthly' @@ -95,9 +98,10 @@ describe('Options - Column totals', () => { ]) clickDimensionModalHideButton() - const year = new Date().getFullYear().toString() + const year = getPreviousYearStr() openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() + selectFixedPeriodYear(year) selectFixedPeriods( [ `January ${year}`, @@ -158,9 +162,10 @@ describe('Options - Row totals', () => { selectDataItems(['BCG doses']) clickDimensionModalHideButton() - const year = new Date().getFullYear().toString() + const year = getPreviousYearStr() openDimension(DIMENSION_ID_PERIOD) unselectAllItemsByButton() + selectFixedPeriodYear(year) selectFixedPeriods([`October ${year}`], 'Monthly') clickDimensionModalUpdateButton() diff --git a/cypress/integration/save.cy.js b/cypress/integration/save.cy.js index 70c983dd9a..ba43444a71 100644 --- a/cypress/integration/save.cy.js +++ b/cypress/integration/save.cy.js @@ -17,7 +17,7 @@ import { selectIndicators, selectDataElements, clickDimensionModalUpdateButton, - deselectOrgUnitTreeItem, + selectOrgUnitTreeItem, } from '../elements/dimensionModal/index.js' import { openDimension } from '../elements/dimensionsPanel.js' import { @@ -185,7 +185,7 @@ describe('saving an AO', () => { }) it('"save" a copied AO created by others works after editing', () => { - const TEST_VIS_BY_OTHERS_NAME = 'ANC: 1-3 dropout rate Yearly' + const TEST_VIS_BY_OTHERS_NAME = 'ANC: 1-3 trend lines last 12 months' const TEST_VIS_BY_OTHERS_NAME_UPDATED = `${TEST_VIS_BY_OTHERS_NAME} - updated` // navigates to the start page and opens an AO created by others @@ -200,7 +200,7 @@ describe('saving an AO', () => { // edits the AO openDimension(DIMENSION_ID_ORGUNIT) - deselectOrgUnitTreeItem('Western Area') + selectOrgUnitTreeItem('Western Area') clickDimensionModalUpdateButton() // saves AO using "Save" diff --git a/cypress/utils/data.js b/cypress/utils/data.js index c107228a98..bcbba9a84e 100644 --- a/cypress/utils/data.js +++ b/cypress/utils/data.js @@ -47,7 +47,7 @@ export const visTypes = [ export const TEST_AOS = [ { - name: 'Commodities: Child health consumption districts this year', + name: 'ANC: ANC 3 coverage by districts last 12 months', type: VIS_TYPE_COLUMN, }, { diff --git a/package.json b/package.json index 662d43a8e4..a059ad039a 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "typescript": "^4.8.4" }, "dependencies": { - "@dhis2/analytics": "^26.9.3", + "@dhis2/analytics": "^26.10.0", "@dhis2/app-runtime": "^3.10.4", "@dhis2/app-runtime-adapter-d2": "^1.1.0", "@dhis2/app-service-datastore": "^1.0.0-beta.3", diff --git a/yarn.lock b/yarn.lock index 8b9bd52a7b..9f7e3298f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2050,10 +2050,10 @@ classnames "^2.3.1" prop-types "^15.7.2" -"@dhis2/analytics@^26.9.3": - version "26.9.3" - resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-26.9.3.tgz#bcb550e2e87f931622c4fe04c40711464f0d5989" - integrity sha512-MFA4Q8MpzDO4o3e+Oy1dZcQSxTc/AqFzdcQrln37DOpA1iUF5ZpiU17CdwDNdvZ6DjVZF6/GQNFnzPzLJ3svIw== +"@dhis2/analytics@^26.10.0": + version "26.10.0" + resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-26.10.0.tgz#6be4f7ad13b4a64e63f330255f0bbc57aa118ff2" + integrity sha512-JmJFXsxnpoQ1KDoAYttygp7bsP76EpLVRaXDk5bGoye7lhG+Q2k0DW3q+hj9H3tIdwV1m3N1mIxzAMzG01QEtw== dependencies: "@dhis2/multi-calendar-dates" "^1.2.2" "@dnd-kit/core" "^6.0.7"