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 1314 #5315

Merged
merged 32 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1407c56
test: initial feature of the test.
Jan 23, 2025
e314d41
DTSCCI-000 Enable Spec DJ Tests in Prod (#5282)
kdaHMCTS Jan 22, 2025
550a9cb
CIV-16475 Fixed costs to base ccd config (#5286)
sankaviv1 Jan 22, 2025
2ed3ffc
CIV-16434 HMC NRO fix (#5258)
Gareth40343 Jan 23, 2025
4ebc31e
CIV-15886 Gen app email subject line (#5218)
vasudevganesanhmcts Jan 23, 2025
a7b7cc4
DTSCCI-000 Fix Playwright Base Page (#5290)
kdaHMCTS Jan 23, 2025
a800efd
DTSCCI-1068 Create Page Objects and Content For Create Claim (#5292)
kdaHMCTS Jan 23, 2025
7738b86
intermediate commit
Jan 23, 2025
259f6d5
update: further changes and commits to the test.
Jan 25, 2025
2b247cc
test: interim test code that has been working and build.
Jan 27, 2025
3c877a3
test: updated the code for the Respond to Defence 1v2DS
Jan 28, 2025
1e0321f
test: adding the final cut of the 1v2DS tests
Jan 29, 2025
17f9257
Merge branch 'master' into DTSCCI-1314
kdaHMCTS Jan 29, 2025
b25e3e1
update defendant page factory
kdaHMCTS Jan 29, 2025
43c8f80
Merge branch 'DTSCCI-1314' of https://github.com/hmcts/civil-ccd-defi…
kdaHMCTS Jan 29, 2025
acfc9b5
test: adding the 1v2SS and the 2v1 tests
Jan 30, 2025
c354d70
Merge branch 'master' into DTSCCI-1314
kdaHMCTS Jan 30, 2025
aec8412
fixing page object conflicts
kdaHMCTS Jan 31, 2025
41d5a4c
Merge branch 'master' into DTSCCI-1314
kdaHMCTS Jan 31, 2025
298b900
Fixed some conflicts with page objects and added Full e2e tests for t…
kdaHMCTS Jan 31, 2025
dcc336a
update defendant response steps methods
kdaHMCTS Feb 3, 2025
69fa02e
update claimant response steps and create claim steps
kdaHMCTS Feb 4, 2025
db5a9cb
update notify claim and notify claim details step files
kdaHMCTS Feb 4, 2025
8a1ed44
update defendant response steps files
kdaHMCTS Feb 4, 2025
a2545cb
update configuration of steps files
kdaHMCTS Feb 5, 2025
5268f91
update steps
kdaHMCTS Feb 5, 2025
bdd1bb6
Merge branch 'master' into DTSCCI-1314
kdaHMCTS Feb 5, 2025
7e32c41
remove unwanted code
kdaHMCTS Feb 5, 2025
1caf4ac
add retries to retryChooseNextStep
kdaHMCTS Feb 5, 2025
2a5b3bb
move field validation check outside exuiPage clickSubmit
kdaHMCTS Feb 6, 2025
c2c8714
Merge branch 'master' into DTSCCI-1314
kdaHMCTS Feb 6, 2025
a23da0a
Merge branch 'master' into DTSCCI-1314
kdaHMCTS Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions playwright-e2e/base/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,26 @@ export default abstract class BasePage {
});
}

@BoxedDetailedStep(classKey, 'text')
@TruthyParams(classKey, 'text')
protected async expectNoHeading(
text: string | number,
options: {
message?: string;
timeout?: number;
} = {},
) {
const locator = this.page.locator('h1', { has: this.page.locator(`text="${text}"`) });

try {
await locator.waitFor({ state: 'visible', timeout: 20 });
// eslint-disable-next-line no-empty
} catch (err) {}
await pageExpect(locator, { message: options.message }).toBeHidden({
timeout: options.timeout,
});
}

@BoxedDetailedStep(classKey, 'text')
protected async expectSubheading(
text: string,
Expand Down Expand Up @@ -437,6 +457,42 @@ export default abstract class BasePage {
}
}

@BoxedDetailedStep(classKey, 'text')
@TruthyParams(classKey, 'text')
protected async expectNoSubheading(
text: string | number,
options: {
message?: string;
exact?: boolean;
containerSelector?: string;
all?: boolean;
index?: number;
first?: boolean;
timeout?: number;
} = {},
) {
if (options.first && options.index !== undefined) {
throw new ExpectError("Cannot use 'first' and 'index' options at the same time");
}

let locator = this.page.locator('h2', { has: this.page.locator(`text="${text}"`) });
locator = this.getNewLocator(locator, options.containerSelector, options.index, options.first);

try {
await locator.waitFor({ state: 'visible', timeout: 20 });
// eslint-disable-next-line no-empty
} catch (err) {}
if (options.all) {
await pageExpect(locator, { message: options.message }).allToBeHidden({
timeout: options.timeout,
});
} else {
await pageExpect(locator, { message: options.message }).toBeHidden({
timeout: options.timeout,
});
}
}

@BoxedDetailedStep(classKey, 'selector')
protected async expectSelector(
selector: string,
Expand Down Expand Up @@ -579,7 +635,7 @@ export default abstract class BasePage {
locator = this.getNewLocator(locator, options.containerSelector, options.index, options.first);

try {
await locator.waitFor({ state: 'visible', timeout: 500 });
await locator.waitFor({ state: 'visible', timeout: 20 });
// eslint-disable-next-line no-empty
} catch (err) {}
if (options.all) {
Expand Down Expand Up @@ -785,7 +841,7 @@ export default abstract class BasePage {
protected async retryAction(
action: () => Promise<void>,
assertions: () => Promise<void>[] | Promise<void>,
message: string,
message?: string,
{ retries = 1, assertFirst = false }: { retries?: number; assertFirst?: boolean } = {},
) {
while (retries >= 0) {
Expand All @@ -796,7 +852,7 @@ export default abstract class BasePage {
break;
} catch (error) {
if (retries <= 0) throw error;
console.log(message);
console.log(message ?? 'Action failed, trying again');
console.log(`Retries: ${retries} remaining`);
retries--;
assertFirst = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,37 @@ import claimantDefendantPartyTypes from '../../../../../../constants/claimant-de
import { AllMethodsStep } from '../../../../../../decorators/test-steps';
import ClaimTrack from '../../../../../../enums/claim-track';
import ClaimType from '../../../../../../enums/claim-type';
import { UploadDocumentValue } from '../../../../../../models/ccd/ccd-case-data';
import { ClaimantDefendantPartyType } from '../../../../../../models/claimant-defendant-party-types';
import createClaimData from './create-claim-data-components';

@AllMethodsStep()
export default class CreateClaimDataBuilder extends BaseDataBuilder {
async buildSmallTrack1v1(particularsOfClaimDocument: UploadDocumentValue) {
return this.buildData(particularsOfClaimDocument);
async buildSmallTrack1v1() {
return this.buildData();
}

async buildSmallTrack1v2DifferentSolicitor() {
return this.buildData({ claimType: ClaimType.ONE_VS_TWO_DIFF_SOL });
}

async buildSmallTrack2v1() {
return this.buildData({ claimType: ClaimType.TWO_VS_ONE });
}

protected async buildData(
particularsOfClaimDocument: UploadDocumentValue,
{
claimType = ClaimType.ONE_VS_ONE,
claimTrack = ClaimTrack.SMALL_CLAIM,
claimant1PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
claimant2PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
defendant1PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
defendant2PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
}: {
claimType?: ClaimType;
claimTrack?: ClaimTrack;
claimant1PartyType?: ClaimantDefendantPartyType;
claimant2PartyType?: ClaimantDefendantPartyType;
defendant1PartyType?: ClaimantDefendantPartyType;
defendant2PartyType?: ClaimantDefendantPartyType;
} = {},
) {
protected async buildData({
claimType = ClaimType.ONE_VS_ONE,
claimTrack = ClaimTrack.SMALL_CLAIM,
claimant1PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
claimant2PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
defendant1PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
defendant2PartyType = claimantDefendantPartyTypes.INDIVIDUAL,
}: {
claimType?: ClaimType;
claimTrack?: ClaimTrack;
claimant1PartyType?: ClaimantDefendantPartyType;
claimant2PartyType?: ClaimantDefendantPartyType;
defendant1PartyType?: ClaimantDefendantPartyType;
defendant2PartyType?: ClaimantDefendantPartyType;
} = {}) {
return {
...createClaimData.references,
...createClaimData.claimantCourt,
Expand All @@ -43,7 +46,7 @@ export default class CreateClaimDataBuilder extends BaseDataBuilder {
...createClaimData.defendant2Represented(claimType),
...createClaimData.defendant2SameSolicitor(claimType),
...createClaimData.defendantSolicitor2(claimType),
...createClaimData.claimDetails(claimTrack, particularsOfClaimDocument),
...createClaimData.claimDetails(claimTrack),
...createClaimData.statementOfTruth,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const defendantSolicitor2 = (claimType: ClaimType) => {
return {};
};

const claimDetails = (claimTrack: ClaimTrack, particularsOfClaimDocument: UploadDocumentValue) => ({
const claimDetails = (claimTrack: ClaimTrack) => ({
ClaimTypeUnSpec: {
claimTypeUnSpec: 'PERSONAL_INJURY',
},
Expand All @@ -231,11 +231,11 @@ const claimDetails = (claimTrack: ClaimTrack, particularsOfClaimDocument: Upload
Details: {
detailsOfClaim: 'Test details of claim',
},
Upload: {
servedDocumentFiles: {
particularsOfClaimDocument: [CaseDataHelper.setIdToData(particularsOfClaimDocument)],
},
},
// Upload: {
// servedDocumentFiles: {
// particularsOfClaimDocument: [CaseDataHelper.setIdToData(particularsOfClaimDocument)],
// },
// },
ClaimValue: {
claimValue: {
statementOfValueInPennies: `${CaseDataHelper.getClaimValue(claimTrack) * 100}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,18 @@ export default class CaseDetailsPage extends ExuiPage(BasePage) {

async retryChooseNextStep(ccdEvent: CCDEvent) {
console.log(`Starting event: ${ccdEvent.name}`);
await super.selectFromDropdown(ccdEvent.name, dropdowns.nextStep.selector);
await super.retryClickBySelector(
buttons.go.selector,
() =>
await super.retryAction(
async () => {
await this.selectFromDropdown(0, dropdowns.nextStep.selector);
await super.selectFromDropdown(ccdEvent.name, dropdowns.nextStep.selector);
await super.clickBySelector(buttons.go.selector);
},
async () =>
super.expectNoTab(tabs.summary.title, {
timeout: 15_000,
exact: true,
}),
`Starting event: ${ccdEvent.name} failed, trying again`,
{ retries: 3 },
);
}
Expand Down
5 changes: 4 additions & 1 deletion playwright-e2e/pages/exui/exui-page/exui-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export const components = {
selector: '.spinner-container',
},
error: {
selector: 'div.error-summary.ng-star-inserted',
selector: "div[aria-labelledby='edit-case-event_error-summary-heading']",
},
fieldError: {
selector: "div[data-module='govuk-error-summary']",
},
};

Expand Down
14 changes: 12 additions & 2 deletions playwright-e2e/pages/exui/exui-page/exui-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,33 @@ export default function ExuiPage<TBase extends abstract new (...args: any[]) =>
protected async clickSubmit() {
await super.clickBySelector(buttons.submit.selector);
await super.waitForSelectorToDetach(components.loading.selector);
await super.expectNoSelector(components.fieldError.selector, {
timeout: 300,
all: true,
message: 'Field Validation Error on UI',
});
}

protected async retryClickSubmit(expect?: () => Promise<void>) {
await super.retryClickBySelectorTimeout(
buttons.submit.selector,
async () => {
await super.waitForSelectorToDetach(components.loading.selector, {
timeout: 30_000,
timeout: 15_000,
});
await super.expectNoSelector(components.error.selector, {
timeout: 500,
all: true,
});
if (expect) await expect();
},
{ timeout: 45_000 },
{ timeout: 30_000 },
);
await super.expectNoSelector(components.fieldError.selector, {
timeout: 300,
all: true,
message: 'Field Validation Error on UI',
});
}

abstract submit(...args: any[]): Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ export default class RemoteHearingFragment extends ExuiPage(BasePage) {
async verifyContent() {
await super.runVerifications(
[
super.expectText(radioButtons.remoteHearing.label),
super.expectText(radioButtons.remoteHearing.hintText),
//super.expectText(radioButtons.remoteHearing.label, {index: 0}), TODO - This verification is not working for the 1v2DS scenario for the Second Defendant.
// super.expectText(radioButtons.remoteHearing.hintText, { index: 0 }),
//TODO - Seperate Code to be Implemented to check Yes and No Labels.
//super.expectText(radioButtons.remoteHearing.yes.label , {index: 0}),
//super.expectText(radioButtons.remoteHearing.no.label, {index: 0}),
],
{
runAxe: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class StatementOfTruthFragment extends ExuiPage(BasePage) {
async verifyContent() {
await super.runVerifications(
[
super.expectSubheading(subheadings.statementOfTruth),
//super.expectSubheading(subheadings.statementOfTruth), TODO - This Sub heading Does no Exist on the Page.
super.expectLabel(inputs.name.label),
super.expectLabel(inputs.role.label),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import MediationAvailabilityPage from '../mediation/mediation-availability/media
import WitnessesSpecPage from '../directions-questionaire/lr-spec/witnesses-spec/witnesses-spec-page';
import SolicitorReferencesDefendantResponsePage from './unspec/solicitor-references-defendant-response/solicitor-references-defendant-response-page';
import SolicitorReferenceFragment from '../../../fragments/solicitor-reference/solicitor-reference-fragment';
import WitnessesPage from '../directions-questionaire/common/witnesses/witnesses-page';
import DisclosureOfNonElectronicDocumentsPage from '../directions-questionaire/unspec/disclosure-of-non-electronic-documents/disclosure-of-non-electronic-documents-page';

export default class DefendantResponsePageFactory extends BasePageFactory {
get respondentChecklistPage() {
Expand Down Expand Up @@ -284,6 +286,14 @@ export default class DefendantResponsePageFactory extends BasePageFactory {
return new DisclosureOfNonElectronicDocumentsLRSpecPage(this.page, partys.DEFENDANT_2);
}

get disclosureOfNonElectronicDocumentsDefendant1Page() {
return new DisclosureOfNonElectronicDocumentsPage(this.page, partys.DEFENDANT_1);
}

get disclosureOfNonElectronicDocumentsDefendant2Page() {
return new DisclosureOfNonElectronicDocumentsPage(this.page, partys.DEFENDANT_2);
}

get disclosureReportDefendant1Page() {
return new DisclosureReportPage(this.page, partys.DEFENDANT_1);
}
Expand Down Expand Up @@ -332,7 +342,15 @@ export default class DefendantResponsePageFactory extends BasePageFactory {
return new WitnessesSpecPage(this.page, partys.DEFENDANT_2);
}

get languageSDefendant1Page() {
get witnessesDefendant1Page() {
return new WitnessesPage(this.page, partys.DEFENDANT_1);
}

get witnessesDefendant2Page() {
return new WitnessesPage(this.page, partys.DEFENDANT_2);
}

get languageDefendant1Page() {
return new LanguagePage(this.page, partys.DEFENDANT_1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const confirmationHeading = "You have submitted the Defendant's defence";
export const paragraphs = {
claimantsResponse: (claimantsResponseDate: string) =>
'The Claimant legal representative will get a notification to confirm you have provided the Defendant defence.' +
"You will be C'ed." +
" You will be CC'ed. " +
`The Claimant has until ${claimantsResponseDate} to discontinue or proceed with this claim`,
firstResponse1v2DS:
"Once the other defendant's legal representative has submitted their defence, we will send the claimant's legal representative a notification." +
'You will receive a copy of this notification, as it will include details of when the claimant must respond',
' You will receive a copy of this notification, as it will include details of when the claimant must respond.',
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export default class RespondentResponseType2v1Page extends ExuiPage(BasePage) {
async verifyContent(ccdCaseData: CCDCaseData) {
super.runVerifications([
super.verifyHeadings(ccdCaseData),
super.expectLabel(radioButtons.rejectAll.label, { count: 2 }),
super.expectLabel(radioButtons.admitAll.label, { count: 2 }),
super.expectLabel(radioButtons.partAdmit.label, { count: 2 }),
super.expectLabel(radioButtons.counterClaim.label, { count: 2 }),
super.expectLabel(radioButtons.rejectAll.label, { index: 0 }),
super.expectLabel(radioButtons.admitAll.label, { index: 0 }),
super.expectLabel(radioButtons.partAdmit.label, { index: 0 }),
super.expectLabel(radioButtons.counterClaim.label, { index: 0 }),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const radioButtons = {
`#respondent${defendantParty.number}ClaimResponseType${claimantParty.number === 2 ? 'ToApplicant2' : ''}-FULL_ADMISSION`,
},
partAdmit: {
label: 'Admit part of claim',
selector: (defendantParty: Party, claimantParty: Party) =>
`#respondent${defendantParty.number}ClaimResponseType${claimantParty.number === 2 ? 'ToApplicant2' : ''}-PART_ADMISSION`,
label: 'Admit part of the claim',
selector: (defendantParty: Party, isClaimant2 = false) =>
`#respondent${defendantParty.number}ClaimResponseType${isClaimant2 ? 'ToApplicant2' : ''}-PART_ADMISSION`,
},
counterClaim: {
label: 'Reject all of the claim and wants to counterclaim',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export default class RespondentResponseTypePage extends ExuiPage(BasePage) {
}

async verifyContent(ccdCaseData: CCDCaseData) {
super.runVerifications([
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
super.expectLabel(radioButtons.rejectAll.label),
super.expectLabel(radioButtons.admitAll.label),
super.expectLabel(radioButtons.partAdmit.label),
super.expectLabel(radioButtons.counterClaim.label),
super.expectLabel(radioButtons.rejectAll.label, { index: 0 }),
super.expectLabel(radioButtons.admitAll.label, { index: 0 }),
super.expectLabel(radioButtons.partAdmit.label, { index: 0 }),
super.expectLabel(radioButtons.counterClaim.label, { index: 0 }),
]);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
export const subheadings = {
fileRef: 'Your File Reference',
};

export const inputs = {
defendant1Ref: {
label: "Defendant's legal representative's reference (Optional)",
selector: '#solicitorReferences_respondentSolicitor1Reference',
},
defendant2Ref: {
label: "Defendant's legal representative's reference (Optional)",
selector: '#respondentSolicitor2Reference',
},
};
Loading
Loading