Skip to content

Commit

Permalink
DTSCCI-1315 Create Step Methods For Claimant Response Event (#5270)
Browse files Browse the repository at this point in the history
* complete steps for claimant response spec.

* remove defendant number.

* remove 2v1 not needed

* Add comment for mediation step missing

* complete steps for claimant response unspec

* solve error name is steps for claimant response unspec

* solve error name is steps for claimant response spec

* amend specs changes & test

* commit

* changes needed for 1v1 unspec small claim.

* Add number for witnesses page.

* Changes 2v1 unspec small claim path

* changes for 1v1 spec small claim.

* changes for fast track.

* changes for 2v1 spec small claim.

* Changes for 1v1 Fast Track

* remove party name from 2v1 respondent response

* change language page verification.

* Amend respondent response spec 2v1 selectors and page

* Remove Verification confirm claimant

* replace index with ignoreDuplicates

* remove statement of truth content and checks

* replace file for tests

* If statement for application content.

* If statement for application content.

* add Small claim hearing to factory

* remove small claim hearing from hearing spec.

* Adding back selectors and changing 2v1 spec respondent response

* correct errors.

* Amend testfile.

* Amend step files.

* fix imports &  code

* update step names

* more updates

* correct index

* add witness data to witness page

* update small claims page objects

* update

* update

* finished writing all page object variations

* more updates to page objects for steps

* update for hearing fast track page

* Final Changes for step methods for claimant response

* update pages and step files

* update witness number

* make small claim witness and small claim experts in one page object for defendant and claimant

* remove test data from steps

---------

Co-authored-by: kdaHMCTS <[email protected]>
Co-authored-by: kdaHMCTS <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2025
1 parent 2a013d5 commit 7215bf2
Show file tree
Hide file tree
Showing 59 changed files with 1,187 additions and 416 deletions.
4 changes: 2 additions & 2 deletions playwright-e2e/base/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export default abstract class BasePage {
runAxe?: boolean;
axeExclusions?: string[];
useAxeCache?: boolean;
axePageInsertName?: string;
axePageInsertName?: string | number;
} = {},
) {
if (expects) {
Expand Down Expand Up @@ -317,7 +317,7 @@ export default abstract class BasePage {
private async expectAxeToPass(
axeExclusions: string[],
useAxeCache: boolean,
axePageInsertName?: string,
axePageInsertName?: string | number,
) {
const axeBuilder = new AxeBuilder({ page: this.page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22a', 'wcag22aa'])
Expand Down
16 changes: 8 additions & 8 deletions playwright-e2e/helpers/case-data-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ export default class CaseDataHelper {
static buildAddressData(party: Party) {
return {
AddressLine1: `Flat 12 - ${party.key}`,
AddressLine2: `${party.key} House 15 - 17`,
AddressLine3: `${party.key} Street`,
PostTown: `${party.key} Town`,
County: `${party.key} County`,
Country: `${party.key} Country`,
AddressLine2: `House 15 - 17 - ${party.key}`,
AddressLine3: `Street - ${party.key} `,
PostTown: `Town - ${party.key}`,
County: `County - ${party.key}`,
Country: `Country - ${party.key}`,
PostCode: this.getPartyPostCode(party),
};
}
Expand Down Expand Up @@ -214,8 +214,8 @@ export default class CaseDataHelper {
lastName: 'Expert',
emailAddress: `${party.key}@experts.com`,
phoneNumber: this.getPartyPhoneNumber(party),
fieldOfExpertise: `Field of expertise ${party.key}`,
whyRequired: `Required for ${party.key}`,
fieldOfExpertise: `Field of expertise - ${party.key}`,
whyRequired: `Reason required - ${party.key}`,
estimatedCost: this.getExpertEstimatedCost(party),
};
}
Expand All @@ -235,7 +235,7 @@ export default class CaseDataHelper {
lastName: 'Witness',
phoneNumber: this.getPartyPhoneNumber(party),
emailAddress: `${party.key}@witnesses.com`,
reasonForWitness: `Reason for witness ${party.key}`,
reasonForWitness: `Reason for witness - ${party.key}`,
};
}

Expand Down
2 changes: 1 addition & 1 deletion playwright-e2e/helpers/string-helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default class StringHelper {
static capitalise(str: string) {
const firstChar = str.charAt(0).toUpperCase();
const restOfStr = str.substring(1).toLowerCase();
const restOfStr = str.substring(1);
return `${firstChar}${restOfStr}`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export default class RemoteHearingSpecFragment extends ExuiPage(BasePage) {
super.expectSubheading(subheadings.remoteHearing),
super.expectText(radioButtons.remoteHearing.label),
super.expectText(radioButtons.remoteHearing.hintText),
super.expectLabel(radioButtons.remoteHearing.yes.label),
super.expectLabel(radioButtons.remoteHearing.no.label),
],
{
runAxe: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import BasePage from '../../../../base/base-page';
import { Party } from '../../../../models/partys';
import ExuiPage from '../../exui-page/exui-page';
import { inputs, subheadings } from './statement-of-truth-content';
import StringHelper from '../../../../helpers/string-helper';

export default class StatementOfTruthFragment extends ExuiPage(BasePage) {
private solicitorParty: Party;
Expand All @@ -24,8 +25,11 @@ export default class StatementOfTruthFragment extends ExuiPage(BasePage) {
}

async enterDetails() {
await super.inputText(this.solicitorParty.key, inputs.name.selector);
await super.inputText(this.solicitorParty.partyType, inputs.role.selector);
await super.inputText(StringHelper.capitalise(this.solicitorParty.key), inputs.name.selector);
await super.inputText(
StringHelper.capitalise(this.solicitorParty.partyType),
inputs.role.selector,
);
}

async submit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import ApplicationPage from '../directions-questionaire/lr-spec/application/appl
import DisclosureOfElectronicDocumentsPage from '../directions-questionaire/lr-spec/disclosure-of-electronic-documents/discloure-of-electronic-documents-page';
import DisclosureOfNonElectronicDocumentsSpecPage from '../directions-questionaire/lr-spec/disclosure-of-non-electronic-documents-spec/disclosure-of-non-electronic-documents-spec-page';
import DisclosureReportPage from '../directions-questionaire/lr-spec/disclosure-report/disclosure-report-page';
import MediationContactInformationClaimantPage from '../mediation/mediation-contact-information/mediation-contact-information-page';
import MediationAvailabilityClaimantPage from '../mediation/mediation-availability/mediation-availability-page';
import HearingSpecPage from '../directions-questionaire/lr-spec/hearing-spec/hearing-spec-page';
import SmallClaimExpertsClaimantPage from '../directions-questionaire/lr-spec/small-claim-experts/small-claim-experts-claimant-page';
import SmallClaimWitnessesClaimantPage from '../directions-questionaire/lr-spec/small-claim-witnesses/small-claim-witnesses-claimant-page';
import HearingSpecPage from '../directions-questionaire/lr-spec/hearing-spec/hearing-spec-page.ts';
import SmallClaimExpertsPage from '../directions-questionaire/lr-spec/small-claim-experts/small-claim-experts-page';
import SmallClaimWitnessesPage from '../directions-questionaire/lr-spec/small-claim-witnesses/small-claim-witnesses-page';
import VulnerabilityQuestionsSpecPage from '../directions-questionaire/lr-spec/vulnerability-questions-spec/vulnerability-questions-spec-page';
import DisclosureOfNonElectronicDocumentsPage from '../directions-questionaire/unspec/disclosure-of-non-electronic-documents/disclosure-of-non-electronic-documents-page';
import DraftDirectionsPage from '../directions-questionaire/unspec/draft-directions/draft-directions-page';
Expand All @@ -41,6 +39,11 @@ import RespondentResponsePage from './unspec/respondent-response/respondent-resp
import MediationContactInformationPage from '../mediation/mediation-contact-information/mediation-contact-information-page';
import MediationAvailabilityPage from '../mediation/mediation-availability/mediation-availability-page';
import DateFragment from '../../../fragments/date/date-fragment';
import HearingFastSpecPage from '../directions-questionaire/lr-spec/hearing-spec/hearing-fast-spec-page.ts';
import ClaimType from '../../../../../enums/claim-type.ts';
import SmallClaimExperts2v1ClaimantPage from '../directions-questionaire/lr-spec/small-claim-experts/small-claim-experts-2v1-claimant-page.ts';
import HearingFastPage from '../directions-questionaire/unspec/hearing/hearing-fast-page.ts';

export default class ClaimantResponsePageFactory extends BasePageFactory {
get respondentResponsePage() {
return new RespondentResponsePage(this.page);
Expand Down Expand Up @@ -123,12 +126,16 @@ export default class ClaimantResponsePageFactory extends BasePageFactory {
);
}

get smallClaimExpertsClaimantPage() {
return new SmallClaimExpertsClaimantPage(this.page);
get smallClaimExpertsPage() {
return new SmallClaimExpertsPage(this.page, partys.CLAIMANT_1, partys.CLAIMANT_EXPERT_1);
}

get smallClaimExperts2v1Page() {
return new SmallClaimExperts2v1ClaimantPage(this.page);
}

get smallClaimWitnessesClaimantPage() {
return new SmallClaimWitnessesClaimantPage(this.page);
get smallClaimWitnessesPage() {
return new SmallClaimWitnessesPage(this.page, partys.CLAIMANT_1, partys.CLAIMANT_WITNESS_1);
}

get expertsPage() {
Expand All @@ -148,11 +155,21 @@ export default class ClaimantResponsePageFactory extends BasePageFactory {
return new HearingPage(this.page, dateFragment, partys.CLAIMANT_1);
}

get hearingFastPage() {
const dateFragment = new DateFragment(this.page);
return new HearingFastPage(this.page, dateFragment, partys.CLAIMANT_1);
}

get hearingSpecPage() {
const dateFragment = new DateFragment(this.page);
return new HearingSpecPage(this.page, dateFragment, partys.CLAIMANT_1);
}

get hearingFastSpecPage() {
const dateFragment = new DateFragment(this.page);
return new HearingFastSpecPage(this.page, dateFragment, partys.CLAIMANT_1);
}

get draftDirectionsPage() {
return new DraftDirectionsPage(this.page, partys.CLAIMANT_1);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import BasePage from '../../../../../../../base/base-page.ts';
import { AllMethodsStep } from '../../../../../../../decorators/test-steps.ts';
import CCDCaseData from '../../../../../../../models/ccd/ccd-case-data.ts';
import ExuiPage from '../../../../../exui-page/exui-page.ts';
import { paragraphs } from './statement-of-truth-claimant-response-content.ts';
import StatementOfTruthFragment from '../../../../../fragments/statement-of-truth/statement-of-truth-fragment.ts';
import partys from '../../../../../../../constants/partys.ts';

@AllMethodsStep()
export default class StatementOfTruthClaimantResponsePage extends ExuiPage(BasePage) {
Expand All @@ -19,8 +17,6 @@ export default class StatementOfTruthClaimantResponsePage extends ExuiPage(BaseP
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
this.statementOfTruthFragment.verifyContent(),
super.expectText(paragraphs.descriptiveText1),
super.expectText(paragraphs.descriptiveText2),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ export const confirmationHeadings = {
proceed: 'You have decided to proceed with the claim',
};

export const subheadings = {
happensNext: 'What happens Next',
};

export const paragraphs = {
descriptionText1: "We'll review the case and contact you about what to do next.",
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ import BasePage from '../../../../../../../base/base-page.ts';
import ExuiPage from '../../../../../exui-page/exui-page.ts';
import CCDCaseData from '../../../../../../../models/ccd/ccd-case-data.ts';
import { AllMethodsStep } from '../../../../../../../decorators/test-steps.ts';
import {
confirmationHeadings,
paragraphs,
subheadings,
} from './confirm-claimant-response-spec-content.ts';
import { confirmationHeadings, paragraphs } from './confirm-claimant-response-spec-content.ts';

@AllMethodsStep()
export default class ConfirmClaimantResponseSpecPage extends ExuiPage(BasePage) {
async verifyContent(ccdCaseData: CCDCaseData) {
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
super.expectHeading(confirmationHeadings.proceed),
super.expectSubheading(subheadings.happensNext),
super.expectText(paragraphs.descriptionText1),
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export default class RespondentResponse2v1SpecPage extends ExuiPage(BasePage) {
}

async selectYes() {
await super.clickBySelector(radioButtons.proceedWithClaim.yes.selector);
await super.clickBySelector(radioButtons.proceedWithClaim.yes.selector2v1);
}

async selectNo() {
await super.clickBySelector(radioButtons.proceedWithClaim.no.selector);
await super.clickBySelector(radioButtons.proceedWithClaim.no.selector2v1);
}

async submit() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import ClaimType from '../../../../../../../enums/claim-type';

export const paragraphs = {
fullDefence: 'Defends all of the claim',
responseForm: 'Defendant response form',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class ConfirmClaimantResponsePage extends ExuiPage(BasePage) {
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
super.expectHeading(confirmationHeadings.proceed),
super.expectSubheading(paragraphs.descriptionText1),
super.expectText(paragraphs.descriptionText1),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default class RespondentResponse2v1Page extends ExuiPage(BasePage) {
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
super.expectSubheading(subheadings.docUrl, { index: 0 }),
super.expectLabel(radioButtons.proceedWithClaim.label2v1(partys.CLAIMANT_1)),
super.expectLabel(radioButtons.proceedWithClaim.label2v1(partys.CLAIMANT_2)),
super.expectText(radioButtons.proceedWithClaim.label2v1(partys.CLAIMANT_1)),
super.expectText(radioButtons.proceedWithClaim.label2v1(partys.CLAIMANT_2)),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ export const paragraphs = {
export const radioButtons = {
proceedWithClaim: {
label: 'Do you want to proceed with the claim',
label1v2: `Do you want to proceed with the claim against`,
label2v1: (claimantParty: Party) =>
`Does Claimant ${claimantParty.number} want to proceed with the claim against`,
label1v2: `Do you want to proceed with the claim against`,
yes: {
label: 'Yes',
selector: '#applicant1ProceedWithClaim_Yes',
selector2v1: (claimantParty: Party) =>
`#${StringHelper.capitalise(claimantParty.oldKey)}ProceedWithClaimMultiParty2v1_Yes`,
selector1v2: (defendantParty: Party) =>
`#applicant1ProceedWithClaimAgainst${StringHelper.capitalise(defendantParty.oldKey)}MultiParty1v2_Yes`,
selector2v1: (claimantParty: Party) =>
`#${claimantParty.oldKey}ProceedWithClaimMultiParty2v1_Yes`,
},
no: {
label: 'No',
selector: '#applicant1ProceedWithClaim_No',
selector2v1: (claimantParty: Party) =>
`#${StringHelper.capitalise(claimantParty.oldKey)}ProceedWithClaimMultiParty2v1_No`,
selector1v2: (defendantParty: Party) =>
`#applicant1ProceedWithClaimAgainst${StringHelper.capitalise(defendantParty.oldKey)}MultiParty1v2_No`,
selector2v1: (claimantParty: Party) =>
`#${claimantParty.oldKey}ProceedWithClaimMultiParty2v1_No`,
},
},
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import BasePage from '../../../../../../../base/base-page.ts';
import { AllMethodsStep } from '../../../../../../../decorators/test-steps.ts';
import CCDCaseData from '../../../../../../../models/ccd/ccd-case-data.ts';
import ExuiPage from '../../../../../exui-page/exui-page.ts';
import { paragraphs } from './statement-of-truth-defendant-response-content.ts';
import StatementOfTruthFragment from '../../../../../fragments/statement-of-truth/statement-of-truth-fragment.ts';

@AllMethodsStep()
Expand All @@ -18,8 +17,6 @@ export default class StatmentOfTruthDefendantResponsePage extends ExuiPage(BaseP
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
this.statementOfTruthFragment.verifyContent(),
super.expectText(paragraphs.descriptiveText1),
super.expectText(paragraphs.descriptiveText2),
]);
}

Expand Down
Loading

0 comments on commit 7215bf2

Please sign in to comment.