adding a change to handle addresslookup page

This commit is contained in:
kpatel8hs4io 2025-06-03 11:00:51 -04:00
parent 8ff1615ce1
commit b10ec1f608

View file

@ -43,9 +43,8 @@ export class AddressForm extends BasePage {
// await this.forceAddressFormToAppear();
await this.streetAddressTextBox.click();
await this.streetAddressTextBox.pressSequentially(`${customerDetails.address.street}, ${customerDetails.address.city}, ${customerDetails.address.state} ${customerDetails.address.postalCode}`).then( async() => {
await new Promise(resolve => setTimeout(resolve, 1000));
await this.streetAddressTextBox.dispatchEvent('keydown', { key: 'ArrowDown' });
await this.streetAddressTextBox.dispatchEvent('keyup', { key: 'ArrowDown' });
await this.streetAddressTextBox.dispatchEvent('keydown', { key: 'ArrowLeft' } );
await this.streetAddressTextBox.dispatchEvent('keyup', { key: 'ArrowLeft' });
});
await waitUntil(async () => {
@ -57,10 +56,20 @@ export class AddressForm extends BasePage {
text.includes(customerDetails.address!.state)
);
});
await this.addressSuggestionList.dispatchEvent('mouseover');
await this.addressSuggestionList.click();
await this.page.hover(".pac-container .pac-item");
await new Promise(resolve => setTimeout(resolve, 1000));
await this.addressSuggestionList.click(); // Select the first suggestion
//await this.streetAddressTextBox.press('Tab'); // Move focus to ZIP code field
// Fill address
await this.stateDrpDwn.waitFor({ state: 'visible', timeout: 5000 }).then(async () => {
const selectedState = await this.stateDrpDwn.inputValue();
if (selectedState !== customerDetails.address!.state) {
await this.stateDrpDwn.selectOption(customerDetails.address!.state);
}
})
await this.fillAndValidate(this.streetAddressTextBox, customerDetails.address.street);
await this.fillAndValidate(this.zipCodeTextBox, customerDetails.address.postalCode)
await this.fillAndValidate(this.cityTextBox, customerDetails.address.city);