From d26885d0f0d344a861c52b9bbd82a264e0c28b0f Mon Sep 17 00:00:00 2001 From: maguire-arman Date: Thu, 10 Apr 2025 13:37:41 -0400 Subject: [PATCH] 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. --- playwright-tests/pages/ServiceLocationPage.ts | 3 --- playwright-tests/pages/ServicePackagesPage.ts | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/playwright-tests/pages/ServiceLocationPage.ts b/playwright-tests/pages/ServiceLocationPage.ts index b8c8649b6..c9cb6c98f 100644 --- a/playwright-tests/pages/ServiceLocationPage.ts +++ b/playwright-tests/pages/ServiceLocationPage.ts @@ -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 { diff --git a/playwright-tests/pages/ServicePackagesPage.ts b/playwright-tests/pages/ServicePackagesPage.ts index 9a3b87ae3..8b1597598 100644 --- a/playwright-tests/pages/ServicePackagesPage.ts +++ b/playwright-tests/pages/ServicePackagesPage.ts @@ -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 {