Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cypress/elements/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions cypress/elements/dimensionModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export {

export {
selectRelativePeriods,
selectFixedPeriodYear,
selectFixedPeriods,
expectPeriodDimensionModalToBeVisible,
expectRelativePeriodTypeToBe,
Expand Down
7 changes: 7 additions & 0 deletions cypress/elements/dimensionModal/periodDimension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/customErrors/visualizationError.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/interpretations.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VIS_TYPE_BAR } from '@dhis2/analytics'
import { VIS_TYPE_LINE } from '@dhis2/analytics'
import {
expectAOTitleToBeValue,
expectVisualizationToBeVisible,
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions cypress/integration/options/cumulativeValues.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -175,10 +176,11 @@ describe('Options - Cumulative values', () => {
openContextMenu(DIMENSION_ID_PERIOD)
clickContextMenuMove(DIMENSION_ID_PERIOD, AXIS_ID_COLUMNS)

const year = new Date().getFullYear().toString()
const year = (new Date().getFullYear() - 1).toString()

openDimension(DIMENSION_ID_PERIOD)
unselectAllItemsByButton()
selectFixedPeriodYear(year)
selectFixedPeriods(
[`October ${year}`, `November ${year}`, `December ${year}`],
'Monthly'
Expand Down Expand Up @@ -251,9 +253,10 @@ describe('Options - Cumulative values', () => {
selectDataItems(['BCG doses'])
clickDimensionModalHideButton()

const year = new Date().getFullYear().toString()
const year = (new Date().getFullYear() - 1).toString()
openDimension(DIMENSION_ID_PERIOD)
unselectAllItemsByButton()
selectFixedPeriodYear(year)
selectFixedPeriods([`October ${year}`], 'Monthly')

clickDimensionModalHideButton()
Expand Down
14 changes: 8 additions & 6 deletions cypress/integration/options/limitValues.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
clickDimensionModalUpdateButton,
unselectAllItemsByButton,
selectFixedPeriods,
selectFixedPeriodYear,
} from '../../elements/dimensionModal/index.js'
import { openDimension } from '../../elements/dimensionsPanel.js'
import {
Expand Down Expand Up @@ -39,7 +40,7 @@ import {
import { changeVisType } from '../../elements/visualizationTypeSelector.js'

const TEST_INDICATOR = 'ANC visits total'
const currentYear = new Date().getFullYear().toString()
const year = (new Date().getFullYear() - 1).toString()
const expectTableValueToBe = (value, position) =>
cy
.getBySel('visualization-container')
Expand All @@ -61,13 +62,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'
)
Expand Down
10 changes: 7 additions & 3 deletions cypress/integration/options/totals.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
selectAllItemsByButton,
selectDataElements,
selectDataItems,
selectFixedPeriodYear,
selectFixedPeriods,
unselectAllItemsByButton,
} from '../../elements/dimensionModal/index.js'
Expand Down Expand Up @@ -68,9 +69,10 @@ describe('Options - Column totals', () => {
selectDataElements(['ART enrollment stage 1'])
clickDimensionModalHideButton()

const year = new Date().getFullYear().toString()
const year = (new Date().getFullYear() - 1).toString()
openDimension(DIMENSION_ID_PERIOD)
unselectAllItemsByButton()
selectFixedPeriodYear(year)
selectFixedPeriods(
[`May ${year}`, `June ${year}`, `July ${year}`],
'Monthly'
Expand All @@ -95,9 +97,10 @@ describe('Options - Column totals', () => {
])
clickDimensionModalHideButton()

const year = new Date().getFullYear().toString()
const year = (new Date().getFullYear() - 1).toString()
openDimension(DIMENSION_ID_PERIOD)
unselectAllItemsByButton()
selectFixedPeriodYear(year)
selectFixedPeriods(
[
`January ${year}`,
Expand Down Expand Up @@ -158,9 +161,10 @@ describe('Options - Row totals', () => {
selectDataItems(['BCG doses'])
clickDimensionModalHideButton()

const year = new Date().getFullYear().toString()
const year = (new Date().getFullYear() - 1).toString()
openDimension(DIMENSION_ID_PERIOD)
unselectAllItemsByButton()
selectFixedPeriodYear(year)
selectFixedPeriods([`October ${year}`], 'Monthly')

clickDimensionModalUpdateButton()
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/save.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
selectIndicators,
selectDataElements,
clickDimensionModalUpdateButton,
deselectOrgUnitTreeItem,
selectOrgUnitTreeItem,
} from '../elements/dimensionModal/index.js'
import { openDimension } from '../elements/dimensionsPanel.js'
import {
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cypress/utils/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
{
Expand Down
Loading