Skip to content

Commit

Permalink
Update E2E tests after community supervision / current offence task c…
Browse files Browse the repository at this point in the history
…hanges
  • Loading branch information
Patrick Fleming committed Jan 7, 2025
1 parent 97fa642 commit bb820bb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
7 changes: 5 additions & 2 deletions e2e-tests/steps/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
} from './aboutThePersonSection'
import { completeHealthNeedsTask, completeRiskToSelfTask, completeRoshTask } from './risksAndNeedsSection'
import { completeAreaInformationTask, completeFundingInformationTask } from './areaAndFundingSection'
import { completeCurrentOffencesTask, completeOffenceHistoryTask } from './offenceAndLicenceInformationSection'
import {
completeCommunitySupervisionAndCurrentOffencesTask,
completeOffenceHistoryTask,
} from './offenceAndLicenceInformationSection'
import { completeCheckAnswersTask } from './checkAnswersSection'
import { TestOptions } from '../testOptions'
import {
Expand Down Expand Up @@ -75,7 +78,7 @@ export const completeRisksAndNeedsSection = async (page: Page, name: string) =>
}

export const completeOffenceInformationSection = async (page: Page, name: string) => {
await completeCurrentOffencesTask(page, name)
await completeCommunitySupervisionAndCurrentOffencesTask(page, name)
await completeOffenceHistoryTask(page, name)
}

Expand Down
21 changes: 19 additions & 2 deletions e2e-tests/steps/offenceAndLicenceInformationSection.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
import { Page } from '@playwright/test'
import { ApplyPage, TaskListPage } from '../pages/apply'

export const completeCurrentOffencesTask = async (page: Page, name: string) => {
export const completeCommunitySupervisionAndCurrentOffencesTask = async (page: Page, name: string) => {
const taskListPage = new TaskListPage(page)
await taskListPage.clickTask('Add current offences')
await taskListPage.clickTask('Community supervision and current offences')

await completeCommunitySupervisionPage(page, name)
await completeCPPDetailsPage(page, name)
await completeCurrentOffenceDetailsPage(page, name)
await completeCurrentOffencesPage(page, name)
}

async function completeCommunitySupervisionPage(page: Page, name: string) {
const communitySupervisionPage = await ApplyPage.initialize(page, `Is ${name} currently supervised by probation?`)
await communitySupervisionPage.checkRadio('Yes')
await communitySupervisionPage.clickButton('Save and continue')
}

async function completeCPPDetailsPage(page: Page, name: string) {
const cppDetailsPage = await ApplyPage.initialize(page, `Who is ${name}'s Community Probation Practitioner (CPP)?`)
await cppDetailsPage.fillField('Full name', 'A. CPP')
await cppDetailsPage.fillField('Probation region', 'south')
await cppDetailsPage.fillField('Contact email address', '[email protected]')
await cppDetailsPage.fillField('Contact number', '12345')
await cppDetailsPage.clickSave()
}

async function completeCurrentOffenceDetailsPage(page: Page, name: string) {
const currentOffenceDetailsPage = await ApplyPage.initialize(page, `Add ${name}'s current offence details`)
await currentOffenceDetailsPage.fillField('Offence title', 'Stalking')
Expand Down

0 comments on commit bb820bb

Please sign in to comment.