Skip to content

Commit

Permalink
chore: consolidate new and confirmLeav
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Oct 24, 2023
1 parent 952529f commit e317fa8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
60 changes: 29 additions & 31 deletions cypress/integration/confirmLeave.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,35 @@ import {
import { TEST_AOS } from '../utils/data.js'
import { getRandomArrayItem } from '../utils/random.js'

describe('confirm leave modal', () => {
test('confirm leave modal', () => {
const TEST_AO = getRandomArrayItem(TEST_AOS)
// navigates to the start page and loads a random saved AO
goToStartPage()
openAOByName(TEST_AO.name)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToNotBeDirty()

it('navigates to the start page and loads a random saved AO', () => {
goToStartPage()
openAOByName(TEST_AO.name)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToNotBeDirty()
})
it(`replaces the selected period`, () => {
replacePeriodItems(TEST_AO.type)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToBeDirty()
})
it('tries to open a new AO', () => {
createNewAO()
expectConfirmLeaveModalToBeVisible()
})
it('cancels leave', () => {
confirmLeave(false)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToBeDirty()
})
it('tries to open a new AO', () => {
createNewAO()
expectConfirmLeaveModalToBeVisible()
})
it('confirms leave', () => {
confirmLeave(true)
expectStartScreenToBeVisible()
expectVisualizationToNotBeVisible()
expectAOTitleToNotBeDirty()
})
// replaces the selected period
replacePeriodItems(TEST_AO.type)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToBeDirty()

// tries to open a new AO
createNewAO()
expectConfirmLeaveModalToBeVisible()

// cancels leave
confirmLeave(false)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToBeDirty()

// tries to open a new AO
createNewAO()
expectConfirmLeaveModalToBeVisible()

// confirms leave
confirmLeave(true)
expectStartScreenToBeVisible()
expectVisualizationToNotBeVisible()
expectAOTitleToNotBeDirty()
})
12 changes: 7 additions & 5 deletions cypress/integration/new.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ describe('creating a new AO', () => {
visTypes.forEach((visType) => {
const visTypeName = visTypeDisplayNames[visType]
describe(visTypeName, () => {
it('creates a new AO', () => {
it(`create AO of type ${visTypeName}`, () => {
// creates a new AO
createNewAO()
expectStoreCurrentToBeEmpty()
expectVisualizationToNotBeVisible()
expectVisTypeToBeDefault()
})
it('changes vis type', () => {

// changes vis type
changeVisType(visTypeName)
expectVisTypeToBeValue(visTypeName)
})
it('adds dimensions', () => {

// adds dimensions
openDimension(DIMENSION_ID_DATA)

if (visType === VIS_TYPE_SCATTER) {
Expand Down Expand Up @@ -90,6 +91,7 @@ describe('creating a new AO', () => {
)
}
})

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

0 comments on commit e317fa8

Please sign in to comment.