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

DTSCCI-1313 Create Step Methods For Notify Claim Details Event #5288

Merged
merged 12 commits into from
Jan 30, 2025
Merged
3 changes: 0 additions & 3 deletions playwright-e2e/base/base-api-steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import User from '../models/user';
import { bankHolidays } from '../config/data';
import { CCDEvent } from '../models/ccd/ccd-events';
import ObjectHelper from '../helpers/object-helper';
import { AllMethodsStep } from '../decorators/test-steps';
import TestData from '../models/test-data';
import { civilAdminUser, claimantSolicitorUser } from '../config/users/exui-users';

@AllMethodsStep()
export default abstract class BaseApiSteps extends BaseSteps {
private _requestsFactory: RequestsFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import BasePage from '../../../../base/base-page';
import { AllMethodsStep } from '../../../../decorators/test-steps';
import DateHelper from '../../../../helpers/date-helper';
import ExuiPage from '../../exui-page/exui-page';
import { getDefendantHeading, subheading, table } from './certificate-of-service-submit-content';
import {
getDefendantHeading,
subheading,
table,
} from './certificate-of-service-notify-claim-details-submit-content';

@AllMethodsStep()
export default class CertificateOfServiceSubmitFragment extends ExuiPage(BasePage) {
export default class CertificateOfServiceNotifyClaimDetailsSubmitFragment extends ExuiPage(
BasePage,
) {
async verifyContent() {
await super.runVerifications(
[
Expand Down Expand Up @@ -37,9 +43,11 @@ export default class CertificateOfServiceSubmitFragment extends ExuiPage(BasePag
[
super.expectText(
DateHelper.formatDateToString(dateDeemedServed, { outputFormat: 'DD Mon YYYY' }),
{ first: true },
),
super.expectText(
DateHelper.formatDateToString(dateOfService, { outputFormat: 'DD Mon YYYY' }),
{ first: true },
),
super.expectText(table.documentsServed.defendant1Answer),
super.expectText(table.documentsServedLocation.defendant1Answer),
Expand All @@ -54,21 +62,21 @@ export default class CertificateOfServiceSubmitFragment extends ExuiPage(BasePag
}

async verifyDefendant2Answers() {
const dateDeemedServed = DateHelper.subtractFromToday({ days: 14 });
const dateOfService = DateHelper.subtractFromToday({
days: 14,
const dateDeemedServed = DateHelper.getToday();
const dateOfService = DateHelper.addToToday({
days: 2,
workingDay: true,
addDayAfter4pm: true,
});
await super.runVerifications(
[
super.expectText(
DateHelper.formatDateToString(dateDeemedServed, { outputFormat: 'DD Mon YYYY' }),
{ count: null },
{ index: 1 },
),
super.expectText(
DateHelper.formatDateToString(dateOfService, { outputFormat: 'DD Mon YYYY' }),
{ count: null },
{ index: 1 },
),
super.expectText(table.documentsServed.defendant2Answer),
super.expectText(table.documentsServedLocation.defendant2Answer),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { Party } from '../../../../models/partys';
import StringHelper from '../../../../helpers/string-helper';

export const heading = (defendantParty: Party) => `Certificate of Service [${defendantParty.key}]`;

export const inputs = {
dateOfService: {
label: 'On what day did you serve?',
},
dateDeemedServed: {
label: 'The date of service is',
},
documentsServed: {
label: 'What documents did you serve?',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosServedDocumentFiles`,
},
documentsServedLocation: {
label: 'Where did you serve the documunts',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipientServeLocation`,
},
notifyClaimRecipient: {
label: 'Who did you serve the claim to?',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipient`,
},
statementOfTruth: {
name: {
label: 'Your name',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosSender`,
},
firm: {
label: 'Your firm',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosSenderFirm`,
},
},
evidenceDocument: {
label: 'Supporting evidence',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosEvidenceDocument_value`,
},
};

export const dropdowns = {
serveType: {
label: 'How did you serve the documents?',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipientServeType`,
options: [
'Personally handed it to or left it with',
'Delivered to or left at permitted place',
'Sent by first class post or another service which delivers on the next business day',
'Other means permitted by the court',
],
},
locationType: {
label: 'Select the type of location where you served the documents',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipientServeLocationType`,
options: [
'Usual Residence',
'Last known residence',
'Place of business of the partnership/company/corporation within the jurisdiction with a connection to the claim',
'Principal office of the company',
'Principal office of the coropration',
'Principal office of the partnership',
'Last known principal place of business',
'Principal place of business',
'Place of business',
'Email',
'Other',
],
},
};

export const radioButtons = {
docsServed: {
label: 'The location where you served the documents was the:',
litigationFriend: {
label: "litigation friend's",
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipientServeLocationOwnerType-FRIEND`,
},
solicitor: {
label: "solicitor's",
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipientServeLocationOwnerType-SOLICITOR`,
},
defendant: {
label: "defendant's",
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipientServeLocationOwnerType-DEFENDANT`,
},
claimant: {
label: "claimant's",
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosRecipientServeLocationOwnerType-CLAIMANT`,
},
},
};

export const checkboxes = {
signedTrue: {
label: 'I believe that the facts stated in the certificate are true',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosUISenderStatementOfTruthLabel-CERTIFIED`,
},
};

export const buttons = {
addNewSupportingEvidence: {
title: 'Add new',
selector: (defendantParty: Party) =>
`div[id='cosNotifyClaimDetails${defendantParty.number}_cosEvidenceDocument'] button[class='button write-collection-add-item__top']`,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { Page } from 'playwright-core';
import BasePage from '../../../../base/base-page';
import filePaths from '../../../../config/file-paths';
import { AllMethodsStep } from '../../../../decorators/test-steps';
import DateHelper from '../../../../helpers/date-helper';
import ExuiPage from '../../exui-page/exui-page';
import {
heading,
inputs,
buttons,
checkboxes,
dropdowns,
radioButtons,
} from './certificate-of-service-notify-claim-details-content';
import { Party } from '../../../../models/partys';
import DateFragment from '../date/date-fragment';

@AllMethodsStep()
export default class CertificateOfServiceNotifyClaimDetailsFragment extends ExuiPage(BasePage) {
private dateFragment: DateFragment;
private defendantParty: Party;

constructor(page: Page, defendantParty: Party) {
super(page);
this.dateFragment = new DateFragment(page);
this.defendantParty = defendantParty;
}

async verifyContent() {
await super.runVerifications(
[
super.expectHeading(heading(this.defendantParty)),
super.expectText(inputs.dateDeemedServed.label),
super.expectText(inputs.dateDeemedServed.label),
super.expectLabel(inputs.statementOfTruth.firm.label),
super.expectLabel(inputs.documentsServed.label),
super.expectLabel(inputs.statementOfTruth.name.label),
super.expectLabel(inputs.notifyClaimRecipient.label),
super.expectLabel(dropdowns.locationType.label),
super.expectLabel(dropdowns.serveType.label),
super.expectLabel(radioButtons.docsServed.litigationFriend.label),
super.expectLabel(radioButtons.docsServed.defendant.label),
super.expectLabel(radioButtons.docsServed.litigationFriend.label),
super.expectLabel(radioButtons.docsServed.solicitor.label),
super.expectText(checkboxes.signedTrue.label, { first: true }),
],
{ runAxe: false },
);
}

async fillCertificateOfService() {
const dateDeemedServed = DateHelper.getToday();
const dateOfService = DateHelper.addToToday({
days: 2,
workingDay: true,
addDayAfter4pm: true,
});

await this.dateFragment.enterDate(dateDeemedServed, 'cosDateOfServiceForDefendant');
await this.dateFragment.enterDate(dateOfService, 'cosDateDeemedServedForDefendant');

await super.inputText(
`Test Documents ${this.defendantParty.number}`,
inputs.documentsServed.selector(this.defendantParty),
);
await super.inputText(
`Defendant ${this.defendantParty.number}`,
inputs.notifyClaimRecipient.selector(this.defendantParty),
);
await super.selectFromDropdown(
dropdowns.locationType.options[this.defendantParty.number - 1],
dropdowns.locationType.selector(this.defendantParty),
);
await super.inputText(
`Test Address ${this.defendantParty.number}`,
inputs.documentsServedLocation.selector(this.defendantParty),
);
await super.clickBySelector(radioButtons.docsServed.claimant.selector(this.defendantParty));
await super.selectFromDropdown(
dropdowns.serveType.options[this.defendantParty.number - 1],
dropdowns.serveType.selector(this.defendantParty),
);
}

async uploadSupportingEvidence() {
await super.clickBySelector(buttons.addNewSupportingEvidence.selector(this.defendantParty));
await super.retryUploadFile(
filePaths.testPdfFile,
inputs.evidenceDocument.selector(this.defendantParty),
);
}

async fillStatementOfTruth() {
await super.inputText(
`Name ${this.defendantParty.number}`,
inputs.statementOfTruth.name.selector(this.defendantParty),
);
await super.inputText(
`Law firm ${this.defendantParty.number}`,
inputs.statementOfTruth.firm.selector(this.defendantParty),
);
await super.clickBySelector(checkboxes.signedTrue.selector(this.defendantParty));
}

async submit() {
throw new Error('Method not implemented.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const inputs = {
evidenceDocument: {
label: 'Supporting evidence',
selector: (defendantParty: Party) =>
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.key)}_cosEvidenceDocument_value`,
`#cosNotifyClaimDetails${StringHelper.capitalise(defendantParty.number.toString())}_cosEvidenceDocument_value`,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import {
checkboxes,
dropdowns,
radioButtons,
} from './certificate-of-service-content';
} from './certificate-of-service-notify-claim-content';
import { Party } from '../../../../models/partys';
import DateFragment from '../date/date-fragment';

@AllMethodsStep()
export default class CertificateOfServiceFragment extends ExuiPage(BasePage) {
export default class CertificateOfServiceFragmentNotifyClaim extends ExuiPage(BasePage) {
private dateFragment: DateFragment;
private defendantParty: Party;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
import { Page } from 'playwright-core';
import BasePage from '../../../../../base/base-page';
import { AllMethodsStep } from '../../../../../decorators/test-steps';
import CertificateOfServiceFragment from '../../../fragments/certificate-of-service/certificate-of-service-fragment';
import CertificateOfServiceNotifyClaimDetailsFragment from '../../../fragments/certificate-of-service-notify-claim-details/certificate-of-service-notify-claim-details-fragment';
import ExuiPage from '../../../exui-page/exui-page';

@AllMethodsStep()
export default class CertificateOfService1NotifyClaimDetailsPage extends ExuiPage(BasePage) {
private certificateOfServiceFragment: CertificateOfServiceFragment;
private certificateOfServiceNotifyClaimDetailsFragment: CertificateOfServiceNotifyClaimDetailsFragment;

constructor(certificateOfServiceFragment: CertificateOfServiceFragment, page: Page) {
constructor(
certificateOfServiceNotifyClaimDetailsFragment: CertificateOfServiceNotifyClaimDetailsFragment,
page: Page,
) {
super(page);
this.certificateOfServiceFragment = certificateOfServiceFragment;
this.certificateOfServiceNotifyClaimDetailsFragment =
certificateOfServiceNotifyClaimDetailsFragment;
}

async verifyContent() {
await super.runVerifications([this.certificateOfServiceFragment.verifyContent()]);
await super.runVerifications([
this.certificateOfServiceNotifyClaimDetailsFragment.verifyContent(),
]);
}

async fillDetails() {
await this.certificateOfServiceFragment.fillCertificateOfService();
await this.certificateOfServiceFragment.uploadSupportingEvidence();
await this.certificateOfServiceFragment.fillCertificateOfService();
await this.certificateOfServiceNotifyClaimDetailsFragment.fillCertificateOfService();
await this.certificateOfServiceNotifyClaimDetailsFragment.uploadSupportingEvidence();
await this.certificateOfServiceNotifyClaimDetailsFragment.fillStatementOfTruth();
}

async submit() {
Expand Down
Loading