Handles modal popup on content page
Adds functionality to automatically close a modal popup that appears on the homepage, ensuring a smoother user experience.
This commit is contained in:
parent
b5102ce229
commit
8a0127156f
1 changed files with 8 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue