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.
- Loading branch information
Daniel Liburd
committed
Feb 12, 2025
1 parent
116ff35
commit a041ef7
Showing
6 changed files
with
90 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { BasePage } from '../basePage' | ||
|
||
export class FindByCrnPage extends BasePage { | ||
async enterCrn(crn: string) { | ||
await this.page.getByLabel("Enter the person's CRN").fill(crn) | ||
} | ||
} | ||
|
||
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
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { expect } from '@playwright/test' | ||
import { test } from '../test' | ||
import { | ||
completeAboutThePersonSection, | ||
completeAreaAndFundingSection, | ||
completeBeforeYouStartSection, | ||
completeCheckAnswersSection, | ||
completeOffenceInformationSection, | ||
completeRisksAndNeedsSection, | ||
completeBailInformationSection, | ||
confirmApplicant, | ||
enterCrn, | ||
selectApplicationOrigin, | ||
startAnApplication, | ||
submitApplication, | ||
viewSubmittedApplication, | ||
addNote, | ||
viewInProgressDashboard, | ||
createAnInProgressApplication, | ||
} from '../steps/apply' | ||
import { signIn } from '../steps/signIn' | ||
import { cancelAnApplication, clickCancel } from '../steps/cancelInProgressApplication' | ||
|
||
test('create a CAS-2 bail application', async ({ page, person, bioUser }) => { | ||
await signIn(page, bioUser) | ||
await startAnApplication(page) | ||
await selectApplicationOrigin(page, 'courtBail') | ||
await enterCrn(page, person.crn) | ||
await confirmApplicant(page) | ||
await completeBeforeYouStartSection(page, person.name) | ||
await completeAreaAndFundingSection(page, person.name) | ||
await completeAboutThePersonSection(page, person.name) | ||
await completeRisksAndNeedsSection(page, person.name) | ||
await completeOffenceInformationSection(page, person.name) | ||
await completeBailInformationSection(page, person.name) | ||
await completeCheckAnswersSection(page, person.name) | ||
await expect(page.getByText('You have completed 18 of 18 tasks')).toBeVisible() | ||
await submitApplication(page) | ||
}) | ||
|
||
test('add a note to a submitted application', async ({ page, person, bioUser }) => { | ||
await signIn(page, bioUser) | ||
await viewSubmittedApplication(page, person.name) | ||
await addNote(page) | ||
await expect(page.locator('.moj-timeline__title').first()).toContainText('Note') | ||
}) | ||
|
||
test('cancel an in progress application from the task list', async ({ page, bioUser, person }) => { | ||
await signIn(page, bioUser) | ||
await createAnInProgressApplication(page, person, 'courtBail') | ||
await viewInProgressDashboard(page) | ||
const numberOfApplicationsBeforeCancellation = (await page.locator('tr').all()).length | ||
await clickCancel(page, person.name) | ||
await cancelAnApplication(page, person.name) | ||
const numberOfApplicationsAfterCancellation = (await page.locator('tr').all()).length | ||
await expect(page.getByText('Your CAS-2 applications')).toBeVisible() | ||
expect(numberOfApplicationsBeforeCancellation - numberOfApplicationsAfterCancellation).toEqual(1) | ||
}) |