From 8a0127156f07868e0e547d7ed8cdb14389af922f Mon Sep 17 00:00:00 2001 From: maguire-arman Date: Tue, 8 Apr 2025 11:18:14 -0400 Subject: [PATCH] Handles modal popup on content page Adds functionality to automatically close a modal popup that appears on the homepage, ensuring a smoother user experience. --- playwright-tests/pages/HomePage.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playwright-tests/pages/HomePage.ts b/playwright-tests/pages/HomePage.ts index 1b9a63301..1b681f0e3 100644 --- a/playwright-tests/pages/HomePage.ts +++ b/playwright-tests/pages/HomePage.ts @@ -5,6 +5,8 @@ export class HomePage extends BasePage { readonly page: Page; readonly letsGetStartedButton: Locator; + readonly cusmodalPopup: Locator; + readonly closePopupButton: Locator; //Quick Quote (LeadGen) Form readonly yearDropdown: Locator; @@ -29,6 +31,8 @@ export class HomePage extends BasePage { this.page = page; this.letsGetStartedButton = this.page.locator('a.btn.btn-primary.ghost'); + this.cusmodalPopup = this.page.locator('#Cusmodalpopup'); + this.closePopupButton = this.page.getByRole('button', { name: '×' }); //Quick Quote (LeadGen) Form this.yearDropdown = this.page.locator('#year'); @@ -63,6 +67,10 @@ export class HomePage extends BasePage { element.setAttribute('href', `${currentHref}&zipCode=${zip}`); }, zip); } + + if (await this.cusmodalPopup.isVisible()) { + await this.closePopupButton.click(); + } await this.letsGetStartedButton.click(); }