Skip to content

Commit

Permalink
DTSCCI-1423 Add address fragment (#5228)
Browse files Browse the repository at this point in the history
* add address fragment

* replace string with Party enum

* update address fragment

* Fixed syntax issues

---------

Co-authored-by: kdaHMCTS <[email protected]>
Co-authored-by: kdaHMCTS <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2025
1 parent 945acfd commit 07f5e0b
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 10 deletions.
56 changes: 56 additions & 0 deletions playwright-e2e/pages/exui/fragments/address/address-content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Party from '../../../../enums/party';

export const getInputs = (party: Party) => ({
postCodeInput: {
label: 'Enter a UK postcode',
selector: `#${party}_primaryaddress_primaryaddress_postcodeInput`,
},
addressLine1: {
label: 'Building and Street',
selector: `#${party}_primaryaddress__addressLine1`,
},
addressLine2: {
label: 'address Line 2 (Optional)',
selector: `#${party}_primaryaddress__addressLine2`,
},
addressLine3: {
label: 'address Line 3 (Optional)',
selector: `#${party}_primaryaddress__addressLine3`,
},
postTown: {
label: 'Town or City (Optional)',
selector: `#${party}_primaryaddress__PostTown`,
},
county: {
label: 'County (Optional)',
selector: `#${party}_primaryaddress__County`,
},
country: {
label: 'Country (Optional)',
selector: `#${party}_primaryaddress__Country`,
},
postCode: {
label: 'Postcode/Zipcode',
selector: `#${party}_primaryaddress__PostCode`,
},
});

export const getDropdowns = (party: Party) => ({
addressList: {
label: 'Select an address',
selector: `#${party}_primaryaddress_primaryaddress_addressList`,
options: [],
},
});

export const buttons = {
findaddress: {
title: 'Find address',
},
};

export const links = {
cannotFindAddress: {
title: " I can't enter a UK postcode ",
},
};
41 changes: 41 additions & 0 deletions playwright-e2e/pages/exui/fragments/address/address-fragment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Page } from 'playwright-core';
import BasePage from '../../../../base/base-page';
import { AllMethodsStep } from '../../../../decorators/test-steps';
import ExuiPage from '../../exui-page/exui-page';
import { buttons, getInputs, links } from './address-content';
import Party from '../../../../enums/party';

@AllMethodsStep()
export default class AddressFragment extends ExuiPage(BasePage) {
private party: Party;

constructor(page: Page, party: Party) {
super(page);
this.party = party;
}

async verifyContent() {
await super.runVerifications([super.expectLabel(getInputs(this.party).postCodeInput.label)]);
}

async enterAddressManual(postCode?: string) {
await super.clickLink(links.cannotFindAddress.title);
await super.inputText(`${this.party} Building`, getInputs(this.party).addressLine1.selector);
await super.inputText(`${this.party} Flat`, getInputs(this.party).addressLine2.selector);
await super.inputText(`${this.party} Street`, getInputs(this.party).addressLine3.selector);
await super.inputText(`${this.party} City`, getInputs(this.party).postTown.selector);
await super.inputText(`${this.party} County`, getInputs(this.party).county.selector);
await super.inputText(`${this.party} Country`, getInputs(this.party).country.selector);
await super.inputText(postCode ?? `E10 5DN`, getInputs(this.party).postCode.selector);
}

async findAddress(postcode: string, index: number) {
await super.inputText(postcode, getInputs(this.party).postCodeInput.selector);
await super.clickButtonByName(buttons.findaddress.title);
//method incomplete, need to add method in basePage for waiting for dropdown to appear.
}

async submit() {
throw new Error('Method not implemented.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export default class NotifyClaimCOSDefendant1Page extends ExuiPage(BasePage) {
async verifyContent(ccdCaseData: CCDCaseData) {
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
this.certificateOfServiceFragment.verifyDefendant1Content(),
this.certificateOfServiceFragment.verifyContent(),
]);
}

async fillDetails() {
await this.certificateOfServiceFragment.fillDefendant1CertificateOfService();
await this.certificateOfServiceFragment.fillDefendant1StatementOfTruth();
await this.certificateOfServiceFragment.fillCertificateOfService();
await this.certificateOfServiceFragment.fillStatementOfTruth();
}

async submit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export default class NotifyClaimCOSDefendant2Page extends ExuiPage(BasePage) {
async verifyContent(ccdCaseData: CCDCaseData) {
await super.runVerifications([
super.verifyHeadings(ccdCaseData),
this.certificateOfServiceFragment.verifyDefendant2Content(),
this.certificateOfServiceFragment.verifyContent(),
]);
}

async fillDetails() {
await this.certificateOfServiceFragment.fillDefendant2CertificateOfService();
await this.certificateOfServiceFragment.fillDefendant2StatementOfTruth();
await this.certificateOfServiceFragment.fillCertificateOfService();
await this.certificateOfServiceFragment.fillStatementOfTruth();
}

async submit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export default class NotifyClaimPageFactory extends BasePageFactory {
}

get notifyClaimCOSDefendant1Page() {
const certificateOfServiceFragment = new CertificateOfServiceFragment(this.page);
const certificateOfServiceFragment = new CertificateOfServiceFragment(this.page, 1);
return new NotifyClaimCOSDefendant1Page(certificateOfServiceFragment, this.page);
}

get notifyClaimCOSDefendant2Page() {
const certificateOfServiceFragment = new CertificateOfServiceFragment(this.page);
const certificateOfServiceFragment = new CertificateOfServiceFragment(this.page, 2);
return new NotifyClaimCOSDefendant2Page(certificateOfServiceFragment, this.page);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BaseSteps from '../../../../../base/base-steps';
import { AllMethodsStep } from '../../../../../decorators/test-steps';
import TestData from '../../../../../models/test-data';
import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory';
import ClaimantResponsePageFactory from '../../../../../pages/exui/solicitor-events/claimant-response/claimant-response-page-factory';
import ClaimantResponsePageFactory from '../../../../../pages/exui/solicitor-events/response/claimant-response/claimant-response-page-factory';
import RequestsFactory from '../../../../../requests/requests-factory';

@AllMethodsStep()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BaseSteps from '../../../../../base/base-steps';
import { AllMethodsStep } from '../../../../../decorators/test-steps';
import TestData from '../../../../../models/test-data';
import ExuiDashboardPageFactory from '../../../../../pages/exui/exui-dashboard/exui-dashboard-page-factory';
import ClaimantResponsePageFactory from '../../../../../pages/exui/solicitor-events/claimant-response/claimant-response-page-factory';
import ClaimantResponsePageFactory from '../../../../../pages/exui/solicitor-events/response/claimant-response/claimant-response-page-factory';
import RequestsFactory from '../../../../../requests/requests-factory';

@AllMethodsStep()
Expand Down

0 comments on commit 07f5e0b

Please sign in to comment.