diff --git a/playwright-tests/pages/forms/AddressForm.ts b/playwright-tests/pages/forms/AddressForm.ts index 7080fea48..892a56c9b 100644 --- a/playwright-tests/pages/forms/AddressForm.ts +++ b/playwright-tests/pages/forms/AddressForm.ts @@ -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);