generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update E2E tests after community supervision / current offence task c…
…hanges
- Loading branch information
Patrick Fleming
committed
Jan 7, 2025
1 parent
97fa642
commit bb820bb
Showing
2 changed files
with
24 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
|