Improves handling of repeated clicks modal

Updates the selector for the repeated clicks modal close button to be more specific, and adds a short wait after closing the modal before proceeding.  This improves reliability when the modal appears and interferes with subsequent actions.
Removes redundant check for modal visibility in the service location page as it is handled on the service packages page.
This commit is contained in:
maguire-arman 2025-04-10 13:37:41 -04:00
parent d443672745
commit d26885d0f0
2 changed files with 2 additions and 4 deletions

View file

@ -114,9 +114,6 @@ export class ServiceLocationPage extends BasePage {
await this.mobileButton.click();
await this.enterServiceAddressButton.click();
await this.addressForm.populateAddress({ address: appointmentDetails.serviceAddress! });
if (await this.repeatedClicksModalCloseButton.isVisible()) {
await this.repeatedClicksModalCloseButton.click();
}
if (faker.datatype.boolean()) {
await this.vehicleProtectedYesButton.check();
} else {

View file

@ -41,7 +41,7 @@ export class ServicePackagesPage extends BasePage {
this.closeButton = this.page. getByRole('dialog').locator('button').filter({ hasText: 'Close' });
this.promoCodeTextbox = this.page.getByLabel('Enter a promo code');
this.applyPromoButton = this.page.getByRole('button', { name: 'Apply promo code' });
this.repeatedClicksModalCloseButton = this.page.getByRole('img').nth(1);
this.repeatedClicksModalCloseButton = this.page.locator('#app').getByRole('dialog').locator('button').filter({ hasText: 'Close' });
// this.validateURL(this.url);
}
@ -76,6 +76,7 @@ export class ServicePackagesPage extends BasePage {
if (await this.repeatedClicksModalCloseButton.isVisible()) {
await this.repeatedClicksModalCloseButton.click();
}
await this.page.waitForTimeout(3000);
await this.closeButton.click();
} else {