Update locator for welcome page

This commit is contained in:
JennyNou 2026-03-10 13:22:19 -04:00
parent 23e9777c18
commit 72e4269fd8

View file

@ -16,6 +16,7 @@ export class WelcomePage extends BasePage {
readonly city: Locator; readonly city: Locator;
readonly state: Locator; readonly state: Locator;
readonly cookieCloseButton: Locator; readonly cookieCloseButton: Locator;
readonly GetStartedButton: Locator;
url = process.env['BASE_URL']! + '/?issPage=welcome-page'; url = process.env['BASE_URL']! + '/?issPage=welcome-page';
issPageValue = 'welcome-page'; issPageValue = 'welcome-page';
@ -24,13 +25,14 @@ export class WelcomePage extends BasePage {
this.page = page; this.page = page;
this.policyNumber = page.getByRole('textbox', { name: 'Policy number' }); this.policyNumber = page.getByRole('textbox', { name: 'Policy number' });
this.policyZip = page.getByRole('textbox', { name: 'Policy ZIP' }); this.policyZip = page.getByRole('textbox', { name: 'Policy ZIP' });
this.damageDate = page.getByRole('textbox', { name: 'When did the damage occur?<' }); this.damageDate = page.locator('#dateOfLossField');
this.damageCause = page.locator('#damageCauseQuestionField'); this.damageCause = page.locator('#damageCauseQuestionField');
this.phoneNumber = page.getByRole('textbox', { name: 'Best number to reach you' }); this.phoneNumber = page.getByRole('textbox', { name: 'Best number to reach you' });
this.emailAddress = page.getByRole('textbox', { name: 'Email address' }); this.emailAddress = page.getByRole('textbox', { name: 'Email address' });
this.city = page.getByRole('textbox', { name: 'In which city did the damage' }); this.city = page.getByRole('textbox', { name: 'In which city did the damage' });
this.state = page.locator('select[name="\\38 fdf9dc2e13e430eb57529499dceb3eb"]'); this.state = page.locator('select[name="\\38 fdf9dc2e13e430eb57529499dceb3eb"]');
this.cookieCloseButton = page.getByRole('button', { name: 'Close' }); this.cookieCloseButton = page.getByRole('button', { name: 'Close' });
this.GetStartedButton = page.getByRole('button', { name: 'Get Started' });
} }
async goto(clientTag: string) { async goto(clientTag: string) {
@ -66,18 +68,17 @@ export class WelcomePage extends BasePage {
async populatePage(customerDetails: ICustomerDetails, claimDetails: IClaimDetails, isFillCityInfo: boolean) { async populatePage(customerDetails: ICustomerDetails, claimDetails: IClaimDetails, isFillCityInfo: boolean) {
await this.policyNumber.fill(claimDetails.policyNumber); await this.policyNumber.fill(claimDetails.policyNumber);
await this.policyZip.fill(customerDetails.address.postalCode); await this.phoneNumber.fill(customerDetails.phoneNumber);
await this.damageDate.click(); await this.damageDate.click();
await this.damageDate.fill(claimDetails.damageDate); await this.damageDate.fill(claimDetails.damageDate);
await this.damageCause.selectOption(claimDetails.damageCause); await this.damageCause.selectOption(claimDetails.damageCause);
await this.damageCause.press('Tab'); await this.damageCause.press('Tab');
await this.phoneNumber.fill(customerDetails.phoneNumber); await this.policyZip.fill(customerDetails.address.postalCode);
// Phone number fixed 12/5. Can't start with 1 or 0
await this.emailAddress.fill(customerDetails.email);
if (isFillCityInfo) { if (isFillCityInfo) {
await this.city.fill(customerDetails.address.city);
await this.state.selectOption(customerDetails.address.state); await this.state.selectOption(customerDetails.address.state);
await this.city.fill(customerDetails.address.city);
} }
} }
} }