Skip to content

Commit

Permalink
Merge branch 'master' into CIV-16322
Browse files Browse the repository at this point in the history
  • Loading branch information
rajakm authored Jan 23, 2025
2 parents e79bb1d + 693ead1 commit 40b65f5
Show file tree
Hide file tree
Showing 26 changed files with 444 additions and 44 deletions.
22 changes: 22 additions & 0 deletions playwright-e2e/constants/partys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ const partys: Partys = {
CLAIMANT_1: {
key: 'claimant1',
oldKey: 'applicant1',
shortOldKey: 'app1',
number: 1,
partyType: PartyType.CLAIMANT,
oldPartyType: PartyType.APPLICANT,
},
CLAIMANT_2: {
key: 'claimant2',
oldKey: 'applicant2',
shortOldKey: 'app2',
number: 2,
partyType: PartyType.CLAIMANT,
oldPartyType: PartyType.APPLICANT,
Expand Down Expand Up @@ -46,6 +48,12 @@ const partys: Partys = {
number: 2,
partyType: PartyType.EXPERT,
},
CLAIMANT_1_MEDIATION_FRIEND: {
key: 'claimantMediation1',
oldKey: 'app1',
number: 1,
partyType: PartyType.MEDIATION_FRIEND,
},
CLAIMANT_WITNESS_1: {
key: 'claimantWitness1',
oldKey: 'applicantWitness1',
Expand All @@ -61,13 +69,15 @@ const partys: Partys = {
DEFENDANT_1: {
key: 'defendant1',
oldKey: 'respondent1',
shortOldKey: 'resp1',
number: 1,
partyType: PartyType.DEFENDANT,
oldPartyType: PartyType.RESPONDENT,
},
DEFENDANT_2: {
key: 'defendant2',
oldKey: 'respondent2',
shortOldKey: 'resp2',
number: 2,
partyType: PartyType.DEFENDANT,
oldPartyType: PartyType.RESPONDENT,
Expand Down Expand Up @@ -144,6 +154,18 @@ const partys: Partys = {
number: 2,
partyType: PartyType.WITNESS,
},
DEFENDANT_1_MEDIATION_FRIEND: {
key: 'defendant1Mediation',
oldKey: 'resp1',
number: 1,
partyType: PartyType.MEDIATION_FRIEND,
},
DEFENDANT_2_MEDIATION_FRIEND: {
key: 'defendant2Mediation',
oldKey: 'resp2',
number: 2,
partyType: PartyType.MEDIATION_FRIEND,
},
};

export default partys;
15 changes: 15 additions & 0 deletions playwright-e2e/helpers/case-data-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export default class CaseDataHelper {
return '07501234567';
case partys.CLAIMANT_WITNESS_2:
return '07984112233';
case partys.CLAIMANT_1_MEDIATION_FRIEND:
return '07984224466';
case partys.DEFENDANT_1:
return '07853654321';
case partys.DEFENDANT_2:
Expand All @@ -94,6 +96,10 @@ export default class CaseDataHelper {
return '07592345612';
case partys.DEFENDANT_2_WITNESS_2:
return '07985674230';
case partys.DEFENDANT_1_MEDIATION_FRIEND:
return '07985366442';
case partys.DEFENDANT_2_MEDIATION_FRIEND:
return '07985685321';
}
}

Expand Down Expand Up @@ -214,6 +220,15 @@ export default class CaseDataHelper {
};
}

static buildMediationData(party: Party) {
return {
firstName: StringHelper.capitalise(party.key),
lastName: 'Mediation',
emailAddress: `${party.key}@mediation.com`,
phoneNumber: this.getPartyPhoneNumber(party),
};
}

static buildWitnessData(party: Party) {
return {
firstName: StringHelper.capitalise(party.key),
Expand Down
4 changes: 4 additions & 0 deletions playwright-e2e/models/partys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type Party = {
number: number;
partyType: PartyType;
oldPartyType?: PartyType;
shortOldKey?: string;
};

type Partys = {
Expand All @@ -18,6 +19,7 @@ type Partys = {
CLAIMANT_WITNESS_2: Party;
CLAIMANT_EXPERT_1: Party;
CLAIMANT_EXPERT_2: Party;
CLAIMANT_1_MEDIATION_FRIEND: Party;
DEFENDANT_1: Party;
DEFENDANT_2: Party;
DEFENDANT_1_LITIGATION_FRIEND: Party;
Expand All @@ -32,6 +34,8 @@ type Partys = {
DEFENDANT_1_EXPERT_2: Party;
DEFENDANT_2_EXPERT_1: Party;
DEFENDANT_2_EXPERT_2: Party;
DEFENDANT_1_MEDIATION_FRIEND: Party;
DEFENDANT_2_MEDIATION_FRIEND: Party;
};

export default Partys;
22 changes: 10 additions & 12 deletions playwright-e2e/pages/exui/fragments/date/date-fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ export default class DateFragment extends ExuiPage(BasePage) {
);
}

async enterDate(date: Date, selectorPrefix: string, index?: number) {
await super.inputText(DateHelper.getTwoDigitDay(date), inputs.day.selector(selectorPrefix), {
async enterDate(date: Date, selectorKey: string, index?: number) {
await super.inputText(DateHelper.getTwoDigitDay(date), inputs.day.selector(selectorKey), {
index,
});
await super.inputText(
DateHelper.getTwoDigitMonth(date),
inputs.month.selector(selectorPrefix),
{ index },
);
await super.inputText(date.getFullYear(), inputs.year.selector(selectorPrefix), {
await super.inputText(DateHelper.getTwoDigitMonth(date), inputs.month.selector(selectorKey), {
index,
});
await super.inputText(date.getFullYear(), inputs.year.selector(selectorKey), {
index,
});
}
Expand All @@ -48,19 +46,19 @@ export default class DateFragment extends ExuiPage(BasePage) {
partyType: ClaimantDefendantPartyType,
index?: number,
) {
const selectorPrefix = `${partyType.key}DateOfBirth`;
const selectorKey = `${partyType.key}DateOfBirth`;
const dateOfBirth = new Date(CaseDataHelper.getPartyDateOfBirth(claimantDefendantParty));
await super.inputText(
DateHelper.getTwoDigitDay(dateOfBirth),
inputs.day.selector(selectorPrefix),
inputs.day.selector(selectorKey),
{ index },
);
await super.inputText(
DateHelper.getTwoDigitMonth(dateOfBirth),
inputs.month.selector(selectorPrefix),
inputs.month.selector(selectorKey),
{ index },
);
await super.inputText(dateOfBirth.getFullYear(), inputs.year.selector(selectorPrefix), {
await super.inputText(dateOfBirth.getFullYear(), inputs.year.selector(selectorKey), {
index,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const buttons = {
};

export const inputs = {
timelineDate: {
selectorKey: 'timelineDate',
},
timelineDescription: {
label: 'What happened',
selector: (eventNumber: number) => `#timelineOfEvents_${eventNumber - 1}_timelineDescription`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class ClaimTimelinePage extends ExuiPage(BasePage) {

async enterTimelineEvent1Details() {
const date = DateHelper.subtractFromToday({ months: 3 });
await this.dateFragment.enterDate(date, '#timelineDate', 0);
await this.dateFragment.enterDate(date, inputs.timelineDate.selectorKey, 0);
await super.inputText(
`This the timeline - ${partys.CLAIMANT_1.key}`,
inputs.timelineDescription.selector(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export const inputs = {
extensionDate: {
label: 'Enter the extension date that was agreed with the other party',
hintText: 'This date cannot be more than 28 days from the original deadline.',
selectorKey: 'respondentSolicitor1AgreedDeadlineExtension',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class ExtensionDateSpecPage extends ExuiPage(BasePage) {
days: 28,
workingDay: true,
});
await this.dateFragment.enterDate(extensionDate, 'respondentSolicitor1AgreedDeadlineExtension');
await this.dateFragment.enterDate(extensionDate, inputs.extensionDate.selectorKey);
}

async submit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ 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';
Expand All @@ -36,6 +38,9 @@ import DefenceResponseDocumentPage from './unspec/defence-response-document/defe
import RespondentResponse1v2Page from './unspec/respondent-response/respondent-response-1v2-page';
import RespondentResponse2v1Page from './unspec/respondent-response/respondent-response-2v1-page';
import RespondentResponsePage from './unspec/respondent-response/respondent-response-page';
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';
export default class ClaimantResponsePageFactory extends BasePageFactory {
get respondentResponsePage() {
return new RespondentResponsePage(this.page);
Expand Down Expand Up @@ -101,6 +106,23 @@ export default class ClaimantResponsePageFactory extends BasePageFactory {
return new DisclosureReportPage(this.page, partys.CLAIMANT_1);
}

get mediationContactInformationPage() {
return new MediationContactInformationPage(
this.page,
partys.CLAIMANT_1,
partys.CLAIMANT_1_MEDIATION_FRIEND,
);
}

get mediationAvailabilityPage() {
const dateFragment = new DateFragment(this.page);
return new MediationAvailabilityPage(
this.page,
dateFragment,
partys.CLAIMANT_1_MEDIATION_FRIEND,
);
}

get smallClaimExpertsClaimantPage() {
return new SmallClaimExpertsClaimantPage(this.page);
}
Expand All @@ -122,11 +144,13 @@ export default class ClaimantResponsePageFactory extends BasePageFactory {
}

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

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

get draftDirectionsPage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import RespondentResponseType2v1Page from './unspec/respondent-response-type/res
import RespondentResponseTypePage from './unspec/respondent-response-type/respondent-response-type-page';
import SolicitorReferencesPage from './unspec/solicitor-references/solicitor-references-page';
import UploadDefendantResponsePage from './unspec/upload-defendant-response/upload-defendant-response-page';
import MediationContactInformationPage from '../mediation/mediation-contact-information/mediation-contact-information-page';
import MediationAvailabilityPage from '../mediation/mediation-availability/mediation-availability-page';

export default class DefendantResponsePageFactory extends BasePageFactory {
get respondentChecklistPage() {
Expand All @@ -71,7 +73,7 @@ export default class DefendantResponsePageFactory extends BasePageFactory {
return new ConfirmDetails1v2Page(this.page, dateFragment);
}

get responseConfirmNameAdressPage() {
get responseConfirmNameAddressPage() {
return new ResponseConfirmNameAddressPage(this.page);
}

Expand Down Expand Up @@ -105,7 +107,7 @@ export default class DefendantResponsePageFactory extends BasePageFactory {
return new RespondentResponseTypePage(this.page, partys.DEFENDANT_1);
}

get respondentResponseTypeDefendantwPage() {
get respondentResponseTypeDefendant2Page() {
return new RespondentResponseTypePage(this.page, partys.DEFENDANT_2);
}

Expand Down Expand Up @@ -193,6 +195,40 @@ export default class DefendantResponsePageFactory extends BasePageFactory {
return new MediationPage(this.page, partys.DEFENDANT_2);
}

get mediationContactInformationDefendant1Page() {
return new MediationContactInformationPage(
this.page,
partys.DEFENDANT_1,
partys.DEFENDANT_1_MEDIATION_FRIEND,
);
}

get mediationContactInformationDefendant2Page() {
return new MediationContactInformationPage(
this.page,
partys.DEFENDANT_2,
partys.DEFENDANT_2_MEDIATION_FRIEND,
);
}

get mediationAvailabilityDefendant1Page() {
const dateFragment = new DateFragment(this.page);
return new MediationAvailabilityPage(
this.page,
dateFragment,
partys.DEFENDANT_1_MEDIATION_FRIEND,
);
}

get mediationAvailabilityDefendant2Page() {
const dateFragment = new DateFragment(this.page);
return new MediationAvailabilityPage(
this.page,
dateFragment,
partys.DEFENDANT_2_MEDIATION_FRIEND,
);
}

get fileDirectionsQuestionaireDefendant1Page() {
return new FileDirectionsQuestionnairePage(this.page, partys.DEFENDANT_1);
}
Expand Down Expand Up @@ -274,11 +310,13 @@ export default class DefendantResponsePageFactory extends BasePageFactory {
}

get hearingDefendant1Page() {
return new HearingPage(this.page, partys.DEFENDANT_1);
const dateFragment = new DateFragment(this.page);
return new HearingPage(this.page, dateFragment, partys.DEFENDANT_1);
}

get hearingDefendant2Page() {
return new HearingPage(this.page, partys.DEFENDANT_2);
const dateFragment = new DateFragment(this.page);
return new HearingPage(this.page, dateFragment, partys.DEFENDANT_2);
}

get smallClaimHearingDefendant1Page() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const inputs = {
},
amountPaidDate: {
label: 'When was this amount paid?',
selectorKey: 'whenWasThisAmountPaid',
},
amountPaidOther: {
label: 'Tell us how',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class DefenceRoutePage extends ExuiPage(BasePage) {
async fillInHasPaid() {
const datePaid = DateHelper.subtractFromToday({ months: 1 });
await super.inputText('500', inputs.amountPaid.selector(this.defendantParty));
await this.dateFragment.enterDate(datePaid, 'whenWasThisAmountPaid');
await this.dateFragment.enterDate(datePaid, inputs.amountPaidDate.selectorKey);
}

async submit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const inputs = {
timelineEvent: {
date: {
label: 'Date (Optional)',
selectorKey: 'timelineDate',
},
eventDescription: {
label: 'What happened (Optional)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ export default class HowToAddTimelineManualPage extends ExuiPage(BasePage) {

async fillEvent1Details() {
const date = DateHelper.subtractFromToday({ years: 1 });
await this.dateFragment.enterDate(date, 'timelineDate', 0);
await this.dateFragment.enterDate(date, inputs.timelineEvent.date.selectorKey, 0);
await super.inputText(
'Timeline event description for event 1',
`Timeline event description for event 1 - ${this.defendantParty.key}`,
inputs.timelineEvent.eventDescription.selector(this.defendantParty, 0),
);
}

async fillEvent2Details() {
const date = DateHelper.subtractFromToday({ months: 11 });
await this.dateFragment.enterDate(date, 'timelineDate', 1);
await this.dateFragment.enterDate(date, inputs.timelineEvent.date.selectorKey, 1);
await super.inputText(
'Timeline event description for event 2',
`Timeline event description for event 2 - ${this.defendantParty.key}`,
inputs.timelineEvent.eventDescription.selector(this.defendantParty, 1),
);
}
Expand Down
Loading

0 comments on commit 40b65f5

Please sign in to comment.