Skip to content

Commit

Permalink
Merge pull request #175 from DEFRA/Fix-user-journey-tests
Browse files Browse the repository at this point in the history
Fix for user journey tests
  • Loading branch information
joseluisgraa authored Jan 30, 2025
2 parents 0d80197 + 6fb590e commit 01922a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions user-journey-tests/helpers/testHelpers/destination.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import taskListPage from '../../page-objects/taskListPage.js'
import { selectElement } from '../page.js'
import destinationSelectionPage from '../../page-objects/destination/destinationSelectionPage.js'
import generalLicencePage from '../../page-objects/destination/generalLicencePage.js'
import destinationAnswersPage from '../../page-objects/destination/destinationAnswersPage.js'

// Helper function to complete the origin task
const completeDestinationTask = async (radioType) => {
Expand All @@ -27,6 +28,7 @@ const completeDestinationTask = async (radioType) => {
default:
throw new Error(`Unsupported radio type: ${radioType}`)
}
await destinationAnswersPage.verifyPageHeadingAndTitle()
}

export default completeDestinationTask
1 change: 1 addition & 0 deletions user-journey-tests/helpers/testHelpers/receivingLicence.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const completeLicenceTask = async ({
await ownerNamePage.inputNameAndContinue(firstName, lastName)
await receiveMethodPage.selectEmailAndContinue()
await emailPage.inputEmailAndContinue(email)
await licenceAnswersPage.verifyPageHeadingAndTitle()
await validateElementVisibleAndText(licenceAnswersPage.emailValue, email)
}

Expand Down
13 changes: 5 additions & 8 deletions user-journey-tests/specs/finalAnswers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ const completeApplication = async () => {
}

describe('Check your final answers test', () => {
// eslint-disable-next-line
before('Navigate to check answers page', completeApplication)
beforeEach(async () => {
await browser.deleteAllCookies()
await completeApplication()
})

it('Should verify the back link is history -1', async () => {
await taskListPage.navigateToPageAndVerifyTitle()
Expand Down Expand Up @@ -148,7 +150,7 @@ describe('Check your final answers test', () => {

it('Should verify the existing email and confirm resubmission', async () => {
await finalAnswersPage.navigateToPageAndVerifyTitle()
validateAndAdjustEmail(
await validateAndAdjustEmail(
finalAnswersPage.emailChange,
finalAnswersPage.emailValue,
emailDefault,
Expand Down Expand Up @@ -183,11 +185,6 @@ describe('Check your final answers test', () => {
})

describe('declarations', () => {
beforeEach(async () => {
await browser.deleteAllCookies()
await completeApplication()
})

it('Should submit the page after selecting first declaration', async () => {
await finalAnswersPage.navigateToPageAndVerifyTitle()
await finalAnswersPage.selectADeclarationAndContinue()
Expand Down

0 comments on commit 01922a8

Please sign in to comment.