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-1703 Create Page Objects and Content for Defendant Response #5092

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9de04ae
DTSCCI-1703 Create Page Objects and Content for Defendant Response
tiagreaney Nov 21, 2024
3c472ef
pages
tiagreaney Nov 25, 2024
f12c62d
Merge branch 'master' into DTSCCI-1073
tiagreaney Nov 25, 2024
e6b1488
1v1 spec pages and page factory
tiagreaney Nov 28, 2024
08d7202
1v1 pages and content
tiagreaney Nov 28, 2024
aebe91d
1v1 spec until Add timeline of events
tiagreaney Dec 2, 2024
2276f60
1v1 spec until Add timeline of events
tiagreaney Dec 2, 2024
05e0420
Merge branch 'master' into DTSCCI-1073
tiagreaney Dec 2, 2024
ed537b5
1v1 spec full small track
tiagreaney Dec 3, 2024
14f58d5
1v1 spec full small track
tiagreaney Dec 3, 2024
13e0643
Merge remote-tracking branch 'origin/DTSCCI-1073' into DTSCCI-1073
tiagreaney Dec 3, 2024
35d3a77
undo createClaimSpec.js push
tiagreaney Dec 3, 2024
def5ccd
Merge branch 'master' into DTSCCI-1073
tiagreaney Dec 3, 2024
c86591f
1v1 spec fast track
tiagreaney Dec 3, 2024
8d0dcc6
1v2 SS spec fast track
tiagreaney Dec 4, 2024
03fdeff
1v2 SS spec small track
tiagreaney Dec 4, 2024
e77260a
1v2 DS spec small track
tiagreaney Dec 5, 2024
b5732fb
1v2 DS spec fast track
tiagreaney Dec 5, 2024
c07f3ad
1v2 DS spec fast track
tiagreaney Dec 6, 2024
d014574
Merge branch 'master' into DTSCCI-1073
tiagreaney Dec 6, 2024
6fd4028
2v1 spec fast track
tiagreaney Dec 6, 2024
4243e4f
2v1 spec small track
tiagreaney Dec 9, 2024
e7ad9f9
1v1 unspec fast track
tiagreaney Dec 11, 2024
d1f5352
Merge branch 'master' into DTSCCI-1073
tiagreaney Dec 11, 2024
d56ff6e
1v1 unspec small track
tiagreaney Dec 11, 2024
2bef053
1v2 DS unspec small track
tiagreaney Dec 11, 2024
83c7b88
1v2 DS unspec fast track
tiagreaney Dec 11, 2024
a6d6f34
1v2 ss unspec fast track
tiagreaney Dec 11, 2024
63766e5
1v2 ss unspec small track
tiagreaney Dec 11, 2024
9a76b59
2v1 unspec small track
tiagreaney Dec 11, 2024
1b4a1e8
2v1 unspec fast track
tiagreaney Dec 11, 2024
14e60ce
Merge branch 'master' into DTSCCI-1073
tiagreaney Dec 11, 2024
f90708e
fix build
tiagreaney Dec 11, 2024
7d9bd81
revert package.json
tiagreaney Dec 11, 2024
aa3aef2
Merge branch 'master' into DTSCCI-1073
tiagreaney Dec 12, 2024
99dede7
Add new buttons
tiagreaney Dec 13, 2024
2030a27
Merge remote-tracking branch 'origin/DTSCCI-1073' into DTSCCI-1073
tiagreaney Dec 13, 2024
3c0abe9
Merge branch 'master' into DTSCCI-1073
tiagreaney Dec 13, 2024
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
28 changes: 24 additions & 4 deletions playwright-e2e/base/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,31 @@ export default abstract class BasePage {
@TruthyParams(classKey, 'selector')
protected async clickBySelector(
selector: string,
options: { count?: number; timeout?: number } = {},
options: { count?: number; timeout?: number; ignoreDuplicates?: boolean } = {},
) {
await this.page
.locator(selector)
.click({ clickCount: options.count, timeout: options.timeout });
if (options.ignoreDuplicates && options.count !== undefined) {
throw new ExpectError("Cannot use 'ignoreDuplicates' and 'count' options at the same time");
}

// Locate the elements matching the selector
const locator = this.page.locator(selector);
const elementCount = await locator.count();

if (options.ignoreDuplicates) {
if (elementCount === 0) {
throw new ExpectError(`No elements found for selector: ${selector}`);
}
// Click the first visible element matching the selector
await locator.first().click({ timeout: options.timeout });
} else {
if (elementCount > 1) {
throw new ExpectError(
`Multiple elements (${elementCount}) found for selector: ${selector}. Consider using 'ignoreDuplicates' or refining the selector.`,
);
}

await locator.click({ clickCount: options.count, timeout: options.timeout });
}
}

@BoxedDetailedStep(classKey, 'name')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
export const heading = 'Respond to claim';

export const paragraphs = {
partyTypeText: 'Party type:',
nameText: 'Name:',
emailText: 'Email:',
phoneText: 'Phone:',
addressText: 'Address:',
};

export const radioButtons = {
text: {
label: 'Is this address correct?',
},
radioYes: {
text: 'Yes',
selector: '#specAoSApplicantCorrespondenceAddressRequired_Yes',
},
radioNo: {
text: 'No',
selector: '#specAoSApplicantCorrespondenceAddressRequired_No',
},
};

export const radioButtons2 = {
text: {
label: 'Is this address correct?',
},
radioYes: {
label: 'Yes',
selector: '#specAoSRespondent2CorrespondenceAddressRequired_Yes',
},
radioNo: {
label: 'No',
selector: '#specAoSRespondent2CorrespondenceAddressRequired_No',
},
};

export const radioButtons2FastTrack = {
text: {
label: 'Is this address correct?',
},
radioYes: {
label: 'Yes',
selector: '#specAoSRespondent2HomeAddressRequired_Yes',
},
radioNo: {
label: 'No',
selector: '#specAoSRespondent2HomeAddressRequired_No',
},
};

export const dob = {
day: {
label: 'Day',
selector: '#individualDateOfBirth-day',
},
month: {
label: 'Month',
selector: '#individualDateOfBirth-month',
},
year: {
label: 'Year',
selector: '#individualDateOfBirth-year',
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import BasePage from '../../../../../base/base-page.ts';
import { AllMethodsStep } from '../../../../../decorators/test-steps.ts';
import ExuiPage from '../../../exui-page/exui-page.ts';
import {
dob,
heading,
paragraphs,
radioButtons,
radioButtons2,
radioButtons2FastTrack,
} from './confirm-name-and-address-content.ts';
import CCDCaseData from '../../../../../models/ccd/ccd-case-data.ts';

@AllMethodsStep()
export default class ConfirmNameAndAddressPage extends ExuiPage(BasePage) {
async verifyContent(ccdCaseData: CCDCaseData) {
await super.runVerifications([super.verifyHeadings(ccdCaseData), super.expectHeading(heading)]);
}

async verifyContent1v1(ccdCaseData: CCDCaseData) {
super.expectText(radioButtons.text.label, { ignoreDuplicates: true }),
super.expectText(radioButtons.radioYes.text, { ignoreDuplicates: true }),
super.expectText(radioButtons.radioNo.text, { ignoreDuplicates: true }),
super.expectText(paragraphs.partyTypeText, {
containerSelector: '#specAoSRespondentInformation',
}),
super.expectText(paragraphs.nameText, {
containerSelector: '#specAoSRespondentInformation',
}),
super.expectText(paragraphs.emailText, {
containerSelector: '#specAoSRespondentInformation',
}),
super.expectText(paragraphs.phoneText, {
containerSelector: '#specAoSRespondentInformation',
}),
super.expectText(paragraphs.addressText, {
containerSelector: '#specAoSRespondentInformation',
});
}

async selectYesDefendant1() {
await super.clickBySelector(radioButtons.radioYes.selector);
}

async selectNoDefendant1() {
await super.clickBySelector(radioButtons.radioNo.selector);
}

async selectYesDefendant2() {
await super.clickBySelector(radioButtons2.radioYes.selector);
}

async selectNoDefendant2() {
await super.clickBySelector(radioButtons2.radioNo.selector);
}

async selectYesDefendant2FastTrack() {
await super.clickBySelector(radioButtons2FastTrack.radioYes.selector);
}

async selectNoDefendant2FastTrack() {
await super.clickBySelector(radioButtons2FastTrack.radioNo.selector);
}

async enterDob(day: number, month: number, year: number) {
await super.inputText(day, dob.day.selector);
await super.inputText(month, dob.month.selector);
await super.inputText(year, dob.year.selector);
}

async submit() {
await super.retryClickSubmit();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
export const courtLocationDropdown = {
label: 'Please select your preferred court hearing location',
dropdown: {
text: '--Select a value--',
selector: '#respondToCourtLocation_responseCourtLocations',
options: [
'Aberystwyth Justice Centre - Y Lanfa, Trefechan, Aberystwyth - SY23 1AS',
'Aldershot Magistrates Court - 2 Wellington Avenue, Aldershot - GU11 1NY',
],
},
};

export const courtLocationDropdown1v2 = {
label: 'Please select your preferred court hearing location',
dropdown: {
text: '--Select a value--',
selector: '#respondToCourtLocation2_responseCourtLocations',
options: [
'Aberystwyth Justice Centre - Y Lanfa, Trefechan, Aberystwyth - SY23 1AS',
'Aldershot Magistrates Court - 2 Wellington Avenue, Aldershot - GU11 1NY',
],
},
};

export const courtLocationDropdownUnspecAndSpec2v1 = (defendantNumber: number) => ({
label: 'Please select your preferred court hearing location',
dropdown: {
text: '--Select a value--',
selector: `#respondent${defendantNumber}DQRequestedCourt_responseCourtLocations`,
options: [
'Aberystwyth Justice Centre - Y Lanfa, Trefechan, Aberystwyth - SY23 1AS',
'Aldershot Magistrates Court - 2 Wellington Avenue, Aldershot - GU11 1NY',
],
},
});

export const reasonForm = {
heading: 'Briefly explain your reasons (Optional)',
selector: '#respondToCourtLocation_reasonForHearingAtSpecificCourt',
};

export const subHeading1v1 = 'Remote hearing';
export const subHeadingMultiDefendant = 'Remote Hearing';

export const remoteHearingRadioButtons = (defendantNumber: number) => ({
text: {
label: 'Do you want the hearing to be held remotely?',
hint: 'This will be over telephone or video',
},
radioYes: {
label: 'Yes',
selector: `#respondent${defendantNumber}DQRemoteHearingLRspec_remoteHearingRequested_Yes`,
},
radioNo: {
label: 'No',
selector: `#respondent${defendantNumber}DQRemoteHearingLRspec_remoteHearingRequested_No`,
},
});

export const remoteHearingRadioButtonsUnspecAndSpec2v1 = (defendantNumber: number) => ({
text: {
label: 'Do you want the hearing to be held remotely?',
hint: 'This will be over telephone or video',
},
radioYes: {
label: 'Yes',
selector: `#respondent${defendantNumber}DQRemoteHearing_remoteHearingRequested_Yes`,
},
radioNo: {
label: 'No',
selector: `#respondent${defendantNumber}DQRemoteHearing_remoteHearingRequested_No`,
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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 {
subHeading1v1,
subHeadingMultiDefendant,
courtLocationDropdown,
reasonForm,
remoteHearingRadioButtons,
courtLocationDropdown1v2,
courtLocationDropdownUnspecAndSpec2v1,
remoteHearingRadioButtonsUnspecAndSpec2v1,
} from './court-location-content.ts';

@AllMethodsStep()
export default class CourtLocationPage extends ExuiPage(BasePage) {
async verifyContent(ccdCaseData: CCDCaseData) {
await super.runVerifications([super.verifyHeadings(ccdCaseData)]);
}

async verifyContent1v1() {
super.expectSubheading(subHeading1v1),
super.expectText(remoteHearingRadioButtons(1).radioYes.label, { ignoreDuplicates: true }),
super.expectText(remoteHearingRadioButtons(1).radioNo.label, { ignoreDuplicates: true });
}

async verifyContentMultiDefendant(defendantNumber: number) {
super.expectSubheading(subHeadingMultiDefendant),
super.expectText(remoteHearingRadioButtons(defendantNumber).radioYes.label, {
ignoreDuplicates: true,
}),
super.expectText(remoteHearingRadioButtons(defendantNumber).radioNo.label, {
ignoreDuplicates: true,
});
}

async selectCourtLocation() {
await super.selectFromDropdown(
courtLocationDropdown.dropdown.options[0],
courtLocationDropdown.dropdown.selector,
);
}

async selectCourtLocation1v2() {
await super.selectFromDropdown(
courtLocationDropdown1v2.dropdown.options[0],
courtLocationDropdown1v2.dropdown.selector,
);
}

async selectCourtLocationUnpecAndSpec2v1(defendantNumber: number) {
await super.selectFromDropdown(
courtLocationDropdownUnspecAndSpec2v1(defendantNumber).dropdown.options[0],
courtLocationDropdownUnspecAndSpec2v1(defendantNumber).dropdown.selector,
);
}

async selectYes(defendantNumber: number) {
await super.clickBySelector(remoteHearingRadioButtons(defendantNumber).radioYes.selector);
}

async selectNo(defendantNumber: number) {
await super.clickBySelector(remoteHearingRadioButtons(defendantNumber).radioNo.selector);
}

async selectYesUnspecAndSpec2v1(defendantNumber: number) {
await super.clickBySelector(
remoteHearingRadioButtonsUnspecAndSpec2v1(defendantNumber).radioYes.selector,
);
}

async selectNoUnspecAndSpec2v1(defendantNumber: number) {
await super.clickBySelector(
remoteHearingRadioButtonsUnspecAndSpec2v1(defendantNumber).radioNo.selector,
);
}

async submit() {
await super.retryClickSubmit();
}
}
Loading
Loading