Skip to content

Commit

Permalink
chore: test cleanup and use non-recording e2e-prod
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Oct 25, 2023
1 parent 001eb6c commit e9c64fe
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 241 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:

call-workflow-e2e-prod:
needs: [build, lint, test]
uses: dhis2/workflows/.github/workflows/analytics-e2e-tests.yml@master
uses: dhis2/line-listing-app/.github/workflows/e2e-prod.yml@e2e-prod-maps
secrets:
baseurl: ${{ secrets.CYPRESS_DHIS2_BASE_URL_DEV }}
username: ${{ secrets.CYPRESS_DHIS2_USERNAME }}
Expand Down
81 changes: 39 additions & 42 deletions cypress/integration/new.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,64 +41,61 @@ const TEST_INDICATOR_NAMES = TEST_INDICATORS.slice(1, 3).map(
)

describe('creating a new AO', () => {
it('navigates to the start page', () => {
goToStartPage()
})
visTypes.forEach((visType) => {
const visTypeName = visTypeDisplayNames[visType]
describe(visTypeName, () => {
it(`create AO of type ${visTypeName}`, () => {
// creates a new AO
createNewAO()
expectStoreCurrentToBeEmpty()
expectVisualizationToNotBeVisible()
expectVisTypeToBeDefault()
it(`create AO of type ${visTypeName}`, () => {
// navigates to start page
goToStartPage()

// changes vis type
changeVisType(visTypeName)
expectVisTypeToBeValue(visTypeName)
// creates a new AO
createNewAO()
expectStoreCurrentToBeEmpty()
expectVisualizationToNotBeVisible()
expectVisTypeToBeDefault()

// adds dimensions
openDimension(DIMENSION_ID_DATA)
// changes vis type
changeVisType(visTypeName)
expectVisTypeToBeValue(visTypeName)

if (visType === VIS_TYPE_SCATTER) {
selectIndicators(TEST_INDICATOR_NAMES.slice(0, 1))
switchDataTab('Horizontal')
selectDataElements(TEST_DATA_ELEMENT_NAMES.slice(0, 1))
} else {
if (getAxisMaxNumberOfItems(visType, TEST_AXIS_ID) === 1) {
// Gauge and SV can only have 1 data item
TEST_DATA_ELEMENT_NAMES.splice(1)
}
// adds dimensions
openDimension(DIMENSION_ID_DATA)

selectDataElements(TEST_DATA_ELEMENT_NAMES)
if (visType === VIS_TYPE_SCATTER) {
selectIndicators(TEST_INDICATOR_NAMES.slice(0, 1))
switchDataTab('Horizontal')
selectDataElements(TEST_DATA_ELEMENT_NAMES.slice(0, 1))
} else {
if (getAxisMaxNumberOfItems(visType, TEST_AXIS_ID) === 1) {
// Gauge and SV can only have 1 data item
TEST_DATA_ELEMENT_NAMES.splice(1)
}

clickDimensionModalUpdateButton()
selectDataElements(TEST_DATA_ELEMENT_NAMES)
}

clickDimensionModalUpdateButton()

expectVisualizationToBeVisible(visType)
expectVisualizationToBeVisible(visType)

isYearOverYear(visType) && expectAOTitleToBeUnsaved()
isYearOverYear(visType) && expectAOTitleToBeUnsaved()

// FIXME: Store is always in default state
/* !isYearOverYear(visType)
// FIXME: Store is always in default state
/* !isYearOverYear(visType)
? expectStoreCurrentColumnsToHaveLength(1)
: expectAOTitleToBeUnsaved() */

if (visType !== VIS_TYPE_SCATTER) {
TEST_DATA_ELEMENT_NAMES.forEach((item) =>
expectChartToContainDimensionItem(visType, item)
)
}
})
if (visType !== VIS_TYPE_SCATTER) {
TEST_DATA_ELEMENT_NAMES.forEach((item) =>
expectChartToContainDimensionItem(visType, item)
)
}

if ([VIS_TYPE_SINGLE_VALUE, VIS_TYPE_GAUGE].includes(visType)) {
it('Data is locked to Series', () => {
expectDimensionOnAxisToHaveLockIcon(
DIMENSION_ID_DATA,
AXIS_ID_COLUMNS
)
})
// Data is locked to Series
expectDimensionOnAxisToHaveLockIcon(
DIMENSION_ID_DATA,
AXIS_ID_COLUMNS
)
}
})
})
Expand Down
Loading

0 comments on commit e9c64fe

Please sign in to comment.