-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DTSCCI-1423 Add address fragment (#5228)
* 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
1 parent
945acfd
commit 07f5e0b
Showing
7 changed files
with
107 additions
and
10 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
playwright-e2e/pages/exui/fragments/address/address-content.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
41
playwright-e2e/pages/exui/fragments/address/address-fragment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters