Skip to content

Commit

Permalink
Update e2e tests with solicitor details task
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Liburd committed Jan 15, 2025
1 parent 134448e commit 0b2b79b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
8 changes: 7 additions & 1 deletion e2e-tests/steps/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { Page, expect } from '@playwright/test'
import { faker } from '@faker-js/faker/locale/en_GB'

import { BeforeYouStartPage, DashboardPage, FindByPrisonNumberPage, TaskListPage } from '../pages/apply'
import { completeConsentTask, completeEligibilityTask, completeReferrerDetailsTask } from './beforeYouStartSection'
import {
completeConsentTask,
completeEligibilityTask,
completeReferrerDetailsTask,
completeSolicitorDetailsTask,
} from './beforeYouStartSection'
import {
completeAddressHistoryTask,
completeEqualityAndDiversityTask,
Expand Down Expand Up @@ -53,6 +58,7 @@ export const completeBeforeYouStartSection = async (page: Page, name: string) =>
await completeEligibilityTask(page, name)
await completeConsentTask(page, name)
await completeReferrerDetailsTask(page)
await completeSolicitorDetailsTask(page)
}

export const completeAreaAndFundingSection = async (page: Page, name: string) => {
Expand Down
17 changes: 17 additions & 0 deletions e2e-tests/steps/beforeYouStartSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,20 @@ async function completeContactNumberPage(page: Page) {

await confirmDetailsPage.clickSave()
}

export const completeSolicitorDetailsTask = async (page: Page) => {
const taskListPage = new TaskListPage(page)
await taskListPage.clickTask('Add solicitor details')

await completeSolicitorContactInformationPage(page)
}

async function completeSolicitorContactInformationPage(page: Page) {
const bailHearingContactPage = await ApplyPage.initialize(page, "Add solicitor's contact information")

await bailHearingContactPage.fillField('Full name', 'Jay Legal')
await bailHearingContactPage.fillField('Legal firm address', 'Legal Firm, 1 Winchester Road, X14 3UF')
await bailHearingContactPage.fillField('Email address', '[email protected]')
await bailHearingContactPage.fillField('Phone number', '11111111111')
await bailHearingContactPage.clickButton('Save and continue')
}
2 changes: 1 addition & 1 deletion e2e-tests/tests/01_apply_as_pom.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('create a CAS-2 application', async ({ page, person, pomUser }) => {
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 expect(page.getByText('You have completed 19 of 19 tasks')).toBeVisible()
await submitApplication(page)
})

Expand Down

0 comments on commit 0b2b79b

Please sign in to comment.