Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DFPL-2358: test housekeeping v2 #5468

Closed
wants to merge 12 commits into from
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"dependencies": {
"@axe-core/playwright": "^4.8.5",
"@types/lodash": "^4.14.202",
"dotenv": "^16.4.1"
"dotenv": "^16.4.1",
"playwright": "^1.45.1"
}
}
8 changes: 0 additions & 8 deletions playwright-e2e/pages/applicant-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,10 @@ export class ApplicantDetails extends BasePage{

async applicantDetailsNeeded() {
await expect(this.applicantDetailsHeading).toBeVisible();
await this.teamManagerName.click();
await this.teamManagerName.fill(this.teamManagerNameString);
await this.pbaNumber.click();
await this.pbaNumber.fill('PBA1234567');
await this.customerReference.click();
await this.customerReference.fill('1234567');
await this.clientCode.click();
await this.clientCode.fill('1234567');
await this.phoneNumber.click();
await this.phoneNumber.fill('1234567890');
await this.clickContinue();
// clickContinue is required twice
Expand All @@ -63,11 +58,8 @@ export class ApplicantDetails extends BasePage{
await this.continueButton.click();
await this.addNew.click();
await this.colleagueRole_SocialWorker.check();
await this.colleagueName.click();
await this.colleagueName.fill('Peter Green');
await this.colleagueEmail.click();
await this.colleagueEmail.fill('[email protected]');
await this.colleaguePhoneNumber.click();
await this.colleaguePhoneNumber.fill('0123456789');
await this.caseUpdateNotification_No.check(); //this checks no. Same as above, these radio buttons are not grouped.
await expect(this.removeColleague).toBeVisible();
Expand Down
17 changes: 15 additions & 2 deletions playwright-e2e/pages/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ export class BasePage {
readonly checkYourAnswersHeader: Locator;
readonly saveAndContinue: Locator;
readonly submit: Locator;
readonly dobDay: Locator; //DOB (date of birth)
readonly dobMonth: Locator;
readonly dobYear: Locator;
readonly rateLimit: Locator;


constructor(page: Page) {
this.page = page;
this.nextStep = page.getByLabel("Next step");
Expand All @@ -21,6 +23,9 @@ export class BasePage {
this.checkYourAnswersHeader = page.getByRole('heading', { name: 'Check your answers' });
this.saveAndContinue = page.getByRole("button", { name: "Save and Continue"});
this.submit = page.getByRole('button', { name: 'Submit' });
this.dobDay = page.getByLabel('Day');
this.dobMonth = page.getByLabel('Month');
this.dobYear = page.getByLabel('Year');
this.rateLimit = page.getByText('Your request was rate limited. Please wait a few seconds before retrying your document upload');
}

Expand Down Expand Up @@ -90,4 +95,12 @@ export class BasePage {
async clickSubmit() {
await this.submit.click();
}
}

async dobFillOut(date: string, month: string, year: string){
await this.dobDay.fill(date);
await this.dobMonth.fill(month);
await this.dobYear.fill(year);
}
}


38 changes: 10 additions & 28 deletions playwright-e2e/pages/child-details.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { type Page, type Locator, expect } from "@playwright/test";
import { BasePage } from "./base-page";


export class ChildDetails extends BasePage{
readonly firstName: Locator;
readonly lastName: Locator;
Expand Down Expand Up @@ -83,55 +81,41 @@ export class ChildDetails extends BasePage{
this.applyToAllChildren = page.getByRole('group', { name: 'Do all the children have this' });
this.childgroup = page.getByRole('group', { name: `${(this.child)}` });
this.unregisteredOrganisation = page.getByLabel('Organisation name (Optional)');


}

async postcodeFindAddress(postcode: string, selectAdd: string){
await this.postcode.fill(postcode);
await this.findAddress.click();
await this.selectAddress.selectOption(selectAdd);
}

async childDetailsNeeded(){
await this.firstName.click();
await this.firstName.fill('Susan');
await this.lastName.click();
await this.lastName.fill('Brown');
await this.dobDay.click();
await this.dobDay.fill('10');
await this.dobMonth.click();
await this.dobMonth.fill('1');
await this.dobYear.click();
await this.dobYear.fill('2019');
await this.dobYear.fill((new Date().getUTCFullYear()-5).toString());
await this.gender.selectOption('2: Girl');
await this.page.getByLabel('Living with respondents').click();
await this.page.getByLabel('Living with respondents').click(); //duplicated line is NOT an error - solves issue with checkbox not being able to be checked.
await expect(this.page.getByLabel('Living with respondents')).toBeChecked(); //needed due to flakiness of checking the box.
await this.slDay.click();
await this.slDay.fill('1');
await this.slMonth.click();
await this.slMonth.fill('2');
await this.slYear.click();
await this.slYear.fill('2022');
await this.postcode.fill('BN26 6AL');
await this.findAddress.click();
await this.selectAddress.selectOption('1: Object');
await this.keyDates.click();
await this.slYear.fill((new Date().getUTCFullYear() - 2).toString());
await this.postcodeFindAddress('BN26 6AL', '1: Object');
await this.keyDates.fill('these are the key dates');
await this.briefSummaryCare.click();
await this.briefSummaryCare.fill('this is the brief summary of care and contact plan');
await this.adoption.getByLabel('No').check();
await this.motherName.click();
await this.motherName.fill('Claire Brown');
await this.fatherName.click();
await this.fatherName.fill('Charles Brown');
await this.fatherParentalResponsibility.selectOption('1: Yes');
await this.socialWorkerName.click();
await this.socialWorkerName.fill('Robert Taylor');
await this.telephone.click();
await this.telephone.fill('0123456789');
await this.personToContact.click();
await this.personToContact.fill('Jane Smith');
await this.additionalNeeds.getByLabel('No').check();
await this.contactDetailsHidden.getByLabel('No').check();
await this.litigationCapability.getByLabel('No', { exact: true }).click();
await this.clickContinue();
await expect(this.checkYourAnswersHeader).toBeVisible();
await this.checkYourAnsAndSubmit();
}

Expand All @@ -151,9 +135,7 @@ export class ChildDetails extends BasePage{
await this.representativeLastName.fill('One');
await this.representativeEmail.fill('[email protected]');
await this.unregisteredOrganisation.fill('NewOrganisation');
await this.postcode.fill('TW7');
await this.findAddress.click();
await this.selectAddress.selectOption({index: 1});
await this.postcodeFindAddress('TW7', '1: Object');
await this.representativeTelephone.locator('#childrenMainRepresentative_telephoneNumber_telephoneNumber').fill('012345678');
}

Expand Down
4 changes: 1 addition & 3 deletions playwright-e2e/pages/other-people-in-the-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ export class OtherPeopleInCase extends BasePage {

async personOneToBeGivenNotice() {
await this.fullName.fill("John Doe");
await this.dobDay.fill("1");
await this.dobMonth.fill("10");
await this.dobYear.fill("1990")
await this.dobFillOut("2","11",(new Date().getUTCFullYear()-20).toString());
await this.gender.selectOption('1: Male');
await this.placeOfBirth.fill("London");
await this.currentAddress.getByLabel('No').check();
Expand Down
33 changes: 7 additions & 26 deletions playwright-e2e/pages/respondent-details.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import {type Page, type Locator, expect} from "@playwright/test";

export class RespondentDetails {

import { BasePage } from "./base-page";
export class RespondentDetails extends BasePage{
readonly page: Page;
readonly respondentDetailsHeading: Locator;
readonly firstName: Locator;
readonly lastName: Locator;
readonly dobDay: Locator; //DOB (date of birth)
readonly dobMonth: Locator;
readonly dobYear: Locator;

readonly gender: Locator;
readonly currentAddress: Locator;
readonly telephone: Locator;
Expand All @@ -18,18 +15,14 @@ export class RespondentDetails {
readonly litigationCapacity: Locator; //ie Ability to take part in proceedings
readonly litigationCapacityReason: Locator;
readonly legalRepresentation: Locator;
readonly continue: Locator;
readonly saveAndContinue: Locator;
readonly addressNotKnownReason: Locator;

public constructor(page: Page) {
super(page);
this.page = page;
this.respondentDetailsHeading = page.getByRole("heading", { name: 'Respondents\' details' });
this.firstName = page.getByLabel('*First name (Optional)');
this.lastName = page.getByLabel('*Last name (Optional)');
this.dobDay = page.getByLabel('Day');
this.dobMonth = page.getByLabel('Month');
this.dobYear = page.getByLabel('Year');
this.gender = page.getByLabel('Gender (Optional)');
this.currentAddress = page.getByRole('group', { name: '*Current address known?' });
this.addressNotKnownReason = page.getByLabel('*Reason the address is not known');
Expand All @@ -40,37 +33,25 @@ export class RespondentDetails {
this.litigationCapacity = page.getByRole('group', { name: 'Do you believe this person will have problems with litigation capacity (understanding what\'s happening in the case)? (Optional)' });
this.litigationCapacityReason = page.getByLabel('Give details, including assessment outcomes and referrals to health services (Optional)');
this.legalRepresentation = page.getByRole('group', { name: '*Do they have legal representation? (Optional)' });
this.continue = page.getByRole('button', { name: 'Continue' });
this.saveAndContinue = page.getByRole('button', { name: 'Save and continue' });
}

async respondentDetailsNeeded() {
await expect(this.respondentDetailsHeading).toBeVisible();
await this.firstName.click();
await this.firstName.fill('John');
await this.lastName.click();
await this.lastName.fill('Smith');
await this.dobDay.click();
await this.dobDay.fill('10');
await this.dobMonth.click();
await this.dobMonth.fill('11');
await this.dobYear.click();
await this.dobYear.fill('2001');
await this.dobFillOut("1","12",(new Date().getUTCFullYear()-20).toString());
await this.gender.click(); //not sure if click needed
await this.gender.selectOption('1: Male');
await this.currentAddress.getByLabel('No').check();
await this.addressNotKnownReason.selectOption('2: Person deceased');
await this.telephone.fill('01234567890');
await this.relationToChild.click();
await this.relationToChild.fill('aunt');
await this.relationToChildContact.getByLabel('Yes').check();
await this.relationToChildContactReason.click();
await this.relationToChildContactReason.fill('this is the reason');
await this.litigationCapacity.getByLabel('Yes').check();
await this.litigationCapacityReason.click();
await this.litigationCapacityReason.fill('these are the details');
await this.legalRepresentation.getByLabel('No').check();
await this.continue.click();
await this.saveAndContinue.click();
await this.clickContinue();
await this.checkYourAnsAndSubmit();
}
}
Loading