Rename locator for readability

This commit is contained in:
JennyNou 2026-03-18 14:38:29 -04:00
parent 0a9e7c789c
commit 48ad72d996

View file

@ -21,7 +21,7 @@ export class HomePage extends BasePage {
readonly viewQuoteButton: Locator; readonly viewQuoteButton: Locator;
//Zip Entry //Zip Entry
readonly zipEntryLetsGetStartedButton: Locator; readonly widgetZipEntryField: Locator;
readonly getQuoteAndScheduleButton: Locator; readonly getQuoteAndScheduleButton: Locator;
url = process.env['BASE_URL']!; url = process.env['BASE_URL']!;
@ -46,7 +46,7 @@ export class HomePage extends BasePage {
this.viewQuoteButton = this.page.locator('#ctaSubmit'); this.viewQuoteButton = this.page.locator('#ctaSubmit');
//Zip Entry //Zip Entry
this.zipEntryLetsGetStartedButton = this.page.getByRole('textbox', { name: 'Enter service ZIP code' }); this.widgetZipEntryField = this.page.getByRole('textbox', { name: 'Enter service ZIP code' });
this.getQuoteAndScheduleButton = this.page.getByLabel('main').getByRole('link', { name: 'Get quote + schedule' }); this.getQuoteAndScheduleButton = this.page.getByLabel('main').getByRole('link', { name: 'Get quote + schedule' });
} }
@ -61,7 +61,7 @@ export class HomePage extends BasePage {
async letsGetStarted(zip: string, enterFunnelWithZip: boolean) { async letsGetStarted(zip: string, enterFunnelWithZip: boolean) {
if (enterFunnelWithZip) { if (enterFunnelWithZip) {
await this.zipEntryLetsGetStartedButton.fill(zip); await this.widgetZipEntryField.fill(zip);
/* await this.letsGetStartedButton.evaluate((element, zip) => { /* await this.letsGetStartedButton.evaluate((element, zip) => {
const currentHref = element.getAttribute('href') || ''; const currentHref = element.getAttribute('href') || '';
element.setAttribute('href', `${currentHref}?zipCode=${zip}`); element.setAttribute('href', `${currentHref}?zipCode=${zip}`);