Skip to content

Commit

Permalink
Dfr 3447 (#2215)
Browse files Browse the repository at this point in the history
* DFR-3447: Tests and supporting files to check that applicantInRefugeQuestion populated and correctly reflected on CYA
  • Loading branch information
ptrelease authored Jan 9, 2025
1 parent fdeecb6 commit 6ae1147
Show file tree
Hide file tree
Showing 11 changed files with 233 additions and 23 deletions.
File renamed without changes.
8 changes: 4 additions & 4 deletions playwright-e2e/fixtures/create-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MiamDetailsPage } from '../pages/events/create-case/MiamDetailsPage';
import { UploadOrderDocumentsPage } from '../pages/events/create-case/UploadOrderDocumentPage';
import { CaseDetailsPage } from '../pages/CaseDetailsPage';
import { RespondentDetailsPage } from '../pages/events/create-case/RespondentDetailsPage';
import { CheckYourAnswersPage } from '../pages/CheckYourAnswersPage';
import { CreateCaseCheckYourAnswersPage } from '../pages/events/create-case/CreateCaseCheckYourAnswersPage';
import { ManageCaseDashboardPage } from '../pages/ManageCaseDashboardPage';
import { HwfApplicationAcceptedPage } from '../pages/events/hwf-application-accepted/HwfApplicationAcceptedPage';
import { SendOrderPage } from '../pages/events/send-order/SendOrderPage';
Expand Down Expand Up @@ -52,7 +52,7 @@ type CreateFixtures = {
miamDetailsPage: MiamDetailsPage;
uploadOrderDocumentsPage: UploadOrderDocumentsPage;
caseDetailsPage: CaseDetailsPage;
checkYourAnswersPage: CheckYourAnswersPage;
createCaseCheckYourAnswersPage: CreateCaseCheckYourAnswersPage;
manageCaseDashboardPage: ManageCaseDashboardPage;
caseSubmissionPage: CaseSubmissionPage;
hwfApplicationAcceptedPage: HwfApplicationAcceptedPage;
Expand Down Expand Up @@ -119,8 +119,8 @@ export const test = base.extend<CreateFixtures>({
caseDetailsPage: async ({ page }, use) => {
await use(new CaseDetailsPage(page));
},
checkYourAnswersPage: async ({ page }, use) => {
await use(new CheckYourAnswersPage(page));
createCaseCheckYourAnswersPage: async ({ page }, use) => {
await use(new CreateCaseCheckYourAnswersPage(page));
},
manageCaseDashboardPage: async ({ page }, use) => {
await use(new ManageCaseDashboardPage(page));
Expand Down
6 changes: 3 additions & 3 deletions playwright-e2e/functional/consented/create_case.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test(
natureOfApplicationPage,
periodicalPaymentsPage,
uploadOrderDocumentsPage,
checkYourAnswersPage,
createCaseCheckYourAnswersPage,
caseDetailsPage,
makeAxeBuilder
},
Expand Down Expand Up @@ -77,8 +77,8 @@ test(
await uploadOrderDocumentsPage.navigateContinue();

//Continue about to submit and check your answers
await checkYourAnswersPage.navigateContinue();
await checkYourAnswersPage.navigateSubmit();
await createCaseCheckYourAnswersPage.navigateContinue();
await createCaseCheckYourAnswersPage.navigateSubmit();

await caseDetailsPage.checkHasBeenCreated();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '../../../fixtures/fixtures';
import config from '../../../config/config';
import { RadioEnum } from '../../../pages/helpers/enums/Refuge';

test(
'Create Case - Contested FormA Submission',
Expand All @@ -25,7 +26,7 @@ test(
miamQuestionPage,
miamDetailsPage,
uploadOrderDocumentsPage,
checkYourAnswersPage,
createCaseCheckYourAnswersPage,
caseDetailsPage,
makeAxeBuilder
},
Expand Down Expand Up @@ -55,7 +56,9 @@ test(
await divorceDetailsPage.navigateContinue();

//applicant details
await applicantDetailsPage.enterApplicantDetailsContested('App First Name', 'App Last Name', true);
const keepPrivate: boolean = true;
const applicantInRefuge: RadioEnum = RadioEnum.YES;
await applicantDetailsPage.enterApplicantDetailsContested('App First Name', 'App Last Name', keepPrivate, applicantInRefuge);
await applicantDetailsPage.navigateContinue();

//respondent details
Expand Down Expand Up @@ -124,8 +127,11 @@ test(
await uploadOrderDocumentsPage.navigateContinue();

//Continue about to submit and check your answers
await checkYourAnswersPage.navigateContinue();
await checkYourAnswersPage.navigateSubmit();
await createCaseCheckYourAnswersPage.navigateContinue();

await createCaseCheckYourAnswersPage.checkApplicantInRefugeQuestion(applicantInRefuge);

await createCaseCheckYourAnswersPage.navigateSubmit();

await caseDetailsPage.checkHasBeenCreated();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import { test, expect } from '../../../fixtures/fixtures';
import config from '../../../config/config';
import { RadioEnum } from '../../../pages/helpers/enums/Refuge';

test(
'Create Case - Contested FormA Submission',
{ tag: ['@accessibility'] },
async (
{
loginPage,
manageCaseDashboardPage,
createCasePage,
startPage,
solicitorDetailsPage,
divorceDetailsPage,
applicantDetailsPage,
respondentDetailsPage,
respondentRepresentedPage,
natureOfApplicationPage,
propertyAdjustmentPage,
periodicalPaymentsPage,
writtenAgreementPage,
fastTrackProcedurePage,
financialAssetsPage,
financialRemedyCourtPage,
miamQuestionPage,
miamDetailsPage,
uploadOrderDocumentsPage,
createCaseCheckYourAnswersPage,
caseDetailsPage,
makeAxeBuilder
},
testInfo
) => {
// Sign in
await manageCaseDashboardPage.visit()
await loginPage.login(config.caseWorker.email, config.caseWorker.password);

// Manage/Create case
await createCasePage.startCase(
config.jurisdiction.familyDivorce,
config.caseType.contested,
config.eventType.formA
);

await startPage.navigateContinue();

// Select whether the applicant is represented or not. Then enter applicant details
await solicitorDetailsPage.setApplicantRepresentation(true);
await solicitorDetailsPage.selectOrganisation(config.organisationNames.finRem1Org);
await solicitorDetailsPage.enterSolicitorDetails('Test App Sol', config.applicant_solicitor.email);
await solicitorDetailsPage.enterSolicitorsFirm('Finrem-1-Org');
await solicitorDetailsPage.enterReferenceNumber('123456');
await solicitorDetailsPage.enterUKaddress();
await solicitorDetailsPage.setEmailConsent(config.caseType.contested);
await solicitorDetailsPage.navigateContinue();

// Enter Divorce / Dissolution Details
await divorceDetailsPage.enterDivorceDetailsContested('LV12D12345', config.divorceStage.petitionIssued);
await divorceDetailsPage.navigateContinue();

//applicant details
const keepPrivate: boolean = true;
const applicantInRefuge: RadioEnum = RadioEnum.YES;
await applicantDetailsPage.enterApplicantDetailsContested('App First Name', 'App Last Name', keepPrivate, applicantInRefuge);
await applicantDetailsPage.navigateContinue();

//respondent details
await respondentDetailsPage.enterRespondentNames('Resp First Name', 'Resp Last Name');
await respondentDetailsPage.navigateContinue();

await respondentRepresentedPage.selectRespondentRepresentedContested(true);
await respondentRepresentedPage.selectOrganisation(
config.organisationNames.finRem2Org
);
await respondentRepresentedPage.enterSolicitorsDetails('Test Respondent', config.applicant_solicitor.email);
await respondentRepresentedPage.navigateContinue();

// Nature of App
await natureOfApplicationPage.selectNatureOfApplication();
await natureOfApplicationPage.navigateContinue();

// Property Adjustment Order
await propertyAdjustmentPage.propertyAdjustmentOrder();
await propertyAdjustmentPage.addAdditionalPropertyAdjustment(true);
await propertyAdjustmentPage.navigateContinue();

// Periodical Payments
await periodicalPaymentsPage.selectPeriodicalPaymentsContested(true);
await periodicalPaymentsPage.navigateContinue();

// Written Agreement
await writtenAgreementPage.selectWrittenAgreement(false);
await writtenAgreementPage.navigateContinue();

//Fast track procedure
await fastTrackProcedurePage.selectFastTrack(true);
await fastTrackProcedurePage.navigateContinue();

//Financial assets
await financialAssetsPage.selectComplexityList('Yes');
await financialAssetsPage.selectAssetsValue('Under £250,000');
await financialAssetsPage.insertFamilyHomeValue('125,000');
await financialAssetsPage.checkPotentialIssueNotApplicableCheckbox();
await financialAssetsPage.navigateContinue();

// Financial Remedies Court
await financialRemedyCourtPage.selectCourtZoneDropDown();
await financialRemedyCourtPage.selectHighCourtJudgeLevel(true);
await financialRemedyCourtPage.enterSpecialFacilities();
await financialRemedyCourtPage.enterSpecialArrangements();
await financialRemedyCourtPage.selectShouldNotProceedApplicantHomeCourt(true);
await financialRemedyCourtPage.enterFrcReason();
await financialRemedyCourtPage.navigateContinue();

// Has attended miam
await miamQuestionPage.selectHasAttendedMiam(true);
await miamQuestionPage.navigateContinue();

// Miam details
await miamDetailsPage.enterMediatorRegistrationNumber();
await miamDetailsPage.enterFamilyMediatorServiceName();
await miamDetailsPage.enterSoleTraderName();
await miamDetailsPage.uploadMiamDoc();
await miamDetailsPage.navigateContinue();

// Upload variation Order Document
await uploadOrderDocumentsPage.uploadVariationOrderDoc();
await uploadOrderDocumentsPage.selectUploadAdditionalDocs(false);
await uploadOrderDocumentsPage.selectUrgentCaseQuestionRadio(false);
await uploadOrderDocumentsPage.navigateContinue();

//Continue about to submit and check your answers
await createCaseCheckYourAnswersPage.navigateContinue();

await createCaseCheckYourAnswersPage.checkApplicantInRefugeQuestion(applicantInRefuge);

await createCaseCheckYourAnswersPage.navigateSubmit();

await caseDetailsPage.checkHasBeenCreated();

// Note: Financial Assets page produces accessibility issues
if (config.run_accessibility) {
const accessibilityScanResults = await makeAxeBuilder().analyze();

await testInfo.attach('accessibility-scan-results', {
body: JSON.stringify(accessibilityScanResults, null, 2),
contentType: 'application/json'
});

expect(accessibilityScanResults.violations).toEqual([]);
}
}
);
9 changes: 0 additions & 9 deletions playwright-e2e/pages/CheckYourAnswersPage.ts

This file was deleted.

25 changes: 22 additions & 3 deletions playwright-e2e/pages/events/create-case/ApplicantDetailsPage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { type Page, Locator } from '@playwright/test';
import { BaseJourneyPage } from '../../BaseJourneyPage';
import { CommonActionsHelper } from '../../helpers/CommonActionsHelper';
import { RadioEnum } from '../../helpers/enums/Refuge';

export class ApplicantDetailsPage extends BaseJourneyPage {

private readonly applicantDetailsPrivateRadio: Locator;
private readonly applicantInRefugeRadio: Locator;

private commonActionsHelper: CommonActionsHelper

Expand All @@ -13,6 +15,7 @@ export class ApplicantDetailsPage extends BaseJourneyPage {
this.commonActionsHelper = commonActionsHelper;

this.applicantDetailsPrivateRadio = page.getByRole('group', { name: 'Keep the Applicant\'s contact' });
this.applicantInRefugeRadio = page.getByRole('group', { name: 'Is the Applicant currently a' });
}

private async selectApplicantDetailsPrivate(keepPrivate: boolean) {
Expand All @@ -21,12 +24,28 @@ export class ApplicantDetailsPage extends BaseJourneyPage {
await optionToSelect.check();
}

async enterApplicantDetailsContested(firstName: string, lastName: string, keepPrivate: boolean){
// When Refuge is neither YES or NO, then checkbox remains blank as question optional.
// Assign required Refuge values to constants (they resolve as undefined when accessed directly)
private async selectApplicantInRefuge(applicantInRefuge: RadioEnum) {
const cYes = RadioEnum.YES;
const cNO = RadioEnum.NO;
switch (applicantInRefuge) {
case cYes:
await this.applicantInRefugeRadio.getByLabel(cYes).check();
break;
case cNO:
await this.applicantInRefugeRadio.getByLabel(cNO).check();
break;
}
}

async enterApplicantDetailsContested(firstName: string, lastName: string, keepPrivate: boolean, applicantInRefuge: RadioEnum){
await this.commonActionsHelper.enterNames(this.page, firstName, lastName);
await this.selectApplicantDetailsPrivate(keepPrivate);
await this.selectApplicantDetailsPrivate(keepPrivate);
await this.selectApplicantInRefuge(applicantInRefuge);
await this.commonActionsHelper.enterUkAddress(this.page);
}

async enterApplicantDetailsConsented(firstName: string, lastName: string){
await this.commonActionsHelper.enterNames(this.page, firstName, lastName);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Page, expect, Locator } from "playwright/test";
import { BaseJourneyPage } from "../../BaseJourneyPage";
import { RadioEnum } from "../../helpers/enums/Refuge";

export class CreateCaseCheckYourAnswersPage extends BaseJourneyPage{

private readonly applicantInRefugeAnswer: Locator;

public constructor(page: Page){
super(page)
this.applicantInRefugeAnswer = page.getByRole('row', { name: 'Is the Applicant currently a' }).locator('span').nth(1);
}

async checkApplicantInRefugeQuestion(answer: RadioEnum) {
await expect(this.applicantInRefugeAnswer).toHaveText(answer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export class SolicitorDetailsPage extends BaseJourneyPage {
await this.solicitorDetailsHelper.enterFirmName(this.page, firmName);
}

async enterSolicitorsFirm(firmName: string) {
await this.solicitorDetailsHelper.enterSolicitorsFirm(this.page, firmName);
}

async setEmailConsent(caseType: string) {
await this.commonActionsHelper.emailConsent(this.page, caseType, true);
}
Expand All @@ -48,4 +52,8 @@ export class SolicitorDetailsPage extends BaseJourneyPage {
const errorMessage = this.page.getByText('Organisation ID is required');
await expect(errorMessage).toHaveText('Organisation ID is required');
}

async enterReferenceNumber(referenceNumber: string) {
await this.solicitorDetailsHelper.enterReferenceNumber(this.page, referenceNumber);
}
}
10 changes: 10 additions & 0 deletions playwright-e2e/pages/helpers/SolicitorDetailsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@ export class SolicitorDetailsHelper {
async enterFirmName(page: Page, firmName: string) {
await page.getByLabel('Name of your firm').fill(firmName);
}

async enterSolicitorsFirm(page: Page, firmName: string) {
await page.getByLabel('Solicitor’s firm').fill(firmName);
}

async enterReferenceNumber(page: Page, referenceNumber: string) {
await page.getByLabel('Your reference number').fill(referenceNumber);
}


}
5 changes: 5 additions & 0 deletions playwright-e2e/pages/helpers/enums/Refuge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum RadioEnum {
YES = 'Yes',
NO = 'No',
BLANK = '',
}

0 comments on commit 6ae1147

Please sign in to comment.