diff --git a/playwright-e2e/fixtures/create-fixture.ts b/playwright-e2e/fixtures/create-fixture.ts new file mode 100644 index 000000000..c166b37dd --- /dev/null +++ b/playwright-e2e/fixtures/create-fixture.ts @@ -0,0 +1,214 @@ +import { test as base } from '@playwright/test'; + +import { CITApplyingWithPage } from '../page-objects/citizen/applying/citApplyingWithPage.page'; +import { CITChildDoBPage } from '../page-objects/citizen/child-details/citChildDoBPage.page'; +import { CITChildFullNameAfterAdoptionPage } from '../page-objects/citizen/child-details/citChildFullNameAfterAdoptionPage.page'; +import { CITChildFullNamePage } from '../page-objects/citizen/child-details/citChildFullNamePage.page'; +import { CITDateChildMovedInPage } from '../page-objects/citizen/date-child-moved-in/citDateChildMovedInPage.page'; +import { CITSubmittedPage } from '../page-objects/citizen/payments/citSubmittedPage.page'; +import { CITTaskListPage } from '../page-objects/citizen/task-list/citTaskListPage.page'; +import { LAChildNationalityPage } from '../page-objects/local-authority/birth-certificate/laChildNationalityPage.page'; +import { LAChildSexAtBirthPage } from '../page-objects/local-authority/birth-certificate/laChildSexAtBirthPage.page'; +import { LABirthFatherLastDateConfirmedAddressPage } from '../page-objects/local-authority/birth-father/laBirthFatherLastDateConfirmedAddressPage.page'; +import { LABirthFatherLastKnownAddressBranchPage } from '../page-objects/local-authority/birth-father/laBirthFatherLastKnownAddressBranchPage.page'; +import { LABirthFatherNamePage } from '../page-objects/local-authority/birth-father/laBirthFatherNamePage.page'; +import { LABirthFatherNationalityPage } from '../page-objects/local-authority/birth-father/laBirthFatherNationalityPage.page'; +import { LABirthFatherOccupationPage } from '../page-objects/local-authority/birth-father/laBirthFatherOccupationPage.page'; +import { LABirthFatherOnCertficatePage } from '../page-objects/local-authority/birth-father/laBirthFatherOnCertificatePage.page'; +import { LABirthFatherParentalResponsibilityGrantedPage } from '../page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityGrantedPage.page'; +import { LABirthFatherParentalResponsibilityPage } from '../page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityPage.page'; +import { LABirthFatherServeDocumentsPage } from '../page-objects/local-authority/birth-father/laBirthFatherServeDocumentsPage.page'; +import { LABirthFatherStillAliveStatusPage } from '../page-objects/local-authority/birth-father/laBirthFatherStillAliveStatusPage.page'; +import { LABirthFatherLastKnownAddressPage } from '../page-objects/local-authority/birth-father/lsBirthFatherLastKnownAddressPage.page'; +import { LABirthMotherAliveStatusPage } from '../page-objects/local-authority/birth-mother/laBirthMotherAliveStatusPage.page'; +import { LABirthMotherLastDateConfirmedAddressPage } from '../page-objects/local-authority/birth-mother/laBirthMotherLastDateConfirmedAddressPage.page'; +import { LABirthMotherLastKnownAddressBranchPage } from '../page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressBranchPage.page'; +import { LABirthMotherLastKnownAddressPage } from '../page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressPage.page'; +import { LABirthMotherNamePage } from '../page-objects/local-authority/birth-mother/laBirthMotherNamePage.page'; +import { LABirthMotherNationalityPage } from '../page-objects/local-authority/birth-mother/laBirthMotherNationalityPage.page'; +import { LABirthMotherOccupationPage } from '../page-objects/local-authority/birth-mother/laBirthMotherOccupationPage.page'; +import { LABirthMotherServeDocumentsPage } from '../page-objects/local-authority/birth-mother/laBirthMotherServeDocumentsPage.page'; +import { LAUploadDocumentsPage } from '../page-objects/local-authority/document-upload/laUploadDocuments.page'; +import { LACheckYourAnswerPage } from '../page-objects/local-authority/laCheckYourAnswer.page'; +import { LAChildDetailsPage } from '../page-objects/local-authority/laChildDetailsPage.page'; +import { LAConfirmationPage } from '../page-objects/local-authority/laConfirmationPage.page'; +import { LAGettingStartedPage } from '../page-objects/local-authority/laGettingStartedPage.page'; +import { LASignInPage } from '../page-objects/local-authority/laSignInPage.page'; +import { LAStatementOfTruthPage } from '../page-objects/local-authority/laStatementOfTruth.page'; +import { LAOtherPersonResponsibilityPage } from '../page-objects/local-authority/other-person/laOtherPersonResponsibilityPage.page'; +import { LAPlacementDateOfOrderPage } from '../page-objects/local-authority/placement/laPlacementDateOfOrderPage.page'; +import { LAPlacementOrderNumberPage } from '../page-objects/local-authority/placement/laPlacementOrderNumberPage.page'; +import { LAPlacementOrdersSummaryPage } from '../page-objects/local-authority/placement/laPlacementOrdersSummaryPage.page'; +import { LAChildHasOtherSiblingsPage } from '../page-objects/local-authority/siblings/laSiblingCourtDetailsSection.page'; +import SignIn from '../pages/signInPage.page'; + +type CreateFixtures = { + signIn: SignIn; + citApplyingWithPage: CITApplyingWithPage; + citTaskListPage: CITTaskListPage; + citDateChildMovedInPage: CITDateChildMovedInPage; + citChildFullNamePage: CITChildFullNamePage; + citChildFullNameAfterAdoptionPage: CITChildFullNameAfterAdoptionPage; + citChildDoBPage: CITChildDoBPage; + citSubmittedPage: CITSubmittedPage; + laSignInPage: LASignInPage; + laGettingStartedPage: LAGettingStartedPage; + laChildSexAtBirthPage: LAChildSexAtBirthPage; + laChildDetailsPage: LAChildDetailsPage; + laChildNationalityPage: LAChildNationalityPage; + laBirthMotherNamePage: LABirthMotherNamePage; + laBirthMotherAliveStatusPage: LABirthMotherAliveStatusPage; + laBirthMotherNationalityPage: LABirthMotherNationalityPage; + laBirthMotherOccupationPage: LABirthMotherOccupationPage; + laBirthMotherLastKnownAddressBranchPage: LABirthMotherLastKnownAddressBranchPage; + laBirthMotherLastKnownAddressPage: LABirthMotherLastKnownAddressPage; + laBirthMotherLastDateConfirmedAddressPage: LABirthMotherLastDateConfirmedAddressPage; + laBirthMotherServeDocumentsPage: LABirthMotherServeDocumentsPage; + laBirthFatherOnCertificatePage: LABirthFatherOnCertficatePage; + laBirthFatherNamePage: LABirthFatherNamePage; + laBirthFatherStillAliveStatusPage: LABirthFatherStillAliveStatusPage; + laBirthFatherParentalResponsibilityPage: LABirthFatherParentalResponsibilityPage; + laBirthFatherParentalResponsibilityGrantedPage: LABirthFatherParentalResponsibilityGrantedPage; + laBirthFatherNationalityPage: LABirthFatherNationalityPage; + laBirthFatherOccupationPage: LABirthFatherOccupationPage; + laBirthFatherLastKnownAddressBranchPage: LABirthFatherLastKnownAddressBranchPage; + laBirthFatherLastKnownAddressPage: LABirthFatherLastKnownAddressPage; + laBirthFatherLastDateConfirmedAddressPage: LABirthFatherLastDateConfirmedAddressPage; + laBirthFatherServeDocumentsPage: LABirthFatherServeDocumentsPage; + laOtherPersonResponsibilityPage: LAOtherPersonResponsibilityPage; + laPlacementOrderNumberPage: LAPlacementOrderNumberPage; + laPlacementDateOfOrderPage: LAPlacementDateOfOrderPage; + laPlacementOrdersSummaryPage: LAPlacementOrdersSummaryPage; + laChildHasOtherSiblingsPage: LAChildHasOtherSiblingsPage; + laUploadDocumentsPage: LAUploadDocumentsPage; + laCheckYourAnswerPage: LACheckYourAnswerPage; + laStatementOfTruthPage: LAStatementOfTruthPage; + laConfirmationPage: LAConfirmationPage; +}; + +export const test = base.extend({ + signIn: async ({ page }, use) => { + await use(new SignIn(page)); + }, + citApplyingWithPage: async ({ page }, use) => { + await use(new CITApplyingWithPage(page)); + }, + citTaskListPage: async ({ page }, use) => { + await use(new CITTaskListPage(page)); + }, + citDateChildMovedInPage: async ({ page }, use) => { + await use(new CITDateChildMovedInPage(page)); + }, + citChildFullNamePage: async ({ page }, use) => { + await use(new CITChildFullNamePage(page)); + }, + citChildFullNameAfterAdoptionPage: async ({ page }, use) => { + await use(new CITChildFullNameAfterAdoptionPage(page)); + }, + citChildDoBPage: async ({ page }, use) => { + await use(new CITChildDoBPage(page)); + }, + citSubmittedPage: async ({ page }, use) => { + await use(new CITSubmittedPage(page)); + }, + laSignInPage: async ({ page }, use) => { + await use(new LASignInPage(page)); + }, + laGettingStartedPage: async ({ page }, use) => { + await use(new LAGettingStartedPage(page)); + }, + laChildDetailsPage: async ({ page }, use) => { + await use(new LAChildDetailsPage(page)); + }, + laChildSexAtBirthPage: async ({ page }, use) => { + await use(new LAChildSexAtBirthPage(page)); + }, + laChildNationalityPage: async ({ page }, use) => { + await use(new LAChildNationalityPage(page)); + }, + laBirthMotherNamePage: async ({ page }, use) => { + await use(new LABirthMotherNamePage(page)); + }, + laBirthMotherAliveStatusPage: async ({ page }, use) => { + await use(new LABirthMotherAliveStatusPage(page)); + }, + laBirthMotherNationalityPage: async ({ page }, use) => { + await use(new LABirthMotherNationalityPage(page)); + }, + laBirthMotherOccupationPage: async ({ page }, use) => { + await use(new LABirthMotherOccupationPage(page)); + }, + laBirthMotherLastKnownAddressBranchPage: async ({ page }, use) => { + await use(new LABirthMotherLastKnownAddressBranchPage(page)); + }, + laBirthMotherLastKnownAddressPage: async ({ page }, use) => { + await use(new LABirthMotherLastKnownAddressPage(page)); + }, + laBirthMotherLastDateConfirmedAddressPage: async ({ page }, use) => { + await use(new LABirthMotherLastDateConfirmedAddressPage(page)); + }, + laBirthMotherServeDocumentsPage: async ({ page }, use) => { + await use(new LABirthMotherServeDocumentsPage(page)); + }, + laBirthFatherOnCertificatePage: async ({ page }, use) => { + await use(new LABirthFatherOnCertficatePage(page)); + }, + laBirthFatherNamePage: async ({ page }, use) => { + await use(new LABirthFatherNamePage(page)); + }, + laBirthFatherStillAliveStatusPage: async ({ page }, use) => { + await use(new LABirthFatherStillAliveStatusPage(page)); + }, + laBirthFatherParentalResponsibilityPage: async ({ page }, use) => { + await use(new LABirthFatherParentalResponsibilityPage(page)); + }, + laBirthFatherParentalResponsibilityGrantedPage: async ({ page }, use) => { + await use(new LABirthFatherParentalResponsibilityGrantedPage(page)); + }, + laBirthFatherNationalityPage: async ({ page }, use) => { + await use(new LABirthFatherNationalityPage(page)); + }, + laBirthFatherOccupationPage: async ({ page }, use) => { + await use(new LABirthFatherOccupationPage(page)); + }, + laBirthFatherLastKnownAddressBranchPage: async ({ page }, use) => { + await use(new LABirthFatherLastKnownAddressBranchPage(page)); + }, + laBirthFatherLastKnownAddressPage: async ({ page }, use) => { + await use(new LABirthFatherLastKnownAddressPage(page)); + }, + laBirthFatherLastDateConfirmedAddressPage: async ({ page }, use) => { + await use(new LABirthFatherLastDateConfirmedAddressPage(page)); + }, + laBirthFatherServeDocumentsPage: async ({ page }, use) => { + await use(new LABirthFatherServeDocumentsPage(page)); + }, + laOtherPersonResponsibilityPage: async ({ page }, use) => { + await use(new LAOtherPersonResponsibilityPage(page)); + }, + laPlacementOrderNumberPage: async ({ page }, use) => { + await use(new LAPlacementOrderNumberPage(page)); + }, + laPlacementDateOfOrderPage: async ({ page }, use) => { + await use(new LAPlacementDateOfOrderPage(page)); + }, + laPlacementOrdersSummaryPage: async ({ page }, use) => { + await use(new LAPlacementOrdersSummaryPage(page)); + }, + laChildHasOtherSiblingsPage: async ({ page }, use) => { + await use(new LAChildHasOtherSiblingsPage(page)); + }, + laUploadDocumentsPage: async ({ page }, use) => { + await use(new LAUploadDocumentsPage(page)); + }, + laCheckYourAnswerPage: async ({ page }, use) => { + await use(new LACheckYourAnswerPage(page)); + }, + laStatementOfTruthPage: async ({ page }, use) => { + await use(new LAStatementOfTruthPage(page)); + }, + // eslint-disable-next-line no-empty-pattern + laConfirmationPage: async ({}, use) => { + await use(new LAConfirmationPage()); + }, +}); diff --git a/playwright-e2e/fixtures/fixtures.ts b/playwright-e2e/fixtures/fixtures.ts index a9da8b692..ffe3d36e7 100644 --- a/playwright-e2e/fixtures/fixtures.ts +++ b/playwright-e2e/fixtures/fixtures.ts @@ -2,5 +2,7 @@ import { mergeExpects, mergeTests } from '@playwright/test'; import { expect as a11yExpect, test as a11yTest } from '../utils/axe-test'; -export const test = mergeTests(a11yTest); +import { test as create } from './create-fixture'; + +export const test = mergeTests(create, a11yTest); export const expect = mergeExpects(a11yExpect); diff --git a/playwright-e2e/helpers/e2eJourneyHelper.ts b/playwright-e2e/helpers/e2eJourneyHelper.ts index fdcccea61..23dbde7a6 100644 --- a/playwright-e2e/helpers/e2eJourneyHelper.ts +++ b/playwright-e2e/helpers/e2eJourneyHelper.ts @@ -6,6 +6,7 @@ export async function citizenAdoptionSignInWithNoPartner( userPassword: string, locator: string ): Promise { + await app.signIn.navigateTo(); await app.signIn.signIn(userEmail, userPassword); await app.numberOfApplicants.numberOfApplication(locator); await app.numberOfApplicants.fillNotSpouseOrCivilPartnerDetails('Text to be randomly generated'); @@ -19,6 +20,7 @@ export async function citizenAdoptionSignInWithPartner( userPassword: string, locator: string ): Promise { + await app.signIn.navigateTo(); await app.signIn.signIn(userEmail, userPassword); await app.numberOfApplicants.numberOfApplication(locator); await app.basePage.clickSaveAndContinue(); diff --git a/playwright-e2e/page-objects/citizen/applying/citApplyingWithPage.page.ts b/playwright-e2e/page-objects/citizen/applying/citApplyingWithPage.page.ts new file mode 100644 index 000000000..4cb0fbe7b --- /dev/null +++ b/playwright-e2e/page-objects/citizen/applying/citApplyingWithPage.page.ts @@ -0,0 +1,52 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class CITApplyingWithPage extends BasePage { + readonly applicationDetailsTitle: Locator; + readonly applicationWithHeading: Locator; + + readonly applyingWithGroup: Locator; + + readonly applyingOnMyOwnRadioButton: Locator; + readonly applyingWithSpouseRadioButton: Locator; + readonly applyingWithPartnerNotSpouseRadioButton: Locator; + + readonly contactUsForHelpDropdownLink: Locator; + readonly contactACourtHeading: Locator; + + readonly errorSummary: Locator; + + constructor(page: Page) { + super(page); + this.applicationDetailsTitle = page.getByText('Application details'); + this.applicationWithHeading = page.getByRole('heading', { name: 'Are you applying on your own' }); + + this.applyingWithGroup = page.getByRole('group', { name: 'Are you applying on your own, or with someone else?' }); + + this.applyingOnMyOwnRadioButton = this.applyingWithGroup.getByLabel("I'm applying on my own"); + this.applyingWithSpouseRadioButton = this.applyingWithGroup.getByLabel("I'm applying with my spouse"); + this.applyingWithPartnerNotSpouseRadioButton = this.applyingWithGroup.getByLabel("I'm applying with someone who"); + + this.contactUsForHelpDropdownLink = page.locator('summary') || page.getByText('Contact us for help'); + this.contactACourtHeading = page.getByRole('heading', { name: 'Contact a court that deals' }); + + this.errorSummary = page.locator('div.govuk-error-summar'); + } + + async checkApplyingOnMyOwnRadioButton(): Promise { + await this.applyingOnMyOwnRadioButton.check(); + } + + async checkApplyingWithSpouseRadioButton(): Promise { + await this.applyingWithSpouseRadioButton.check(); + } + + async checkApplyingWithPartnerNotSpouseRadioButton(): Promise { + await this.applyingWithPartnerNotSpouseRadioButton.check(); + } + + async clickContactUsForHelpDropDownLink(): Promise { + await this.contactACourtHeading.click(); + } +} diff --git a/playwright-e2e/page-objects/citizen/child-details/citChildDoBPage.page.ts b/playwright-e2e/page-objects/citizen/child-details/citChildDoBPage.page.ts new file mode 100644 index 000000000..4d3c7129c --- /dev/null +++ b/playwright-e2e/page-objects/citizen/child-details/citChildDoBPage.page.ts @@ -0,0 +1,72 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class CITChildDoBPage extends BasePage { + readonly childDetailsTitle: Locator; + readonly childDoBHeading: Locator; + + readonly dayText: Locator; + readonly monthText: Locator; + readonly yearText: Locator; + + readonly dayLabel: Locator; + readonly monthLabel: Locator; + readonly yearLabel: Locator; + + readonly contactUsForHelpDropdownLink: Locator; + readonly contactACourtHeading: Locator; + readonly findACourtLink: Locator; + + readonly errorDateSummary: Locator; + readonly errorDaySummary: Locator; + readonly errorMonthSummary: Locator; + readonly errorYearSummary: Locator; + readonly errorDayMonthSummary: Locator; + readonly errorDayYearSummary: Locator; + readonly errorMonthYearSummary: Locator; + readonly realDateSummary: Locator; + readonly errorOver18Summary: Locator; + readonly errorDateInPastSummary: Locator; + + constructor(page: Page) { + super(page); + this.childDetailsTitle = page.getByText("The child's details"); + this.childDoBHeading = page.getByRole('heading', { name: "What is the child's date of" }); + + this.dayText = page.getByText('Day'); + this.monthText = page.getByText('Month', { exact: true }); + this.yearText = page.getByText('Year', { exact: true }); + + this.dayLabel = page.getByRole('textbox', { name: 'Day' }); + this.monthLabel = page.getByRole('textbox', { name: 'Month' }); + this.yearLabel = page.getByRole('textbox', { name: 'Year' }); + + this.contactUsForHelpDropdownLink = page.getByText('Contact us for help'); + this.contactACourtHeading = page.getByRole('heading', { name: 'Contact a court that deals' }); + this.findACourtLink = page.getByRole('link', { name: 'Find a Court or Tribunal' }); + + this.errorDateSummary = page.getByRole('link', { name: 'Enter their date of birth' }); + this.errorDaySummary = page.getByRole('link', { name: 'Date of birth must include a day' }); + this.errorMonthSummary = page.getByRole('link', { name: 'Date of birth must include a month' }); + this.errorYearSummary = page.getByRole('link', { name: 'Date of birth must include a year' }); + this.errorDayMonthSummary = page.getByRole('link', { name: 'Date of birth must include a day and month' }); + this.errorDayYearSummary = page.getByRole('link', { name: 'Date of birth must include a day and year' }); + this.errorMonthYearSummary = page.getByRole('link', { name: 'Date of birth must include a month and year' }); + this.realDateSummary = page.getByRole('link', { name: 'Date of birth must be a real date' }); + this.errorOver18Summary = page.getByRole('link', { name: 'Child is 18 or over and cannot be adopted' }); + this.errorDateInPastSummary = page.getByRole('link', { name: 'Date of birth must be in the past' }); + } + + async fillDayLabel(day: string): Promise { + await this.dayLabel.fill(day); + } + + async fillMonthLabel(month: string): Promise { + await this.monthLabel.fill(month); + } + + async fillYearLabel(year: string): Promise { + await this.yearLabel.fill(year); + } +} diff --git a/playwright-e2e/page-objects/citizen/child-details/citChildFullNameAfterAdoptionPage.page.ts b/playwright-e2e/page-objects/citizen/child-details/citChildFullNameAfterAdoptionPage.page.ts new file mode 100644 index 000000000..34fee3d63 --- /dev/null +++ b/playwright-e2e/page-objects/citizen/child-details/citChildFullNameAfterAdoptionPage.page.ts @@ -0,0 +1,42 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class CITChildFullNameAfterAdoptionPage extends BasePage { + readonly childDetailsTitle: Locator; + readonly childFullNameAfterAdoptionHeading: Locator; + + readonly firstName: Locator; + readonly lastName: Locator; + + readonly contactUsForHelpDropdownLink: Locator; + readonly contactACourtHeading: Locator; + readonly findACourtLink: Locator; + + readonly errorFirstNameSummary: Locator; + readonly errorLastNameSummary: Locator; + + constructor(page: Page) { + super(page); + this.childDetailsTitle = page.getByText("The child's details"); + this.childFullNameAfterAdoptionHeading = page.getByRole('heading', { name: 'After adoption, what will be' }); + + this.firstName = page.getByLabel('First names'); + this.lastName = page.getByLabel('Last names'); + + this.contactUsForHelpDropdownLink = page.getByText('Contact us for help'); + this.contactACourtHeading = page.getByRole('heading', { name: 'Contact a court that deals' }); + this.findACourtLink = page.getByRole('link', { name: 'Find a Court or Tribunal' }); + + this.errorFirstNameSummary = page.getByRole('link', { name: 'Enter their first names' }); + this.errorLastNameSummary = page.getByRole('link', { name: 'Enter their last names' }); + } + + async fillFirstNameLabel(firstName: string): Promise { + await this.firstName.fill(firstName); + } + + async fillLastNameLabel(lastName: string): Promise { + await this.lastName.fill(lastName); + } +} diff --git a/playwright-e2e/page-objects/citizen/child-details/citChildFullNamePage.page.ts b/playwright-e2e/page-objects/citizen/child-details/citChildFullNamePage.page.ts new file mode 100644 index 000000000..5d086940c --- /dev/null +++ b/playwright-e2e/page-objects/citizen/child-details/citChildFullNamePage.page.ts @@ -0,0 +1,42 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class CITChildFullNamePage extends BasePage { + readonly childDetailsTitle: Locator; + readonly childFullNameHeading: Locator; + + readonly firstName: Locator; + readonly lastName: Locator; + + readonly contactUsForHelpDropdownLink: Locator; + readonly contactACourtHeading: Locator; + readonly findACourtLink: Locator; + + readonly errorFirstNameSummary: Locator; + readonly errorLastNameSummary: Locator; + + constructor(page: Page) { + super(page); + this.childDetailsTitle = page.getByText("The child's details"); + this.childFullNameHeading = page.getByLabel('First names'); + + this.firstName = page.getByLabel('First names'); + this.lastName = page.getByLabel('Last names'); + + this.contactUsForHelpDropdownLink = page.getByText('Contact us for help'); + this.contactACourtHeading = page.getByRole('heading', { name: 'Contact a court that deals' }); + this.findACourtLink = page.getByRole('link', { name: 'Find a Court or Tribunal' }); + + this.errorFirstNameSummary = page.getByRole('link', { name: "Enter the child's first names" }); + this.errorLastNameSummary = page.getByRole('link', { name: "Enter the child's last names" }); + } + + async fillFirstNameLabel(firstName: string): Promise { + await this.firstName.fill(firstName); + } + + async fillLastNameLabel(lastName: string): Promise { + await this.lastName.fill(lastName); + } +} diff --git a/playwright-e2e/page-objects/citizen/date-child-moved-in/citDateChildMovedInPage.page.ts b/playwright-e2e/page-objects/citizen/date-child-moved-in/citDateChildMovedInPage.page.ts new file mode 100644 index 000000000..b98b77108 --- /dev/null +++ b/playwright-e2e/page-objects/citizen/date-child-moved-in/citDateChildMovedInPage.page.ts @@ -0,0 +1,64 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class CITDateChildMovedInPage extends BasePage { + readonly applicationDetailsTitle: Locator; + readonly childMoveInHeading: Locator; + + readonly day: Locator; + readonly month: Locator; + readonly year: Locator; + + readonly applicationTooltip: Locator; + + readonly contactUsForHelpDropdownLink: Locator; + readonly contactACourtHeading: Locator; + readonly findACourtLink: Locator; + + readonly errorDateSummary: Locator; + readonly errorDaySummary: Locator; + readonly errorMonthSummary: Locator; + readonly errorMonthAndYearSummary: Locator; + readonly errorYearSummary: Locator; + readonly errorRealDateSummary: Locator; + + constructor(page: Page) { + super(page); + this.applicationDetailsTitle = page.getByText('Application details'); + this.childMoveInHeading = page.getByRole('heading', { name: 'When did the child move in' }); + + this.day = page.getByLabel('Day'); + this.month = page.getByLabel('Month'); + this.year = page.getByLabel('Year'); + + this.applicationTooltip = page.getByText('Warning You can begin your'); + + this.contactUsForHelpDropdownLink = page.getByText('Contact us for help'); + this.contactACourtHeading = page.getByRole('heading', { name: 'Contact a court that deals' }); + this.findACourtLink = page.getByRole('link', { name: 'Find a Court or Tribunal' }); + + this.errorDateSummary = page.getByRole('link', { name: 'Enter the date the child' }); + this.errorDaySummary = page.getByRole('link', { name: 'Enter the day the child moved' }); + this.errorMonthSummary = page.getByRole('link', { name: 'Enter the month the child' }); + this.errorMonthAndYearSummary = page.getByRole('link', { name: 'Enter the month and year the' }); + this.errorYearSummary = page.getByRole('link', { name: 'Enter the year the child' }); + this.errorRealDateSummary = page.getByRole('link', { name: 'Must be a real date' }); + } + + async fillDayLabel(day: string): Promise { + await this.day.fill(day); + } + + async fillMonthLabel(month: string): Promise { + await this.month.fill(month); + } + + async fillYearLabel(year: string): Promise { + await this.year.fill(year); + } + + async clickContactUsForHelpDropDownLink(): Promise { + await this.contactACourtHeading.click(); + } +} diff --git a/playwright-e2e/page-objects/citizen/payments/citSubmittedPage.page.ts b/playwright-e2e/page-objects/citizen/payments/citSubmittedPage.page.ts new file mode 100644 index 000000000..4bc4db263 --- /dev/null +++ b/playwright-e2e/page-objects/citizen/payments/citSubmittedPage.page.ts @@ -0,0 +1,25 @@ +import { Locator, Page } from '@playwright/test'; + +export class CITSubmittedPage { + referenceNumber!: string; + + readonly signOutLink: Locator; + + constructor(page: Page) { + this.signOutLink = page.getByRole('link', { name: 'Sign out' }); + } + + async initialiseReferenceNumber(page: Page): Promise { + this.referenceNumber = await this.getReferenceNumber(page); + } + + async getReferenceNumber(page: Page): Promise { + const element = await page.locator('.govuk-panel.govuk-panel--confirmation .govuk-panel__body strong').first(); + const referenceNum: string | null = await element.textContent(); + return referenceNum ? referenceNum.replace(/-/g, '') : ''; + } + + async clickSignOutLink(): Promise { + await this.signOutLink.click(); + } +} diff --git a/playwright-e2e/page-objects/citizen/task-list/citTaskListPage.page.ts b/playwright-e2e/page-objects/citizen/task-list/citTaskListPage.page.ts new file mode 100644 index 000000000..84494c8d2 --- /dev/null +++ b/playwright-e2e/page-objects/citizen/task-list/citTaskListPage.page.ts @@ -0,0 +1,149 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class CITTaskListPage extends BasePage { + readonly applyToAdoptAChildHeading: Locator; + + // first group: Add application details + readonly addApplicationDetailsHeading: Locator; + + readonly numnberOfApplicantsLink: Locator; + readonly numberOfApplicantsStatus: Locator; + + readonly dateChildMovedInLink: Locator; + readonly dateChildMovedInStatus: Locator; + + readonly childDetailsLink: Locator; + readonly childDetailsStatus: Locator; + + readonly adoptionAgencyLink: Locator; + readonly adoptionAgencyStatus: Locator; + + readonly familyCourtLink: Locator; + readonly familyCourtStatus: Locator; + + // second group: Add applicant's details + readonly addApplicantsDetailHeading: Locator; + + // first subgroup: First applicant + + readonly firstApplicantSubheading: Locator; + + readonly firstApplicantPersonalDetailsLink: Locator; + readonly firstApplicantPersonalDetailsStatus: Locator; + + readonly firstApplicantContactDetailsLink: Locator; + readonly firstApplicantContactDetailsStatus: Locator; + + // second subgroup: Second applicant + + readonly secondApplicantSubheading: Locator; + + readonly secondApplicantPersonalDetailsLink: Locator; + readonly secondApplicantPersonalDetailsStatus: Locator; + + readonly secondApplicantContactDetailsLink: Locator; + readonly secondApplicantContactDetailsStatus: Locator; + + // third group: Review and Submit + + readonly reviewAndSubmitSubHeading: Locator; + + readonly reviewPayAndSubmitLink: Locator; + readonly reviewPayAndSubmitStatus: Locator; + + constructor(page: Page) { + super(page); + this.applyToAdoptAChildHeading = page.getByRole('heading', { name: 'Apply to adopt a child placed' }); + + this.addApplicationDetailsHeading = page.getByRole('heading', { name: 'Add application details' }); + + this.numnberOfApplicantsLink = page.getByRole('link', { + name: 'Number of applicants', + }); + this.numberOfApplicantsStatus = page.locator('#applying-with-status'); + + this.dateChildMovedInLink = page.getByRole('link', { name: 'Date child moved in with you' }); + this.dateChildMovedInStatus = page.locator('#date-child-moved-in-status'); + + this.childDetailsLink = page.getByRole('link', { name: "Child's details" }); + this.childDetailsStatus = page.locator('#adoption-certificate-details-status'); + + this.adoptionAgencyLink = page.getByRole('link', { name: 'Adoption agency and social' }); + this.adoptionAgencyStatus = page.locator('#adoption-agency-status'); + + this.familyCourtLink = page.getByRole('link', { name: 'The family court details' }); + this.familyCourtStatus = page.locator('#find-family-court-status'); + + this.addApplicantsDetailHeading = page.getByRole('heading', { name: "Add applicant's details" }); + + this.firstApplicantSubheading = page.getByText('First applicant', { exact: true }); + + this.firstApplicantPersonalDetailsLink = + page.getByRole('link', { name: 'Your personal details' }) || + page.getByRole('link', { name: 'Your personal details First' }); + this.firstApplicantPersonalDetailsStatus = page.locator('#applicant1-personal-details-status'); + + this.firstApplicantContactDetailsLink = + page.getByRole('link', { name: 'Your contact details' }) || + page.getByRole('link', { name: 'Your contact details  First' }); + this.firstApplicantContactDetailsStatus = page.locator('#applicant1-contact-details-status'); + + this.secondApplicantSubheading = page.getByText('Second applicant', { exact: true }); + + this.secondApplicantPersonalDetailsLink = page.getByRole('link', { name: 'Your personal details  Second' }); + this.secondApplicantPersonalDetailsStatus = page.locator('#applicant2-personal-details-status'); + + this.secondApplicantContactDetailsLink = page.getByRole('link', { name: 'Your contact details  Second' }); + this.secondApplicantContactDetailsStatus = page.locator('#applicant2-contact-details-status'); + + this.reviewAndSubmitSubHeading = page.getByRole('heading', { name: 'Review and submit' }); + this.reviewPayAndSubmitLink = page.getByText('Review, pay and submit your'); + this.reviewPayAndSubmitStatus = page.locator('#review-pay-and-submit-status'); + } + + async navigateTo(): Promise { + await this.page.goto('https://adoption-web.aat.platform.hmcts.net/task-list', { waitUntil: 'load', timeout: 300 }); + } + + async clickNumberOfApplicantsLink(): Promise { + await this.numnberOfApplicantsLink.click(); + } + + async clickDateChildMovedInLink(): Promise { + await this.dateChildMovedInLink.click(); + } + + async clickChildDetailsLink(): Promise { + await this.childDetailsLink.click(); + } + + async clickAdoptionAgencyLink(): Promise { + await this.adoptionAgencyLink.click(); + } + + async clickFamilyCourtLink(): Promise { + await this.familyCourtLink.click(); + } + + async clickFirstApplicantPersonalDetailsLink(): Promise { + await this.firstApplicantPersonalDetailsLink.click(); + } + + async clickFirstAppicantContactDetailsLink(): Promise { + await this.firstApplicantContactDetailsLink.click(); + } + + async clickSecondApplicantPersonalDetailsLink(): Promise { + await this.secondApplicantPersonalDetailsLink.click(); + } + + async clickSecondApplicantContactDetailsLink(): Promise { + await this.secondApplicantContactDetailsLink.click(); + } + + async clickReviewPayANdSubmitLink(): Promise { + await this.reviewPayAndSubmitLink.click(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-certificate/laChildNationalityPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-certificate/laChildNationalityPage.page.ts new file mode 100644 index 000000000..5227d225c --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-certificate/laChildNationalityPage.page.ts @@ -0,0 +1,11 @@ +import { Locator, Page } from '@playwright/test'; + +import { NationalityPage } from '../../../pages/nationality.page'; + +export class LAChildNationalityPage extends NationalityPage { + readonly childNationalityHeading: Locator; + constructor(page: Page) { + super(page); + this.childNationalityHeading = page.getByRole('heading', { name: 'What is their nationality?' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-certificate/laChildSexAtBirthPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-certificate/laChildSexAtBirthPage.page.ts new file mode 100644 index 000000000..b194524d7 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-certificate/laChildSexAtBirthPage.page.ts @@ -0,0 +1,41 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAChildSexAtBirthPage extends BasePage { + readonly childSexAtBirthHeading: Locator; + + readonly maleRadioButton: Locator; + readonly femaleRadioButton: Locator; + readonly otherRadioButton: Locator; + + readonly otherSexLabel: Locator; + + constructor(page: Page) { + super(page); + + this.childSexAtBirthHeading = page.getByRole('heading', { name: "What was the child's sex at" }); + + this.maleRadioButton = page.getByLabel('Male', { exact: true }); + this.femaleRadioButton = page.getByLabel('Female', { exact: true }); + this.otherRadioButton = page.getByLabel('Other', { exact: true }); + + this.otherSexLabel = page.getByLabel("For example, if the child's"); + } + + async checkMaleRadioButton(): Promise { + await this.maleRadioButton.check(); + } + + async checkFemaleRadioButton(): Promise { + await this.femaleRadioButton.check(); + } + + async checkOtherRadioButton(): Promise { + await this.otherRadioButton.check(); + } + + async fillOtherSexLabel(): Promise { + await this.otherSexLabel.fill('intersex'); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherLastDateConfirmedAddressPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherLastDateConfirmedAddressPage.page.ts new file mode 100644 index 000000000..dd9ebc001 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherLastDateConfirmedAddressPage.page.ts @@ -0,0 +1,34 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherLastDateConfirmedAddressPage extends BasePage { + readonly birthFatherLastDateConfirmedAddressHeading: Locator; + + readonly dayLabel: Locator; + readonly monthLabel: Locator; + readonly yearLabel: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherLastDateConfirmedAddressHeading = page.getByRole('heading', { + name: 'When was the last date this', + }); + + this.dayLabel = page.getByLabel('Day'); + this.monthLabel = page.getByLabel('Month'); + this.yearLabel = page.getByLabel('Year'); + } + async fillDayLabel(day: string): Promise { + await this.dayLabel.fill(day); + } + + async fillMonthLabel(month: string): Promise { + await this.monthLabel.fill(month); + } + + async fillYearLabel(year: string): Promise { + await this.yearLabel.fill(year); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherLastKnownAddressBranchPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherLastKnownAddressBranchPage.page.ts new file mode 100644 index 000000000..0e85b2f98 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherLastKnownAddressBranchPage.page.ts @@ -0,0 +1,19 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherLastKnownAddressBranchPage extends BasePage { + readonly birthFatherLastKnownAddressHeader: Locator; + + readonly yesRadioButton: Locator; + readonly noRadioButton: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherLastKnownAddressHeader = page.getByRole('heading', { name: 'Do you have the birth father’' }); + + this.yesRadioButton = page.getByLabel('Yes'); + this.noRadioButton = page.getByLabel('No', { exact: true }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherNamePage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherNamePage.page.ts new file mode 100644 index 000000000..127bbc427 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherNamePage.page.ts @@ -0,0 +1,27 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherNamePage extends BasePage { + readonly birthFatherNameHeading: Locator; + + readonly firstNameLabel: Locator; + readonly lastNameLabel: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherNameHeading = page.getByRole('heading', { name: 'What is the full name of the' }); + + this.firstNameLabel = page.getByLabel('First names'); + this.lastNameLabel = page.getByLabel('Last names'); + } + + async fillFirstNameLabel(firstName: string): Promise { + await this.firstNameLabel.fill(firstName); + } + + async fillLastNameLabel(lastName: string): Promise { + await this.lastNameLabel.fill(lastName); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherNationalityPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherNationalityPage.page.ts new file mode 100644 index 000000000..cb0c53385 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherNationalityPage.page.ts @@ -0,0 +1,11 @@ +import { Locator, Page } from '@playwright/test'; + +import { NationalityPage } from '../../../pages/nationality.page'; + +export class LABirthFatherNationalityPage extends NationalityPage { + readonly laBirthFatherNationalityHeader: Locator; + constructor(page: Page) { + super(page); + this.laBirthFatherNationalityHeader = page.getByRole('heading', { name: 'What is the nationality of' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherOccupationPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherOccupationPage.page.ts new file mode 100644 index 000000000..2b9fe6a9f --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherOccupationPage.page.ts @@ -0,0 +1,21 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherOccupationPage extends BasePage { + readonly laBirthFatherOccupationHeader: Locator; + + readonly laBirthFatherOccuptationLabel: Locator; + + constructor(page: Page) { + super(page); + + this.laBirthFatherOccupationHeader = page.getByRole('heading', { name: 'What is the occupation of the' }); + + this.laBirthFatherOccuptationLabel = page.locator('#birthFatherOccupation'); + } + + async fillBirthFatherOccupationLabel(occuptation: string): Promise { + await this.laBirthFatherOccuptationLabel.fill(occuptation); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherOnCertificatePage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherOnCertificatePage.page.ts new file mode 100644 index 000000000..c20df7c63 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherOnCertificatePage.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherOnCertficatePage extends BasePage { + readonly birthFatherBirthCertificateHeading: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherBirthCertificateHeading = page.getByRole('heading', { name: "Is the birth father's name on" }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityGrantedPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityGrantedPage.page.ts new file mode 100644 index 000000000..7b4429218 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityGrantedPage.page.ts @@ -0,0 +1,45 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherParentalResponsibilityGrantedPage extends BasePage { + readonly birthFatherParentalResponsibilityHeader: Locator; + + readonly birthCertificateCheckbox: Locator; + readonly courtOrderCheckbox: Locator; + readonly parentalResponsibilityOrderCheckbox: Locator; + readonly parentalResponsibilityAgreementCheckbox: Locator; + readonly otherCheckbox: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherParentalResponsibilityHeader = page.getByRole('heading', { name: 'How was parental' }); + + this.birthCertificateCheckbox = page.getByLabel('Birth certificate'); + this.courtOrderCheckbox = page.getByLabel('Court order'); + this.parentalResponsibilityOrderCheckbox = page.getByLabel('Parental responsibility order'); + this.parentalResponsibilityAgreementCheckbox = page.getByLabel('Parental responsibility agreement'); + this.otherCheckbox = page.getByLabel('Other'); + } + + async checkBirthCertificateCheckbox(): Promise { + await this.birthCertificateCheckbox.check(); + } + + async checkCourtOrderCheckbox(): Promise { + await this.courtOrderCheckbox.check(); + } + + async checkParentalResponsibilityOrderCheckbox(): Promise { + await this.parentalResponsibilityOrderCheckbox.check(); + } + + async checkParentalResponsibilityAgreementCheckbox(): Promise { + await this.parentalResponsibilityAgreementCheckbox.check(); + } + + async checkOtherCheckbox(): Promise { + await this.otherCheckbox.check(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityPage.page.ts new file mode 100644 index 000000000..51492f712 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherParentalResponsibilityPage.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherParentalResponsibilityPage extends BasePage { + readonly birthFatherParentalResponsibilityHeader: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherParentalResponsibilityHeader = page.getByRole('heading', { name: 'Does the birth father have' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherServeDocumentsPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherServeDocumentsPage.page.ts new file mode 100644 index 000000000..6dcc89b68 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherServeDocumentsPage.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherServeDocumentsPage extends BasePage { + readonly birthFatherDocumentHeading: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherDocumentHeading = page.getByRole('heading', { name: 'Should the birth father be' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherStillAliveStatusPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherStillAliveStatusPage.page.ts new file mode 100644 index 000000000..fd1c4a0fe --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/laBirthFatherStillAliveStatusPage.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherStillAliveStatusPage extends BasePage { + readonly birthFatherStillAliveHeading: Locator; + + constructor(page: Page) { + super(page); + + this.birthFatherStillAliveHeading = page.getByRole('heading', { name: "Is the child's birth father" }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-father/lsBirthFatherLastKnownAddressPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-father/lsBirthFatherLastKnownAddressPage.page.ts new file mode 100644 index 000000000..a778f7e9d --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-father/lsBirthFatherLastKnownAddressPage.page.ts @@ -0,0 +1,34 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthFatherLastKnownAddressPage extends BasePage { + readonly birthFatherLastKnownAddressHeading: Locator; + + readonly postCodeLabel: Locator; + readonly findAddressButton: Locator; + + readonly selectAnAddressLabel: Locator; + + constructor(page: Page) { + super(page); + this.birthFatherLastKnownAddressHeading = page.getByRole('heading', { name: "What is the birth father's" }); + + this.postCodeLabel = page.getByLabel('Postcode'); + this.findAddressButton = page.getByRole('button', { name: 'Find address' }); + + this.selectAnAddressLabel = page.getByLabel('Select an address'); + } + + async fillPostCodeLabel(postcode: string): Promise { + await this.postCodeLabel.fill(postcode); + } + + async clickFindAddressButton(): Promise { + await this.findAddressButton.click(); + } + + async selectAddressOption(option: string): Promise { + await this.selectAnAddressLabel.selectOption(option); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherAliveStatusPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherAliveStatusPage.page.ts new file mode 100644 index 000000000..5aa27353a --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherAliveStatusPage.page.ts @@ -0,0 +1,32 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthMotherAliveStatusPage extends BasePage { + readonly birthMotherStillAliveHeading: Locator; + + readonly birthMotherAliveYesRadioButton: Locator; + readonly birthMotherAliveNoRadioButton: Locator; + readonly birthMotherAliveNotSureRadioButton: Locator; + + constructor(page: Page) { + super(page); + this.birthMotherStillAliveHeading = page.getByRole('heading', { name: "Is the child's birth mother" }); + + this.birthMotherAliveYesRadioButton = page.getByLabel('Yes'); + this.birthMotherAliveNoRadioButton = page.getByLabel('No'); + this.birthMotherAliveNotSureRadioButton = page.getByLabel('Not sure'); + } + + async checkBirthMotherAliveYesRadioButton(): Promise { + await this.birthMotherAliveYesRadioButton.check(); + } + + async checkBirthMotherAliveNoRadioButton(): Promise { + await this.birthMotherAliveNoRadioButton.check(); + } + + async checkBirthMotherAliveNotSureButton(): Promise { + await this.birthMotherAliveNotSureRadioButton.check(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastDateConfirmedAddressPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastDateConfirmedAddressPage.page.ts new file mode 100644 index 000000000..d14899ded --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastDateConfirmedAddressPage.page.ts @@ -0,0 +1,33 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthMotherLastDateConfirmedAddressPage extends BasePage { + readonly birthMotherLastDatedConfirmedAddressPage: Locator; + + readonly dayLabel: Locator; + readonly monthLabel: Locator; + readonly yearLabel: Locator; + + constructor(page: Page) { + super(page); + + this.birthMotherLastDatedConfirmedAddressPage = page.getByRole('heading', { name: 'When was the last date this' }); + + this.dayLabel = page.getByLabel('Day'); + this.monthLabel = page.getByLabel('Month'); + this.yearLabel = page.getByLabel('Year'); + } + + async fillDayLabel(day: string): Promise { + await this.dayLabel.fill(day); + } + + async fillMonthLabel(month: string): Promise { + await this.monthLabel.fill(month); + } + + async fillYearLabel(year: string): Promise { + await this.yearLabel.fill(year); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressBranchPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressBranchPage.page.ts new file mode 100644 index 000000000..9e7afbb48 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressBranchPage.page.ts @@ -0,0 +1,12 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthMotherLastKnownAddressBranchPage extends BasePage { + readonly birthMotherLastKnownAddressHeader: Locator; + + constructor(page: Page) { + super(page); + this.birthMotherLastKnownAddressHeader = page.getByRole('heading', { name: "Do you have the birth mother'" }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressPage.page.ts new file mode 100644 index 000000000..6c77df085 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherLastKnownAddressPage.page.ts @@ -0,0 +1,35 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthMotherLastKnownAddressPage extends BasePage { + readonly birthMotherLastKnownAddressHeading: Locator; + + readonly postCodeLabel: Locator; + readonly findAddressButton: Locator; + + readonly selectAnAddressLabel: Locator; + + constructor(page: Page) { + super(page); + + this.birthMotherLastKnownAddressHeading = page.getByRole('heading', { name: "What is the birth mother's" }); + + this.postCodeLabel = page.getByLabel('Postcode'); + this.findAddressButton = page.getByRole('button', { name: 'Find address' }); + + this.selectAnAddressLabel = page.getByLabel('Select an address'); + } + + async fillPostCodeLabel(postcode: string): Promise { + await this.postCodeLabel.fill(postcode); + } + + async clickFindAddressButton(): Promise { + await this.findAddressButton.click(); + } + + async selectAddressOption(option: string): Promise { + await this.selectAnAddressLabel.selectOption(option); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherNamePage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherNamePage.page.ts new file mode 100644 index 000000000..4e4956f41 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherNamePage.page.ts @@ -0,0 +1,24 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthMotherNamePage extends BasePage { + readonly birthMotherFullNameHeading: Locator; + + readonly birthMotherFirstNameLabel: Locator; + readonly birthMotherLastNameLabel: Locator; + + constructor(page: Page) { + super(page); + + this.birthMotherFullNameHeading = page.getByRole('heading', { name: 'What is the full name of the' }); + + this.birthMotherFirstNameLabel = page.getByLabel('First names'); + this.birthMotherLastNameLabel = page.getByLabel('Last names'); + } + + async fillBirthMotherNames(firstNames: string, lastNames: string): Promise { + await this.birthMotherFirstNameLabel.fill(firstNames); + await this.birthMotherLastNameLabel.fill(lastNames); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherNationalityPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherNationalityPage.page.ts new file mode 100644 index 000000000..6bfc867b9 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherNationalityPage.page.ts @@ -0,0 +1,12 @@ +import { Locator, Page } from '@playwright/test'; + +import { NationalityPage } from '../../../pages/nationality.page'; + +export class LABirthMotherNationalityPage extends NationalityPage { + readonly birthMotherNationalityHeading: Locator; + + constructor(page: Page) { + super(page); + this.birthMotherNationalityHeading = page.getByRole('heading', { name: 'What is the nationality of' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherOccupationPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherOccupationPage.page.ts new file mode 100644 index 000000000..2cc9c5a15 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherOccupationPage.page.ts @@ -0,0 +1,20 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthMotherOccupationPage extends BasePage { + readonly birthMotherOccupationHeading: Locator; + + readonly birthMotherOccupationLabel: Locator; + + constructor(page: Page) { + super(page); + this.birthMotherOccupationHeading = page.getByText('What is the occupation of the'); + + this.birthMotherOccupationLabel = page.getByLabel('What is the occupation of the'); + } + + async fillBirthMotherOccupationLabel(occupation: string): Promise { + await this.birthMotherOccupationLabel.fill(occupation); + } +} diff --git a/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherServeDocumentsPage.page.ts b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherServeDocumentsPage.page.ts new file mode 100644 index 000000000..d17e7ddb8 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/birth-mother/laBirthMotherServeDocumentsPage.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LABirthMotherServeDocumentsPage extends BasePage { + readonly birthMotherDocumentHeading: Locator; + + constructor(page: Page) { + super(page); + + this.birthMotherDocumentHeading = page.getByRole('heading', { name: 'Should the birth mother be' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/document-upload/laUploadDocuments.page.ts b/playwright-e2e/page-objects/local-authority/document-upload/laUploadDocuments.page.ts new file mode 100644 index 000000000..6f0e071c8 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/document-upload/laUploadDocuments.page.ts @@ -0,0 +1,21 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAUploadDocumentsPage extends BasePage { + readonly uploadDocumentsHeading: Locator; + + readonly cannotUploadDocumentsCheckbox: Locator; + + constructor(page: Page) { + super(page); + + this.uploadDocumentsHeading = page.getByRole('heading', { name: 'Upload documents' }); + + this.cannotUploadDocumentsCheckbox = page.getByLabel('I cannot upload some or all'); + } + + async checkCannotUploadDocumentsCheckbox(): Promise { + await this.cannotUploadDocumentsCheckbox.check(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/laCheckYourAnswer.page.ts b/playwright-e2e/page-objects/local-authority/laCheckYourAnswer.page.ts new file mode 100644 index 000000000..49df1007e --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/laCheckYourAnswer.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../pages/basePage.page'; + +export class LACheckYourAnswerPage extends BasePage { + readonly checkYourAnswersHeading: Locator; + + constructor(page: Page) { + super(page); + + this.checkYourAnswersHeading = page.locator('h1').filter({ hasText: 'Check your answers' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/laChildDetailsPage.page.ts b/playwright-e2e/page-objects/local-authority/laChildDetailsPage.page.ts new file mode 100644 index 000000000..7ad1fa345 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/laChildDetailsPage.page.ts @@ -0,0 +1,61 @@ +import { Locator, Page } from '@playwright/test'; + +export class LAChildDetailsPage { + readonly childDetailsHeading: Locator; + + readonly birthCertificateDetailsLink: Locator; + readonly birthMotherDetailsLink: Locator; + readonly birthFatherDetailsLink: Locator; + readonly otherPersonDetailsLink: Locator; + readonly placementAndCourtOrderLinks: Locator; + readonly siblingCourtOrderDetailsLink: Locator; + readonly uploadDocumentLink: Locator; + + readonly reviewAndSubmitButton: Locator; + + constructor(page: Page) { + this.childDetailsHeading = page.locator('.govuk-heading-x1').first(); + this.birthCertificateDetailsLink = page.getByRole('link', { name: 'Birth certificate details' }); + this.birthMotherDetailsLink = page.getByRole('link', { name: 'Birth mother details' }); + this.birthFatherDetailsLink = page.getByRole('link', { name: 'Birth father details' }); + this.otherPersonDetailsLink = page.getByRole('link', { name: 'Other person with parental' }); + this.placementAndCourtOrderLinks = page.getByRole('link', { name: 'Placement and court orders' }); + this.siblingCourtOrderDetailsLink = page.getByRole('link', { name: 'Sibling court order details' }); + this.uploadDocumentLink = page.getByRole('link', { name: 'Upload documents' }); + + // This button should not be visible until all sections are completed + this.reviewAndSubmitButton = page.getByRole('button', { name: 'Review and submit' }); + } + + async clickBirthCertificateDetailsSection(): Promise { + await this.birthCertificateDetailsLink.click(); + } + + async clickBirthMotherDetailsLink(): Promise { + await this.birthMotherDetailsLink.click(); + } + + async clickBirthFatherDetailsLink(): Promise { + await this.birthFatherDetailsLink.click(); + } + + async clickOtherPersonLink(): Promise { + await this.otherPersonDetailsLink.click(); + } + + async clickPlacementAndOrderLink(): Promise { + await this.placementAndCourtOrderLinks.click(); + } + + async clickSiblingCourtOrderDetailsLink(): Promise { + await this.siblingCourtOrderDetailsLink.click(); + } + + async clickUploadDocumentLink(): Promise { + await this.uploadDocumentLink.click(); + } + + async clickReviewAndSubmitButton(): Promise { + await this.reviewAndSubmitButton.click(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/laConfirmationPage.page.ts b/playwright-e2e/page-objects/local-authority/laConfirmationPage.page.ts new file mode 100644 index 000000000..0decccc79 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/laConfirmationPage.page.ts @@ -0,0 +1,7 @@ +export class LAConfirmationPage { + readonly pageURL: string; + + constructor() { + this.pageURL = 'https://adoption-web.aat.platform.hmcts.net/la-portal/confirmation'; + } +} diff --git a/playwright-e2e/page-objects/local-authority/laGettingStartedPage.page.ts b/playwright-e2e/page-objects/local-authority/laGettingStartedPage.page.ts new file mode 100644 index 000000000..9aa4a35b7 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/laGettingStartedPage.page.ts @@ -0,0 +1,25 @@ +import { Locator, Page } from '@playwright/test'; + +export class LAGettingStartedPage { + readonly gettingStartedHeading: Locator; + readonly submittingResponseHeading: Locator; + readonly whatYouWillNeedHeading: Locator; + readonly completingYourResponseHeading: Locator; + + readonly startNowButton: Locator; + + constructor(page: Page) { + this.gettingStartedHeading = page.getByRole('heading', { name: 'Getting started' }); + this.submittingResponseHeading = page.getByRole('heading', { name: 'Submitting a response to an' }); + this.whatYouWillNeedHeading = page.getByRole('heading', { name: 'What you will need' }); + this.completingYourResponseHeading = page.getByRole('heading', { + name: 'Completing your response to the application', + }); + + this.startNowButton = page.getByRole('button', { name: 'Start now' }); + } + + async laGettingStarted(): Promise { + await this.startNowButton.click(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/laSignInPage.page.ts b/playwright-e2e/page-objects/local-authority/laSignInPage.page.ts new file mode 100644 index 000000000..89d42bd81 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/laSignInPage.page.ts @@ -0,0 +1,54 @@ +import { type Locator, type Page } from '@playwright/test'; + +import BasePage from '../../pages/basePage.page'; + +export class LASignInPage extends BasePage { + readonly applicationDetailsHeading: Locator; + readonly courtCaseReferenceNumberHeading: Locator; + readonly childNameOnApplicationHeading: Locator; + readonly childDateOfBirthHeading: Locator; + + readonly courtCaseReferenceNumber: Locator; + readonly childNameOnApplication: Locator; + readonly childDateOfBirthDay: Locator; + readonly childDateOfBirthMonth: Locator; + readonly childDateOfBirthYear: Locator; + + readonly saveAndContinueButton: Locator; + + constructor(page: Page) { + super(page); + + this.applicationDetailsHeading = page.getByRole('heading', { name: 'Application details' }); + this.courtCaseReferenceNumberHeading = page.getByRole('heading', { name: 'Court case reference number' }); + this.childNameOnApplicationHeading = page.getByRole('heading', { name: 'Child named on the application' }); + this.childDateOfBirthHeading = page.getByRole('heading', { name: "Child's date of birth" }); + + this.courtCaseReferenceNumber = page.getByLabel('Court case reference number'); + this.childNameOnApplication = page.getByLabel('Child named on the application'); + this.childDateOfBirthDay = page.getByLabel('Day'); + this.childDateOfBirthMonth = page.getByLabel('Month'); + this.childDateOfBirthYear = page.getByLabel('Year'); + + this.saveAndContinueButton = page.getByRole('button', { name: 'Save and continue' }); + } + + async navigateTo(): Promise { + await this.page.goto('https://adoption-web.aat.platform.hmcts.net/la-portal/kba-case-ref'); + } + + async startLAJourney(caseRefNo: string, childFullName: string): Promise { + const today = new Date(); + const day = String(today.getDate()); + const month = String(today.getMonth() + 1); + const year = String(today.getFullYear() - 5); + + await this.courtCaseReferenceNumber.fill(caseRefNo); + await this.childNameOnApplication.fill(childFullName); + await this.childDateOfBirthDay.fill(day); + await this.childDateOfBirthMonth.fill(month); + await this.childDateOfBirthYear.fill(year); + + await super.clickSaveAndContinue(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/laStatementOfTruth.page.ts b/playwright-e2e/page-objects/local-authority/laStatementOfTruth.page.ts new file mode 100644 index 000000000..e6e3d46d5 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/laStatementOfTruth.page.ts @@ -0,0 +1,51 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../pages/basePage.page'; + +export class LAStatementOfTruthPage extends BasePage { + readonly statementOfTruthHeading: Locator; + + readonly fullNameLabel: Locator; + readonly jobTitleLabel: Locator; + readonly localAuthortityRepresentationLabel: Locator; + + readonly truthStatementCheckbox: Locator; + + readonly confirmButton: Locator; + readonly saveAsDraftButton: Locator; + + constructor(page: Page) { + super(page); + + this.statementOfTruthHeading = page.getByRole('heading', { name: 'Statement of truth' }); + + this.fullNameLabel = page.getByLabel('Your full name'); + this.jobTitleLabel = page.getByLabel('Your job title'); + this.localAuthortityRepresentationLabel = page.getByLabel('Name of the local authority'); + + this.truthStatementCheckbox = page.getByLabel('I confirm that this statement'); + + this.confirmButton = page.getByRole('button', { name: 'Confirm' }); + this.saveAsDraftButton = page.getByRole('button', { name: 'Save as draft' }); + } + + async fillFullNameLabel(name: string): Promise { + await this.fullNameLabel.fill(name); + } + + async fillJobTItleLabel(title: string): Promise { + await this.jobTitleLabel.fill(title); + } + + async fillLocalAuthorityRepresentationLabel(authority: string): Promise { + await this.localAuthortityRepresentationLabel.fill(authority); + } + + async checkTruthStatementCheckbox(): Promise { + await this.truthStatementCheckbox.check(); + } + + async clickConfirm(): Promise { + await this.confirmButton.click(); + } +} diff --git a/playwright-e2e/page-objects/local-authority/other-person/laOtherPersonResponsibilityPage.page.ts b/playwright-e2e/page-objects/local-authority/other-person/laOtherPersonResponsibilityPage.page.ts new file mode 100644 index 000000000..234ed0cdd --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/other-person/laOtherPersonResponsibilityPage.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAOtherPersonResponsibilityPage extends BasePage { + readonly otherPersonResponsibilityHeading: Locator; + + constructor(page: Page) { + super(page); + + this.otherPersonResponsibilityHeading = page.getByRole('heading', { name: 'Is there another person who' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/placement/laPlacementAndCourtsSection.page.ts b/playwright-e2e/page-objects/local-authority/placement/laPlacementAndCourtsSection.page.ts new file mode 100644 index 000000000..faaa98c0d --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/placement/laPlacementAndCourtsSection.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAPlacementOrdersInPlacePage extends BasePage { + readonly placementOrdersInPlaceHeading: Locator; + + constructor(page: Page) { + super(page); + + this.placementOrdersInPlaceHeading = page.getByRole('heading', { name: 'Orders already in place' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/placement/laPlacementDateOfOrderPage.page.ts b/playwright-e2e/page-objects/local-authority/placement/laPlacementDateOfOrderPage.page.ts new file mode 100644 index 000000000..b7719d7c8 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/placement/laPlacementDateOfOrderPage.page.ts @@ -0,0 +1,33 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAPlacementDateOfOrderPage extends BasePage { + readonly placementDateOfOrderPage: Locator; + + readonly dayLabel: Locator; + readonly monthLabel: Locator; + readonly yearLabel: Locator; + + constructor(page: Page) { + super(page); + + this.placementDateOfOrderPage = page.getByRole('heading', { name: 'What date is on the placement' }); + + this.dayLabel = page.getByLabel('Day'); + this.monthLabel = page.getByLabel('Month'); + this.yearLabel = page.getByLabel('Year'); + } + + async fillDayLabel(day: string): Promise { + await this.dayLabel.fill(day); + } + + async fillMonthLabel(month: string): Promise { + await this.monthLabel.fill(month); + } + + async fillYearLabel(year: string): Promise { + await this.yearLabel.fill(year); + } +} diff --git a/playwright-e2e/page-objects/local-authority/placement/laPlacementOrderNumberPage.page.ts b/playwright-e2e/page-objects/local-authority/placement/laPlacementOrderNumberPage.page.ts new file mode 100644 index 000000000..89ecef167 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/placement/laPlacementOrderNumberPage.page.ts @@ -0,0 +1,21 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAPlacementOrderNumberPage extends BasePage { + readonly placementOrderNumberPage: Locator; + + readonly orderNumberLabel: Locator; + + constructor(page: Page) { + super(page); + + this.placementOrderNumberPage = page.getByText('What is the serial or case'); + + this.orderNumberLabel = page.getByLabel('What is the serial or case'); + } + + async fillOrderNumberLabel(order: string): Promise { + await this.orderNumberLabel.fill(order); + } +} diff --git a/playwright-e2e/page-objects/local-authority/placement/laPlacementOrdersSummaryPage.page.ts b/playwright-e2e/page-objects/local-authority/placement/laPlacementOrdersSummaryPage.page.ts new file mode 100644 index 000000000..31ada2eed --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/placement/laPlacementOrdersSummaryPage.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAPlacementOrdersSummaryPage extends BasePage { + readonly placementOrdersSummaryHeading: Locator; + + constructor(page: Page) { + super(page); + + this.placementOrdersSummaryHeading = page.getByRole('heading', { name: 'Orders already in place' }); + } +} diff --git a/playwright-e2e/page-objects/local-authority/siblings/laSiblingCourtDetailsSection.page.ts b/playwright-e2e/page-objects/local-authority/siblings/laSiblingCourtDetailsSection.page.ts new file mode 100644 index 000000000..07dfe89b8 --- /dev/null +++ b/playwright-e2e/page-objects/local-authority/siblings/laSiblingCourtDetailsSection.page.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from '../../../pages/basePage.page'; + +export class LAChildHasOtherSiblingsPage extends BasePage { + readonly childHasOtherSiblingsHeading: Locator; + + constructor(page: Page) { + super(page); + + this.childHasOtherSiblingsHeading = page.getByRole('heading', { name: 'Does the child have any' }); + } +} diff --git a/playwright-e2e/pages/basePage.page.ts b/playwright-e2e/pages/basePage.page.ts index f3945a92b..5c4768844 100644 --- a/playwright-e2e/pages/basePage.page.ts +++ b/playwright-e2e/pages/basePage.page.ts @@ -2,6 +2,13 @@ import { type Locator, type Page } from '@playwright/test'; import { expect } from '@playwright/test'; export default class BasePage { readonly page: Page; + readonly yesRadioButton: Locator; + readonly noRadioButton: Locator; + readonly britishCheckbox: Locator; + readonly irishCheckbox: Locator; + readonly differentCountryCheckbox: Locator; + readonly countryNameLabel: Locator; + readonly notSureCheckbox: Locator; readonly continueButton: Locator; readonly saveAndContinue: Locator; readonly saveAsDraft: Locator; @@ -13,9 +20,19 @@ export default class BasePage { readonly firstName: Locator; readonly lastName: Locator; readonly locationPicker: Locator; + readonly signOutLink: Locator; + + readonly languageLink: Locator; constructor(page: Page) { this.page = page; + this.yesRadioButton = page.getByLabel('Yes'); + this.noRadioButton = page.getByLabel('No', { exact: true }); + this.britishCheckbox = page.getByLabel('British'); + this.irishCheckbox = page.getByLabel('Irish'); + this.differentCountryCheckbox = page.getByLabel('Citizen of a different country'); + this.countryNameLabel = page.getByLabel('Country name'); + this.notSureCheckbox = page.getByLabel('Not sure'); this.continueButton = page.getByRole('button', { name: 'Continue' }); this.saveAndContinue = page.getByRole('button', { name: 'Save and continue' }); this.saveAsDraft = page.getByRole('button', { name: 'Save as draft' }); @@ -27,6 +44,17 @@ export default class BasePage { this.firstName = page.getByLabel('First names'); this.lastName = page.getByLabel('Last names'); this.locationPicker = page.locator('#location-picker'); + this.signOutLink = page.getByRole('link', { name: 'Sign out' }); + + this.languageLink = page.locator('a.govuk-link.language'); + } + + async checkYesRadioButton(): Promise { + await this.yesRadioButton.check(); + } + + async checkNoRadioButton(): Promise { + await this.noRadioButton.check(); } async clickContinue(): Promise { @@ -37,6 +65,10 @@ export default class BasePage { await this.saveAndContinue.click(); } + async clickSaveAsDraft(): Promise { + await this.saveAsDraft.click(); + } + async postcodeFindAddress(postcode: string, selectAdd: string): Promise { await this.postcode.fill(postcode); await this.findAddress.click(); @@ -54,4 +86,12 @@ export default class BasePage { await expect(this.locationPicker).toHaveValue(location); await this.locationPicker.press('Enter'); } + + async clickSignOutLink(): Promise { + await this.signOutLink.click(); + } + + async clickLanguageLink(): Promise { + await this.languageLink.click(); + } } diff --git a/playwright-e2e/pages/nationality.page.ts b/playwright-e2e/pages/nationality.page.ts new file mode 100644 index 000000000..7e6397923 --- /dev/null +++ b/playwright-e2e/pages/nationality.page.ts @@ -0,0 +1,42 @@ +import { Locator, Page } from '@playwright/test'; + +import BasePage from './basePage.page'; + +export class NationalityPage extends BasePage { + readonly britishCheckbox: Locator; + readonly irishCheckbox: Locator; + readonly differentCountryCheckbox: Locator; + readonly notSureCheckbox: Locator; + + readonly countryNameLabel: Locator; + + constructor(page: Page) { + super(page); + this.britishCheckbox = page.getByLabel('British'); + this.irishCheckbox = page.getByLabel('Irish'); + this.differentCountryCheckbox = page.getByLabel('Citizen of a different country'); + this.notSureCheckbox = page.getByLabel('Not sure'); + + this.countryNameLabel = page.getByLabel('Country name'); + } + + async checkBritishCheckbox(): Promise { + await this.britishCheckbox.check(); + } + + async checkIrishCheckbox(): Promise { + await this.irishCheckbox.check(); + } + + async checkDifferentCountryCheckbox(): Promise { + await this.differentCountryCheckbox.check(); + } + + async checkNotSureCheckbox(): Promise { + await this.notSureCheckbox.check(); + } + + async fillCounrtyNameLabel(country: string): Promise { + await this.countryNameLabel.fill(country); + } +} diff --git a/playwright-e2e/pages/signInPage.page.ts b/playwright-e2e/pages/signInPage.page.ts index a6db4150f..f5af66a74 100644 --- a/playwright-e2e/pages/signInPage.page.ts +++ b/playwright-e2e/pages/signInPage.page.ts @@ -1,6 +1,7 @@ import { type Locator, type Page } from '@playwright/test'; export default class SignIn { + readonly page: Page; readonly heading: Locator; readonly heading2: Locator; readonly email: Locator; @@ -8,13 +9,18 @@ export default class SignIn { readonly signinButton: Locator; constructor(page: Page) { + this.page = page; this.heading = page.getByRole('heading', { name: 'Sign in or create an account' }); this.heading2 = page.getByRole('heading', { name: 'Sign in', exact: true }); this.email = page.getByLabel('Email address'); this.password = page.getByText('Password', { exact: true }); this.signinButton = page.getByRole('button', { name: 'Sign in' }); - page.goto( - 'https://idam-web-public.aat.platform.hmcts.net/login?client_id=adoption-web&response_type=code&redirect_uri=https://adoption-web.aat.platform.hmcts.net/receiver' + } + + async navigateTo(): Promise { + await this.page.goto( + 'https://idam-web-public.aat.platform.hmcts.net/login?client_id=adoption-web&response_type=code&redirect_uri=https://adoption-web.aat.platform.hmcts.net/receiver', + { waitUntil: 'load', timeout: 3000 } ); } diff --git a/playwright-e2e/tests/citizen_journey/applying-with-tests.spec.ts b/playwright-e2e/tests/citizen_journey/applying-with-tests.spec.ts new file mode 100644 index 000000000..6955b8a24 --- /dev/null +++ b/playwright-e2e/tests/citizen_journey/applying-with-tests.spec.ts @@ -0,0 +1,140 @@ +import { expect, test } from '../../fixtures/fixtures'; +import { setupUser, teardownUser } from '../../hooks/createDeleteUser.hook'; + +test.describe('Citizen Journey Applying with page test', () => { + let userEmail: string; + let userPassword: string; + let userId: string; + + test.beforeEach(async ({ signIn }) => { + const userInfo = await setupUser(); + if (userInfo) { + userEmail = userInfo.email; + userPassword = userInfo.password; + userId = userInfo.id; + } + await signIn.navigateTo(); + await signIn.signIn(userEmail, userPassword); + }); + + test.afterEach('Status check', async () => { + await teardownUser(userId); + }); + + test('check default page is in English', async ({ page }) => { + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^en/); + }); + + test('check page is Welsh after Welsh link is clicked', async ({ page, citApplyingWithPage }) => { + await citApplyingWithPage.clickLanguageLink(); + + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^cy/); + }); + + test('check default page component visibility', async ({ citApplyingWithPage }) => { + await expect.soft(citApplyingWithPage.applicationDetailsTitle).toBeVisible(); + await expect.soft(citApplyingWithPage.applicationWithHeading).toBeVisible(); + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).toBeVisible(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).toBeVisible(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).toBeVisible(); + + await expect.soft(citApplyingWithPage.saveAndContinue).toBeVisible(); + await expect.soft(citApplyingWithPage.saveAsDraft).toBeVisible(); + + await expect.soft(citApplyingWithPage.contactACourtHeading).toBeHidden({ timeout: 500 }); + expect(test.info().errors).toHaveLength(0); + }); + + test('check default page radio buttons are unchecked', async ({ citApplyingWithPage }) => { + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).not.toBeChecked(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check applying for own radio button is checked and remainder radio buttons are unchecked', async ({ + citApplyingWithPage, + }) => { + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).not.toBeChecked(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check applying with spouse radio button is and remainder radio buttons are unchecked', async ({ + citApplyingWithPage, + }) => { + await citApplyingWithPage.checkApplyingWithSpouseRadioButton(); + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).not.toBeChecked(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check apply with spouse partner radio button is remainder and radio buttons are unchecked', async ({ + citApplyingWithPage, + }) => { + await citApplyingWithPage.checkApplyingWithPartnerNotSpouseRadioButton(); + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).toBeChecked(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check one radio button can be checked at a time', async ({ citApplyingWithPage }) => { + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).not.toBeChecked(); + + await citApplyingWithPage.checkApplyingWithSpouseRadioButton(); + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).not.toBeChecked(); + + await citApplyingWithPage.checkApplyingWithPartnerNotSpouseRadioButton(); + await expect.soft(citApplyingWithPage.applyingOnMyOwnRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithSpouseRadioButton).not.toBeChecked(); + await expect.soft(citApplyingWithPage.applyingWithPartnerNotSpouseRadioButton).toBeChecked(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check default page clicking Save and Continue button results in Error', async ({ citApplyingWithPage }) => { + await citApplyingWithPage.clickSaveAndContinue(); + + await expect(citApplyingWithPage.errorSummary).toBeHidden({ timeout: 500 }); + }); + + test('check default page clicking save as draft buttons transfer to task list page', async ({ + page, + citApplyingWithPage, + }) => { + await citApplyingWithPage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + + expect(page.url()).toBe(expectedUrl); + }); + + test('check page transfer to task list page after checking applying for own radio button', async ({ + page, + citApplyingWithPage, + }) => { + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await citApplyingWithPage.clickSaveAndContinue(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/task-list'; + + expect(page.url()).toBe(expectedUrl); + }); +}); diff --git a/playwright-e2e/tests/citizen_journey/child-details/child-dob-tests.spec.ts b/playwright-e2e/tests/citizen_journey/child-details/child-dob-tests.spec.ts new file mode 100644 index 000000000..d7dc686bf --- /dev/null +++ b/playwright-e2e/tests/citizen_journey/child-details/child-dob-tests.spec.ts @@ -0,0 +1,333 @@ +import { expect, test } from '../../../fixtures/fixtures'; +import { setupUser, teardownUser } from '../../../hooks/createDeleteUser.hook'; +test.describe('Citizen Journey child DoB test single parent', () => { + let userEmail: string; + let userPassword: string; + let userId: string; + + test.beforeEach( + async ({ + signIn, + citApplyingWithPage, + citTaskListPage, + citChildFullNamePage, + citChildFullNameAfterAdoptionPage, + }) => { + const userInfo = await setupUser(); + if (userInfo) { + userEmail = userInfo.email; + userPassword = userInfo.password; + userId = userInfo.id; + } + await signIn.navigateTo(); + await signIn.signIn(userEmail, userPassword); + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await citApplyingWithPage.clickSaveAndContinue(); + await citTaskListPage.clickChildDetailsLink(); + await citChildFullNamePage.fillFirstNameLabel('Joe'); + await citChildFullNamePage.fillLastNameLabel('Smith'); + await citChildFullNamePage.clickSaveAndContinue(); + + await citChildFullNameAfterAdoptionPage.fillFirstNameLabel('Joe'); + await citChildFullNameAfterAdoptionPage.fillLastNameLabel('Smith'); + await citChildFullNameAfterAdoptionPage.clickSaveAndContinue(); + } + ); + + test.afterEach('Status check', async () => { + await teardownUser(userId); + }); + + test('check default page is in English', async ({ page }) => { + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^en/); + }); + + test('check page is in Welsh after clicking Welsh language link', async ({ page, citChildDoBPage }) => { + await citChildDoBPage.clickLanguageLink(); + + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^cy/); + }); + + test('check if page components are in correct visible state', async ({ citChildDoBPage }) => { + await expect.soft(citChildDoBPage.childDetailsTitle).toBeVisible(); + await expect.soft(citChildDoBPage.childDoBHeading).toBeVisible(); + await expect.soft(citChildDoBPage.dayText).toBeVisible(); + await expect.soft(citChildDoBPage.monthText).toBeVisible(); + await expect.soft(citChildDoBPage.yearText).toBeVisible(); + await expect.soft(citChildDoBPage.dayLabel).toBeVisible(); + await expect.soft(citChildDoBPage.monthLabel).toBeVisible(); + await expect.soft(citChildDoBPage.yearLabel).toBeVisible(); + await expect.soft(citChildDoBPage.contactUsForHelpDropdownLink).toBeVisible(); + await expect.soft(citChildDoBPage.contactACourtHeading).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.findACourtLink).toBeHidden({ timeout: 500 }); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + await expect.soft(citChildDoBPage.saveAndContinue).toBeVisible(); + await expect.soft(citChildDoBPage.saveAsDraft).toBeVisible(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing save and continue button without filling required fields results in date summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeVisible(); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling month and year only then clicking save and continue button results in day summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.fillMonthLabel('01'); + await citChildDoBPage.fillYearLabel('2020'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeVisible(); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling day and year only then clicking save and continue button results in month summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.fillYearLabel('2020'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeVisible(); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling day and month only then clicking save and continue button results in year summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.fillMonthLabel('01'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeVisible(); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling year only then clicking save and continue button results in day and month summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.fillYearLabel('2020'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeVisible(); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling month only then click save and continue button results in day and month summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.fillMonthLabel('01'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeVisible(); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling day only then clicking save and continue button results in day and month summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeVisible(); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling invalid date then clicking save and continue button results in real date summary error', async ({ + citChildDoBPage, + }) => { + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.fillMonthLabel('13'); + await citChildDoBPage.fillYearLabel('2020'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeVisible(); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling date that makes child over 18 results in over 18 summary error', async ({ citChildDoBPage }) => { + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.fillMonthLabel('01'); + await citChildDoBPage.fillYearLabel('1900'); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeVisible(); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeHidden({ timeout: 500 }); + }); + + test('check filling date in the future results in past date summary error', async ({ citChildDoBPage }) => { + const date = new Date(); + const year = date.getFullYear() + 1; + + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.fillMonthLabel('01'); + await citChildDoBPage.fillYearLabel(year.toString()); + await citChildDoBPage.clickSaveAndContinue(); + + await expect.soft(citChildDoBPage.errorDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDaySummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayMonthSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDayYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorMonthYearSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.realDateSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorOver18Summary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildDoBPage.errorDateInPastSummary).toBeVisible(); + }); + + test('check fill in correct date, saving draft then going back to page preerves date data', async ({ + page, + citChildDoBPage, + }) => { + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.fillMonthLabel('01'); + await citChildDoBPage.fillYearLabel('2020'); + await citChildDoBPage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + const actualUrl = page.url(); + await expect(actualUrl).toBe(expectedUrl); + + await page.goBack(); + + const expectedDayValue = '1'; + const expectedMonthValue = '1'; + const expectedYearValue = '2020'; + + const actualDayValue = await citChildDoBPage.dayLabel.inputValue(); + const actualMonthValue = await citChildDoBPage.monthLabel.inputValue(); + const actualYearValue = await citChildDoBPage.yearLabel.inputValue(); + + await expect.soft(actualDayValue).toBe(expectedDayValue); + await expect.soft(actualMonthValue).toBe(expectedMonthValue); + await expect.soft(actualYearValue).toBe(expectedYearValue); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check inserting valid date then pressing save amd continue advances to next step', async ({ + page, + citChildDoBPage, + }) => { + await citChildDoBPage.fillDayLabel('01'); + await citChildDoBPage.fillMonthLabel('01'); + await citChildDoBPage.fillYearLabel('2020'); + + await citChildDoBPage.clickSaveAndContinue(); + + const exepctedUrl = 'https://adoption-web.aat.platform.hmcts.net/task-list'; + const actualUrl = page.url(); + + await expect(actualUrl).toBe(exepctedUrl); + }); +}); diff --git a/playwright-e2e/tests/citizen_journey/child-details/child-name-after-adoption-tests.spec.ts b/playwright-e2e/tests/citizen_journey/child-details/child-name-after-adoption-tests.spec.ts new file mode 100644 index 000000000..740894145 --- /dev/null +++ b/playwright-e2e/tests/citizen_journey/child-details/child-name-after-adoption-tests.spec.ts @@ -0,0 +1,173 @@ +import { expect, test } from '../../../fixtures/fixtures'; +import { setupUser, teardownUser } from '../../../hooks/createDeleteUser.hook'; +test.describe('Citizen Journey child name after adoption test single parent', () => { + let userEmail: string; + let userPassword: string; + let userId: string; + + test.beforeEach(async ({ signIn, citApplyingWithPage, citTaskListPage, citChildFullNamePage }) => { + const userInfo = await setupUser(); + if (userInfo) { + userEmail = userInfo.email; + userPassword = userInfo.password; + userId = userInfo.id; + } + await signIn.navigateTo(); + await signIn.signIn(userEmail, userPassword); + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await citApplyingWithPage.clickSaveAndContinue(); + await citTaskListPage.clickChildDetailsLink(); + await citChildFullNamePage.fillFirstNameLabel('Joe'); + await citChildFullNamePage.fillLastNameLabel('Smith'); + await citChildFullNamePage.clickSaveAndContinue(); + }); + + test.afterEach('Status check', async () => { + await teardownUser(userId); + }); + + test('check default page is in English', async ({ page }) => { + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^en/); + }); + + test('check page is in Welsh after clicking Welsh language link', async ({ + page, + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.clickLanguageLink(); + + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^cy/); + }); + + test('check if page components are in correct visible state', async ({ citChildFullNameAfterAdoptionPage }) => { + await expect.soft(citChildFullNameAfterAdoptionPage.childDetailsTitle).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.childFullNameAfterAdoptionHeading).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.firstName).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.lastName).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.contactUsForHelpDropdownLink).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.contactACourtHeading).toBeHidden({ timeout: 500 }); + await expect.soft(citChildFullNameAfterAdoptionPage.findACourtLink).toBeHidden({ timeout: 500 }); + + await expect.soft(citChildFullNameAfterAdoptionPage.saveAndContinue).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.saveAsDraft).toBeVisible(); + + await expect.soft(citChildFullNameAfterAdoptionPage.errorFirstNameSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildFullNameAfterAdoptionPage.errorLastNameSummary).toBeHidden({ timeout: 500 }); + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing save and continue button without filling required fields results in first name and last name error summaries', async ({ + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.clickSaveAndContinue(); + + await expect.soft(citChildFullNameAfterAdoptionPage.errorFirstNameSummary).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.errorLastNameSummary).toBeVisible(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing save and continue button filling in first name results in last name error summary', async ({ + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.fillFirstNameLabel('Joe'); + await citChildFullNameAfterAdoptionPage.clickSaveAndContinue(); + + await expect.soft(citChildFullNameAfterAdoptionPage.errorFirstNameSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildFullNameAfterAdoptionPage); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing save and continue button filling in the last name results in first name error summary', async ({ + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.fillLastNameLabel('Smith'); + await citChildFullNameAfterAdoptionPage.clickSaveAndContinue(); + + await expect.soft(citChildFullNameAfterAdoptionPage.errorFirstNameSummary).toBeVisible(); + await expect.soft(citChildFullNameAfterAdoptionPage.errorLastNameSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing draft button maintains filled first name label', async ({ + page, + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.fillFirstNameLabel('Joe'); + await citChildFullNameAfterAdoptionPage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + const actualUrl = page.url(); + await expect(actualUrl).toBe(expectedUrl); + + await page.goBack(); + + const expectedLabelValue = 'Joe'; + const actualLabelValue = await citChildFullNameAfterAdoptionPage.firstName.inputValue(); + await expect(actualLabelValue).toContain(expectedLabelValue); + }); + + test('check pressing draft button maintains filled last name label', async ({ + page, + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.fillLastNameLabel('Smith'); + await citChildFullNameAfterAdoptionPage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + const actualUrl = page.url(); + await expect(actualUrl).toBe(expectedUrl); + + await page.goBack(); + + const expectedLabelValue = 'Smith'; + const actualLabelValue = await citChildFullNameAfterAdoptionPage.lastName.inputValue(); + await expect(actualLabelValue).toContain(expectedLabelValue); + }); + + test('check pressing draft button maintains filled first name and last name labels', async ({ + page, + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.fillFirstNameLabel('Joe'); + await citChildFullNameAfterAdoptionPage.fillLastNameLabel('Smith'); + await citChildFullNameAfterAdoptionPage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + const actualUrl = page.url(); + await expect(actualUrl).toBe(expectedUrl); + + await page.goBack(); + + const expectedFirstNameLabelValue = 'Joe'; + const expectedLastNameLabelValue = 'Smith'; + const actualFirstNameLabelValue = await citChildFullNameAfterAdoptionPage.firstName.inputValue(); + const actualLastNameLabelValue = await citChildFullNameAfterAdoptionPage.lastName.inputValue(); + + await expect.soft(actualFirstNameLabelValue).toBe(expectedFirstNameLabelValue); + await expect.soft(actualLastNameLabelValue).toBe(expectedLastNameLabelValue); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check inserting valid name data then pressing save and continue advances to next step', async ({ + page, + citChildFullNameAfterAdoptionPage, + }) => { + await citChildFullNameAfterAdoptionPage.fillFirstNameLabel('Joe'); + await citChildFullNameAfterAdoptionPage.fillLastNameLabel('Smith'); + + await citChildFullNameAfterAdoptionPage.clickSaveAndContinue(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/children/date-of-birth'; + const actualUrl = page.url(); + + expect(actualUrl).toBe(expectedUrl); + }); +}); diff --git a/playwright-e2e/tests/citizen_journey/child-details/child-name-tests.spec.ts b/playwright-e2e/tests/citizen_journey/child-details/child-name-tests.spec.ts new file mode 100644 index 000000000..5ea767d01 --- /dev/null +++ b/playwright-e2e/tests/citizen_journey/child-details/child-name-tests.spec.ts @@ -0,0 +1,161 @@ +import { expect, test } from '../../../fixtures/fixtures'; +import { setupUser, teardownUser } from '../../../hooks/createDeleteUser.hook'; +test.describe('Citizen Journey child name test single parent', () => { + let userEmail: string; + let userPassword: string; + let userId: string; + + test.beforeEach(async ({ signIn, citApplyingWithPage, citTaskListPage }) => { + const userInfo = await setupUser(); + if (userInfo) { + userEmail = userInfo.email; + userPassword = userInfo.password; + userId = userInfo.id; + } + await signIn.navigateTo(); + await signIn.signIn(userEmail, userPassword); + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await citApplyingWithPage.clickSaveAndContinue(); + await citTaskListPage.clickChildDetailsLink(); + }); + + test.afterEach('Status check', async () => { + await teardownUser(userId); + }); + + test('check default page is in English', async ({ page }) => { + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^en/); + }); + + test('check page is in Welsh after clicking Welsh language link', async ({ page, citChildFullNamePage }) => { + await citChildFullNamePage.clickLanguageLink(); + + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^cy/); + }); + + test('check if page components are in correct visible state', async ({ citChildFullNamePage }) => { + await expect.soft(citChildFullNamePage.childDetailsTitle).toBeVisible(); + await expect.soft(citChildFullNamePage.childFullNameHeading).toBeVisible(); + await expect.soft(citChildFullNamePage.firstName).toBeVisible(); + await expect.soft(citChildFullNamePage.lastName).toBeVisible(); + await expect.soft(citChildFullNamePage.contactUsForHelpDropdownLink).toBeVisible(); + await expect.soft(citChildFullNamePage.contactACourtHeading).toBeHidden({ timeout: 500 }); + await expect.soft(citChildFullNamePage.findACourtLink).toBeHidden({ timeout: 500 }); + + await expect.soft(citChildFullNamePage.saveAndContinue).toBeVisible(); + await expect.soft(citChildFullNamePage.saveAsDraft).toBeVisible(); + + await expect.soft(citChildFullNamePage.errorFirstNameSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildFullNamePage.errorLastNameSummary).toBeHidden({ timeout: 500 }); + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing save and continue button without filling required fields results in first name and last name error summaries', async ({ + citChildFullNamePage, + }) => { + await citChildFullNamePage.clickSaveAndContinue(); + + await expect.soft(citChildFullNamePage.errorFirstNameSummary).toBeVisible(); + await expect.soft(citChildFullNamePage.errorLastNameSummary).toBeVisible(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing save and continue button filling in first name results in last name error summary', async ({ + citChildFullNamePage, + }) => { + await citChildFullNamePage.fillFirstNameLabel('Joe'); + await citChildFullNamePage.clickSaveAndContinue(); + + await expect.soft(citChildFullNamePage.errorFirstNameSummary).toBeHidden({ timeout: 500 }); + await expect.soft(citChildFullNamePage.errorLastNameSummary).toBeVisible(); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing save and continue button filling in last name results in first name error summary', async ({ + citChildFullNamePage, + }) => { + await citChildFullNamePage.fillLastNameLabel('Smith'); + await citChildFullNamePage.clickSaveAndContinue(); + + await expect.soft(citChildFullNamePage.errorFirstNameSummary).toBeVisible(); + await expect.soft(citChildFullNamePage.errorLastNameSummary).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check pressing draft button maintains filled first name label', async ({ page, citChildFullNamePage }) => { + await citChildFullNamePage.fillFirstNameLabel('Joe'); + await citChildFullNamePage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + const actualUrl = page.url(); + await expect(actualUrl).toBe(expectedUrl); + + await page.goBack(); + + const expectedLabelValue = 'Joe'; + const actualLabelValue = await citChildFullNamePage.firstName.inputValue(); + await expect(actualLabelValue).toContain(expectedLabelValue); + }); + + test('check pressing draft button maintains filled last name label', async ({ page, citChildFullNamePage }) => { + await citChildFullNamePage.fillLastNameLabel('Smith'); + await citChildFullNamePage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + const actualUrl = page.url(); + await expect(actualUrl).toBe(expectedUrl); + + await page.goBack(); + + const expectedLabelValue = 'Smith'; + const actualLabelValue = await citChildFullNamePage.lastName.inputValue(); + await expect(actualLabelValue).toContain(expectedLabelValue); + }); + + test('check pressing draft button maintains filled first name and last name labels', async ({ + page, + citChildFullNamePage, + }) => { + await citChildFullNamePage.fillFirstNameLabel('Joe'); + await citChildFullNamePage.fillLastNameLabel('Smith'); + await citChildFullNamePage.clickSaveAsDraft(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/save-as-draft'; + const actualUrl = page.url(); + await expect(actualUrl).toBe(expectedUrl); + + await page.goBack(); + + const expectedFirstNameLabelValue = 'Joe'; + const expectedLastNameLabelValue = 'Smith'; + const actualFirstNameLabelValue = await citChildFullNamePage.firstName.inputValue(); + const actualLastNameLabelValue = await citChildFullNamePage.lastName.inputValue(); + + await expect.soft(actualFirstNameLabelValue).toBe(expectedFirstNameLabelValue); + await expect.soft(actualLastNameLabelValue).toBe(expectedLastNameLabelValue); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check inserting valid name data then pressing save and conitnue advances to next step', async ({ + page, + citChildFullNamePage, + }) => { + await citChildFullNamePage.fillFirstNameLabel('Joe'); + await citChildFullNamePage.fillLastNameLabel('Smith'); + + await citChildFullNamePage.clickSaveAndContinue(); + + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/children/full-name-after-adoption'; + const actualUrl = page.url(); + + expect(actualUrl).toBe(expectedUrl); + }); +}); diff --git a/playwright-e2e/tests/citizen_journey/date-child-moved-in-tests.spec.ts b/playwright-e2e/tests/citizen_journey/date-child-moved-in-tests.spec.ts new file mode 100644 index 000000000..b159c9a5f --- /dev/null +++ b/playwright-e2e/tests/citizen_journey/date-child-moved-in-tests.spec.ts @@ -0,0 +1,151 @@ +import { expect, test } from '../../fixtures/fixtures'; +import { setupUser, teardownUser } from '../../hooks/createDeleteUser.hook'; +test.describe('Citizen Journey date child moved in page test single parent', () => { + let userEmail: string; + let userPassword: string; + let userId: string; + + test.beforeEach(async ({ signIn, citApplyingWithPage, citTaskListPage }) => { + const userInfo = await setupUser(); + if (userInfo) { + userEmail = userInfo.email; + userPassword = userInfo.password; + userId = userInfo.id; + } + await signIn.navigateTo(); + await signIn.signIn(userEmail, userPassword); + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await citApplyingWithPage.clickSaveAndContinue(); + await citTaskListPage.clickDateChildMovedInLink(); + }); + + test.afterEach('Status check', async () => { + await teardownUser(userId); + }); + + test('check default page is in English', async ({ page }) => { + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^en/); + }); + + test('check page is in Welsh after clicking Welsh language link', async ({ page, citDateChildMovedInPage }) => { + await citDateChildMovedInPage.clickLanguageLink(); + + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^cy/); + }); + + test('check if page components are in correct visible state', async ({ citDateChildMovedInPage }) => { + await expect.soft(citDateChildMovedInPage.applicationDetailsTitle).toBeVisible(); + await expect.soft(citDateChildMovedInPage.childMoveInHeading).toBeVisible(); + await expect.soft(citDateChildMovedInPage.day).toBeVisible(); + await expect.soft(citDateChildMovedInPage.month).toBeVisible(); + await expect.soft(citDateChildMovedInPage.year).toBeVisible(); + await expect.soft(citDateChildMovedInPage.applicationTooltip).toBeVisible(); + await expect.soft(citDateChildMovedInPage.contactUsForHelpDropdownLink).toBeVisible(); + await expect.soft(citDateChildMovedInPage.contactACourtHeading).toBeHidden({ timeout: 500 }); + await expect.soft(citDateChildMovedInPage.findACourtLink).toBeHidden({ timeout: 500 }); + + await expect.soft(citDateChildMovedInPage.saveAndContinue).toBeVisible(); + await expect.soft(citDateChildMovedInPage.saveAsDraft).toBeVisible(); + + await expect.soft(citDateChildMovedInPage.errorDateSummary).toBeHidden({ timeout: 500 }); + expect(test.info().errors).toHaveLength(0); + }); + + test('check if page componetns are in correct visible state in save and continue error', async ({ + citDateChildMovedInPage, + }) => { + await citDateChildMovedInPage.clickSaveAndContinue(); + + await expect.soft(citDateChildMovedInPage.applicationDetailsTitle).toBeVisible(); + await expect.soft(citDateChildMovedInPage.childMoveInHeading).toBeVisible(); + await expect.soft(citDateChildMovedInPage.day).toBeVisible(); + await expect.soft(citDateChildMovedInPage.month).toBeVisible(); + await expect.soft(citDateChildMovedInPage.year).toBeVisible(); + await expect.soft(citDateChildMovedInPage.applicationTooltip).toBeVisible(); + await expect.soft(citDateChildMovedInPage.contactUsForHelpDropdownLink).toBeVisible(); + await expect.soft(citDateChildMovedInPage.contactACourtHeading).toBeHidden({ timeout: 500 }); + await expect.soft(citDateChildMovedInPage.findACourtLink).toBeHidden({ timeout: 500 }); + + await expect.soft(citDateChildMovedInPage.saveAndContinue).toBeVisible(); + await expect.soft(citDateChildMovedInPage.saveAsDraft).toBeVisible(); + + await expect.soft(citDateChildMovedInPage.errorDateSummary).toBeVisible(); + expect(test.info().errors).toHaveLength(0); + }); + + test('check filling day only and clicking save and continue results in error', async ({ + citDateChildMovedInPage, + }) => { + await citDateChildMovedInPage.fillDayLabel('04'); + await citDateChildMovedInPage.clickSaveAndContinue(); + + expect(citDateChildMovedInPage.errorMonthAndYearSummary).toBeVisible(); + }); + + test('check filling day and month only and clicking save and continue results in error', async ({ + citDateChildMovedInPage, + }) => { + await citDateChildMovedInPage.fillDayLabel('04'); + await citDateChildMovedInPage.fillMonthLabel('01'); + await citDateChildMovedInPage.clickSaveAndContinue(); + + expect(citDateChildMovedInPage.errorYearSummary).toBeVisible(); + }); + + test('check when entering invalid date and clicking save and continue results in error', async ({ + citDateChildMovedInPage, + }) => { + await citDateChildMovedInPage.fillDayLabel('32'); + await citDateChildMovedInPage.fillMonthLabel('13'); + await citDateChildMovedInPage.fillYearLabel('2900'); + await citDateChildMovedInPage.clickSaveAndContinue(); + + expect(citDateChildMovedInPage.errorRealDateSummary).toBeVisible(); + }); + + test('check when entering day and years and clicking save and continue results in error', async ({ + citDateChildMovedInPage, + }) => { + await citDateChildMovedInPage.fillDayLabel('04'); + await citDateChildMovedInPage.fillYearLabel('2020'); + await citDateChildMovedInPage.clickSaveAndContinue(); + + expect(citDateChildMovedInPage.errorMonthSummary).toBeVisible(); + }); + + test('check when entering month and years and clicking save and continue results in error', async ({ + citDateChildMovedInPage, + }) => { + await citDateChildMovedInPage.fillMonthLabel('04'); + await citDateChildMovedInPage.fillYearLabel('2020'); + await citDateChildMovedInPage.clickSaveAndContinue(); + + expect(citDateChildMovedInPage.errorDaySummary).toBeVisible(); + }); + + test('check when entering real date and clicking save and continue it returns to task list page with state completed', async ({ + page, + citTaskListPage, + citDateChildMovedInPage, + }) => { + const expectedState = 'Completed'; + const expectedUrl = 'https://adoption-web.aat.platform.hmcts.net/task-list'; + + await citDateChildMovedInPage.fillDayLabel('01'); + await citDateChildMovedInPage.fillMonthLabel('01'); + await citDateChildMovedInPage.fillYearLabel('2020'); + await citDateChildMovedInPage.clickSaveAndContinue(); + + const actualState = await citTaskListPage.dateChildMovedInStatus.textContent(); + const actualUrl = page.url(); + + await expect.soft(actualState).toContain(expectedState); + await expect.soft(actualUrl).toBe(expectedUrl); + + expect(test.info().errors).toHaveLength(0); + }); +}); diff --git a/playwright-e2e/tests/citizen_journey/task-list-tests.spec.ts b/playwright-e2e/tests/citizen_journey/task-list-tests.spec.ts new file mode 100644 index 000000000..6de3da22a --- /dev/null +++ b/playwright-e2e/tests/citizen_journey/task-list-tests.spec.ts @@ -0,0 +1,165 @@ +import { expect, test } from '../../fixtures/fixtures'; +import { setupUser, teardownUser } from '../../hooks/createDeleteUser.hook'; +test.describe('Citizen Journey task list page test single parent', () => { + let userEmail: string; + let userPassword: string; + let userId: string; + + test.beforeEach(async ({ signIn, citApplyingWithPage }) => { + const userInfo = await setupUser(); + if (userInfo) { + userEmail = userInfo.email; + userPassword = userInfo.password; + userId = userInfo.id; + } + await signIn.navigateTo(); + await signIn.signIn(userEmail, userPassword); + await citApplyingWithPage.checkApplyingOnMyOwnRadioButton(); + await citApplyingWithPage.clickSaveAndContinue(); + }); + + test.afterEach('Status check', async () => { + await teardownUser(userId); + }); + + test('check default page is in English', async ({ page }) => { + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^en/); + }); + + test('check page is in Welsh after clicking Welsh language link', async ({ page, citTaskListPage }) => { + await citTaskListPage.clickLanguageLink(); + + const langAttribute = await page.getAttribute('html', 'lang'); + + expect(langAttribute).toMatch(/^cy/); + }); + + test('check number of applicants status is marked completed', async ({ citTaskListPage }) => { + const expected = 'Completed'; + + const actual = await citTaskListPage.numberOfApplicantsStatus.textContent(); + + expect(actual).toContain(expected); + }); + + test('check date child moved in is marked not started', async ({ citTaskListPage }) => { + const expected = 'Not Started'; + + const actual = await citTaskListPage.dateChildMovedInStatus.textContent(); + + expect(actual).toContain(expected); + }); + + test('check child detail is marked not started', async ({ citTaskListPage }) => { + const expected = 'Not Started'; + + const actual = await citTaskListPage.childDetailsStatus.textContent(); + + expect(actual).toContain(expected); + }); + + test('check adoption agency is marked not started', async ({ citTaskListPage }) => { + const expected = 'Not Started'; + + const actual = await citTaskListPage.adoptionAgencyStatus.textContent(); + + expect(actual).toContain(expected); + }); + + test('check family court is marked not started', async ({ citTaskListPage }) => { + const expected = 'Not Started'; + + const actual = await citTaskListPage.familyCourtStatus.textContent(); + + expect(actual).toContain(expected); + }); + + test('check first personal detail is marked in progress', async ({ citTaskListPage }) => { + const expected = 'In Progress'; + + const actual = await citTaskListPage.firstApplicantPersonalDetailsStatus.textContent(); + + expect(actual).toContain(expected); + }); + + test('check first contact details is marked not started', async ({ citTaskListPage }) => { + const expected = 'Not Started'; + + const actual = await citTaskListPage.firstApplicantContactDetailsStatus.textContent(); + + expect(actual).toContain(expected); + }); + + test('check second personal details to be hidden', async ({ citTaskListPage }) => { + await expect.soft(citTaskListPage.secondApplicantPersonalDetailsStatus).toBeHidden({ timeout: 500 }); + await expect.soft(citTaskListPage.secondApplicantContactDetailsStatus).toBeHidden({ timeout: 500 }); + + expect(test.info().errors).toHaveLength(0); + }); + + test('check review pay and submit your application status to be cannot start yet', async ({ citTaskListPage }) => { + const expected = 'Cannot start yet'; + + const actual = await citTaskListPage.reviewPayAndSubmitStatus.textContent(); + + expect(actual).toBe(expected); + }); + + test('check number of applicants link goes to expected URL', async ({ citTaskListPage, page }) => { + const expected = 'https://adoption-web.aat.platform.hmcts.net/applying-with'; + + await citTaskListPage.clickNumberOfApplicantsLink(); + + expect(page.url()).toBe(expected); + }); + + test('check date child moved in link goes to expected URL', async ({ citTaskListPage, page }) => { + const expected = 'https://adoption-web.aat.platform.hmcts.net/date-child-moved-in'; + + await citTaskListPage.clickDateChildMovedInLink(); + + expect(page.url()).toBe(expected); + }); + + test('check child details link goes to expected URL', async ({ citTaskListPage, page }) => { + const expected = 'https://adoption-web.aat.platform.hmcts.net/children/full-name'; + + await citTaskListPage.clickChildDetailsLink(); + + expect(page.url()).toBe(expected); + }); + + test('check adoption agency link goes to expected URL', async ({ citTaskListPage, page }) => { + const expected = 'https://adoption-web.aat.platform.hmcts.net/children/social-worker'; + + await citTaskListPage.clickAdoptionAgencyLink(); + + expect(page.url()).toBe(expected); + }); + + test('check family court link goes to expected URL', async ({ citTaskListPage, page }) => { + const expected = 'https://adoption-web.aat.platform.hmcts.net/children/find-placement-order-court'; + + await citTaskListPage.clickFamilyCourtLink(); + + expect(page.url()).toBe(expected); + }); + + test('check applicant 1 personal details link goes to expected URL', async ({ citTaskListPage, page }) => { + const expected = 'https://adoption-web.aat.platform.hmcts.net/applicant1/full-name'; + + await citTaskListPage.clickFirstApplicantPersonalDetailsLink(); + + expect(page.url()).toBe(expected); + }); + + test('check applicant 1 contact details link goes to expected URL', async ({ citTaskListPage, page }) => { + const expected = 'https://adoption-web.aat.platform.hmcts.net/applicant1/address/lookup'; + + await citTaskListPage.clickFirstAppicantContactDetailsLink(); + + expect(page.url()).toBe(expected); + }); +}); diff --git a/playwright-e2e/tests/full_journey/e2e-citizen-la-journey-tests.spec.ts b/playwright-e2e/tests/full_journey/e2e-citizen-la-journey-tests.spec.ts new file mode 100644 index 000000000..24d851bab --- /dev/null +++ b/playwright-e2e/tests/full_journey/e2e-citizen-la-journey-tests.spec.ts @@ -0,0 +1,298 @@ +import { faker } from '@faker-js/faker'; +import * as dotenv from 'dotenv'; + +import { expect, test } from '../../fixtures/fixtures'; +import { runAccessibilityScan } from '../../helpers/accessibilityHelper'; +import * as e2eJourneyHelper from '../../helpers/e2eJourneyHelper'; +import { setupUser, teardownUser } from '../../hooks/createDeleteUser.hook'; +import App from '../../pages/app.page'; + +dotenv.config(); + +test.describe('e2e citzen submit citizen and la journeys', () => { + let userEmail: string; + let userPassword: string; + let userId: string; + + test.beforeEach(async ({ signIn }) => { + const userInfo = await setupUser(); + if (userInfo) { + userEmail = userInfo.email; + userPassword = userInfo.password; + userId = userInfo.id; + } + await signIn.navigateTo(); + }); + + test.afterEach('Status check', async () => { + await teardownUser(userId); + }); + + const e2eTestTags = { tag: ['@e2e', '@citizen', '@accessibility'] }; + + test( + 'submitting application where spouse is not a partner local authority journey', + e2eTestTags, + async ( + { + page, + citSubmittedPage, + laSignInPage, + laGettingStartedPage, + laChildDetailsPage, + laChildSexAtBirthPage, + laChildNationalityPage, + laBirthMotherNamePage, + laBirthMotherAliveStatusPage, + laBirthMotherNationalityPage, + laBirthMotherOccupationPage, + laBirthMotherLastKnownAddressBranchPage, + laBirthMotherLastKnownAddressPage, + laBirthMotherLastDateConfirmedAddressPage, + laBirthMotherServeDocumentsPage, + laBirthFatherOnCertificatePage, + laBirthFatherNamePage, + laBirthFatherStillAliveStatusPage, + laBirthFatherParentalResponsibilityPage, + laBirthFatherParentalResponsibilityGrantedPage, + laBirthFatherNationalityPage, + laBirthFatherOccupationPage, + laBirthFatherLastKnownAddressBranchPage, + laBirthFatherLastKnownAddressPage, + laBirthFatherLastDateConfirmedAddressPage, + laBirthFatherServeDocumentsPage, + laOtherPersonResponsibilityPage, + laPlacementOrderNumberPage, + laPlacementDateOfOrderPage, + laPlacementOrdersSummaryPage, + laChildHasOtherSiblingsPage, + laUploadDocumentsPage, + laCheckYourAnswerPage, + laStatementOfTruthPage, + laConfirmationPage, + makeAxeBuilder, + }, + testInfo + ) => { + const app = new App(page); + const appOneFirstName = faker.person.firstName(); + const appOneLastName = faker.person.lastName(); + const appTwoFirstName = faker.person.firstName(); + const appTwoLastName = faker.person.lastName(); + const appOneFullname = appOneFirstName + ' ' + appOneLastName; + const appTwoFullname = appTwoFirstName + ' ' + appTwoFirstName; + const childFirstName = faker.person.firstName(); + const childLastName = faker.person.lastName(); + const childFullname = childFirstName + ' ' + childLastName; + const stringNumberOfApplicationLocator = 'notSpouseOrCivilPartner'; + + await e2eJourneyHelper.citizenAdoptionSignInWithNoPartner( + app, + userEmail, + userPassword, + stringNumberOfApplicationLocator + ); + + // Date child move in with you + await e2eJourneyHelper.citizenAdoptionDateChildMovedIn(app); + + // Child's details before adoption + await e2eJourneyHelper.citzenAdoptionChildDetailsBeforeAdoption(app, appOneFirstName, appOneLastName); + + // Child's details after adoption + await e2eJourneyHelper.citizenAdoptionChildDetailsAfterAdoption(app, childFirstName, childLastName); + + // Social Worker Details + await e2eJourneyHelper.citizenAdoptionSocialWorkDetails(app); + + // The family court details + await e2eJourneyHelper.citizenAdoptionFamilyCourtDetails(app); + + // First applicant Your personal details + await e2eJourneyHelper.citizenAdoptionApplicantPersonalDetails(app); + + // First applicant Your contact details + await e2eJourneyHelper.citizenAdoptionApplicantContactDetails(app); + + //Second applicant personal details + await e2eJourneyHelper.citizenAdoptionSecondApplicantPersonalDetails(app, appTwoFirstName, appTwoLastName); + + // Second applicant contact details + await e2eJourneyHelper.citizenAdoptionSecondApplicantContactDetails(app); + + // submit + await e2eJourneyHelper.citizenAdoptionSubmitApplication( + app, + appOneFullname, + appTwoFullname, + stringNumberOfApplicationLocator + ); + + // citizen submitted page + await citSubmittedPage.initialiseReferenceNumber(page); + const referenceNum = citSubmittedPage.referenceNumber; + + await laSignInPage.navigateTo(); + await laSignInPage.startLAJourney(referenceNum, childFullname); + await laGettingStartedPage.laGettingStarted(); + await laChildDetailsPage.clickBirthCertificateDetailsSection(); + + // Child sex at birth page + await laChildSexAtBirthPage.checkMaleRadioButton(); + await laChildSexAtBirthPage.clickSaveAndContinue(); + + // Child nationality page + await laChildNationalityPage.checkBritishCheckbox(); + await laChildNationalityPage.clickSaveAndContinue(); + + // Back to main naviagation page + await laChildDetailsPage.clickBirthMotherDetailsLink(); + + // Mother section + // Mother name page + await laBirthMotherNamePage.fillBirthMotherNames('Jayne', 'Eyre'); + await laBirthMotherNamePage.clickSaveAndContinue(); + + // Mother alive page + await laBirthMotherAliveStatusPage.checkBirthMotherAliveYesRadioButton(); + await laBirthMotherAliveStatusPage.clickSaveAndContinue(); + + // Mother nationality page + await laBirthMotherNationalityPage.checkBritishCheckbox(); + await laBirthMotherNationalityPage.clickSaveAndContinue(); + + // Mother occupation page + await laBirthMotherOccupationPage.fillBirthMotherOccupationLabel('Teacher'); + await laBirthMotherOccupationPage.clickSaveAndContinue(); + + // Mother address branch page + await laBirthMotherLastKnownAddressBranchPage.checkYesRadioButton(); + await laBirthMotherLastKnownAddressBranchPage.clickSaveAndContinue(); + + // Mother last known address page + await laBirthMotherLastKnownAddressPage.fillPostCodeLabel('SW1A 0AA'); + await laBirthMotherLastKnownAddressPage.clickFindAddressButton(); + await laBirthMotherLastKnownAddressPage.selectAddressOption('0'); + await laBirthMotherLastKnownAddressPage.clickSaveAndContinue(); + + // Mother last date confirmed address page + await laBirthMotherLastDateConfirmedAddressPage.fillDayLabel('01'); + await laBirthMotherLastDateConfirmedAddressPage.fillMonthLabel('01'); + await laBirthMotherLastDateConfirmedAddressPage.fillYearLabel('2020'); + await laBirthMotherLastDateConfirmedAddressPage.clickSaveAndContinue(); + + // Mother documents page + await laBirthMotherServeDocumentsPage.checkYesRadioButton(); + await laBirthMotherServeDocumentsPage.clickSaveAndContinue(); + + // Back to the main navigation page + await laChildDetailsPage.clickBirthFatherDetailsLink(); + + // Father on certificate + await laBirthFatherOnCertificatePage.checkYesRadioButton(); + await laBirthFatherOnCertificatePage.clickSaveAndContinue(); + + // Father name page + await laBirthFatherNamePage.fillFirstNameLabel('tester'); + await laBirthFatherNamePage.fillLastNameLabel('tests'); + await laBirthFatherNamePage.clickSaveAndContinue(); + + // Father alive page + await laBirthFatherStillAliveStatusPage.checkYesRadioButton(); + await laBirthFatherStillAliveStatusPage.clickSaveAndContinue(); + + // Father parental responsibility + await laBirthFatherParentalResponsibilityPage.checkYesRadioButton(); + await laBirthFatherParentalResponsibilityPage.clickSaveAndContinue(); + + // Father parental responsibility granted + await laBirthFatherParentalResponsibilityGrantedPage.checkBirthCertificateCheckbox(); + await laBirthFatherParentalResponsibilityGrantedPage.clickSaveAndContinue(); + + // Father nationality page + await laBirthFatherNationalityPage.checkBritishCheckbox(); + await laBirthFatherNationalityPage.clickSaveAndContinue(); + + // Father occupation page + await laBirthFatherOccupationPage.fillBirthFatherOccupationLabel('Teacher'); + await laBirthFatherOccupationPage.clickSaveAndContinue(); + + // Father last known address branch page + await laBirthFatherLastKnownAddressBranchPage.checkYesRadioButton(); + await laBirthFatherLastKnownAddressBranchPage.clickSaveAndContinue(); + + // Father last known address page + await laBirthFatherLastKnownAddressPage.fillPostCodeLabel('SW1A 0AA'); + await laBirthFatherLastKnownAddressPage.clickFindAddressButton(); + await laBirthFatherLastKnownAddressPage.selectAddressOption('0'); + await laBirthFatherLastKnownAddressPage.clickSaveAndContinue(); + + // Father last date address confirmed page + await laBirthFatherLastDateConfirmedAddressPage.fillDayLabel('01'); + await laBirthFatherLastDateConfirmedAddressPage.fillMonthLabel('01'); + await laBirthFatherLastDateConfirmedAddressPage.fillYearLabel('1990'); + await laBirthFatherLastDateConfirmedAddressPage.clickSaveAndContinue(); + + // Father documents page page + await laBirthFatherServeDocumentsPage.checkYesRadioButton(); + await laBirthFatherServeDocumentsPage.clickSaveAndContinue(); + + // Back to main navigaton page + await laChildDetailsPage.clickOtherPersonLink(); + + // Other person parental responsibility page + await laOtherPersonResponsibilityPage.checkNoRadioButton(); + await laOtherPersonResponsibilityPage.clickSaveAndContinue(); + + // Back to main navigation page + await laChildDetailsPage.clickPlacementAndOrderLink(); + + // courts order number page + await laPlacementOrderNumberPage.fillOrderNumberLabel('abc'); + await laPlacementOrderNumberPage.clickSaveAndContinue(); + + // courts date page + await laPlacementDateOfOrderPage.fillDayLabel('01'); + await laPlacementDateOfOrderPage.fillMonthLabel('01'); + await laPlacementDateOfOrderPage.fillYearLabel('2020'); + await laPlacementDateOfOrderPage.clickSaveAndContinue(); + + // court orders already in place + await laPlacementOrdersSummaryPage.checkNoRadioButton(); + await laPlacementOrdersSummaryPage.clickSaveAndContinue(); + + // Back to main navigation page + await laChildDetailsPage.clickSiblingCourtOrderDetailsLink(); + + // siblings order page + await laChildHasOtherSiblingsPage.checkNoRadioButton(); + await laChildHasOtherSiblingsPage.clickSaveAndContinue(); + + // Back to main navigation page + await laChildDetailsPage.clickUploadDocumentLink(); + + // upload documents page + await laUploadDocumentsPage.checkCannotUploadDocumentsCheckbox(); + await laUploadDocumentsPage.clickSaveAndContinue(); + + // Back to main navigation page + await laChildDetailsPage.clickReviewAndSubmitButton(); + + // Check you answers page + await laCheckYourAnswerPage.clickContinue(); + + // statement of truth page + await laStatementOfTruthPage.fillFullNameLabel('John Smith'); + await laStatementOfTruthPage.fillJobTItleLabel('solicitor'); + await laStatementOfTruthPage.fillLocalAuthorityRepresentationLabel('KCC'); + await laStatementOfTruthPage.checkTruthStatementCheckbox(); + await laStatementOfTruthPage.clickConfirm(); + + // Check that confirmation has been reached + const expected = laConfirmationPage.pageURL; + await expect(page).toHaveURL(expected); + + await runAccessibilityScan(makeAxeBuilder, testInfo); + } + ); +}); diff --git a/playwright-e2e/tests/smoke.spec.ts b/playwright-e2e/tests/smoke.spec.ts index ab856bffb..08b21a809 100644 --- a/playwright-e2e/tests/smoke.spec.ts +++ b/playwright-e2e/tests/smoke.spec.ts @@ -48,6 +48,7 @@ test.describe('smoke test', () => { const appOneName = await app.applicantOneNameCreate(); const childNames = await app.childNameCreate(); + await app.signIn.navigateTo(); await app.signIn.signIn(userEmail, userPassword); await app.numberOfApplicants.numberOfApplication(applicantNumber); await app.basePage.clickSaveAndContinue(); @@ -78,6 +79,12 @@ test.describe('smoke test', () => { await app.reviewSubmit.statementOfTruthOne(appOneName.appOneFullname); await app.reviewSubmit.fillCardDetails(appOneName.appOneFullname, userEmail, postcode1); + // const caseIdLocator = app.page.locator('.govuk-panel__body strong'); + const element = await app.page.locator('.govuk-panel.govuk-panel--confirmation .govuk-panel__body strong').first(); + const someText = await element.textContent(); + console.log(someText); + await app.page.pause(); + await runAccessibilityScan(makeAxeBuilder, testInfo); //Axe-core accessibility scan using helper function } diff --git a/playwright-e2e/utils/config.utils.ts b/playwright-e2e/utils/config.utils.ts new file mode 100644 index 000000000..ce8656538 --- /dev/null +++ b/playwright-e2e/utils/config.utils.ts @@ -0,0 +1,27 @@ +export interface CitizenCredentials { + username: string; + password: string; +} + +export interface LACredentials { + caseReferenceNumber: string; + childName: string; + dob: { + day: string; + montth: string; + year: string; + }; +} + +interface Urls { + citizenURL: string; + laUrl: string; +} + +export interface Config { + users: { + citizen: CitizenCredentials; + la: LACredentials; + }; + urls: Urls; +}