Skip to content

Commit

Permalink
chore: one more
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Oct 30, 2023
1 parent 22206b5 commit 8e9e2df
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions cypress/integration/confirmLeave.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,37 @@ import {
import { TEST_AOS } from '../utils/data.js'
import { getRandomArrayItem } from '../utils/random.js'

test('Confirm leave modal preserves AO changes when user cancels leave, and discards changes when user approves leave', () => {
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()
describe('Confirm leave modal', () => {
it('Confirm leave modal preserves AO changes when user cancels leave, and discards changes when user approves leave', () => {
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()

// replaces the selected period
replacePeriodItems(TEST_AO.type)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToBeDirty()
// replaces the selected period
replacePeriodItems(TEST_AO.type)
expectVisualizationToBeVisible(TEST_AO.type)
expectAOTitleToBeDirty()

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

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

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

// confirms leave
confirmLeave(true)
expectStartScreenToBeVisible()
expectVisualizationToNotBeVisible()
expectAOTitleToNotBeDirty()
// confirms leave
confirmLeave(true)
expectStartScreenToBeVisible()
expectVisualizationToNotBeVisible()
expectAOTitleToNotBeDirty()
})
})

0 comments on commit 8e9e2df

Please sign in to comment.