Clean up locators and validation

This commit is contained in:
JennyNou 2026-03-19 10:53:31 -04:00
parent 4525ce95ce
commit bd11b53413

View file

@ -8,10 +8,12 @@ export class ProviderPreferencePage extends BasePage {
readonly acknowledgeAdasCheckbox: Locator; readonly acknowledgeAdasCheckbox: Locator;
readonly gotItButton: Locator; readonly gotItButton: Locator;
readonly tpaRecalModal: Locator;
readonly learnMoreLink: Locator; readonly learnMoreLink: Locator;
readonly yesButton: Locator; readonly yesButton: Locator;
readonly noButton: Locator; readonly noButton: Locator;
readonly acknowledgeCheckbox: Locator; readonly acknowledgeCheckbox: Locator;
readonly tpaRecalModalContinueButton: Locator;
readonly stateLawModalText: Locator; readonly stateLawModalText: Locator;
readonly stateLawModalOkayButton: Locator; readonly stateLawModalOkayButton: Locator;
issPageValue = 'provider-preference'; issPageValue = 'provider-preference';
@ -24,14 +26,14 @@ export class ProviderPreferencePage extends BasePage {
this.findAnotherShopButton = this.page.getByRole('link', { name: 'Find another shop' }); this.findAnotherShopButton = this.page.getByRole('link', { name: 'Find another shop' });
//Recal modal //Recal modal
this.tpaRecalModal = this.page.locator('#TPARecalModal');
this.learnMoreLink = this.page.locator('#moreDetails'); this.learnMoreLink = this.page.locator('#moreDetails');
this.yesButton = this.page.getByRole('button', { name: 'Yes' }); // schedule with Safelite this.yesButton = this.page.getByText('Yes', { exact: true }); // schedule with Safelite
this.noButton = this.page.getByRole('button', { name: 'No' }); // find another shop (TPA?) this.noButton = this.page.getByText('No', { exact: true }); // schedule with TPA
this.acknowledgeAdasCheckbox = this.page.getByRole('checkbox', { name: 'tpaAcknowledgement' }); // shows up when user clicks no on recal modal this.acknowledgeAdasCheckbox = this.page.getByRole('checkbox', { name: /I acknowledge/i })
this.tpaRecalModalContinueButton = this.page.locator('#modalbtn', { hasText: 'Continue' });
// State law modal
this.gotItButton = this.page.getByRole('button', { name: 'Got it' });
this.acknowledgeCheckbox = this.page.locator('#tpaAcknowledgement');
this.stateLawModalText = this.page.getByText(/law prohibits us from requiring you.*You have the right to select the motor vehicle repair shop of your choice\./is); this.stateLawModalText = this.page.getByText(/law prohibits us from requiring you.*You have the right to select the motor vehicle repair shop of your choice\./is);
this.stateLawModalOkayButton = this.page.getByRole('button', { name: 'Okay' }) this.stateLawModalOkayButton = this.page.getByRole('button', { name: 'Okay' })
} }
@ -44,25 +46,22 @@ export class ProviderPreferencePage extends BasePage {
else { else {
await this.findAnotherShopButton.waitFor({ state: 'visible' }); await this.findAnotherShopButton.waitFor({ state: 'visible' });
await this.findAnotherShopButton.click(); await this.findAnotherShopButton.click();
await this.continueButton.click(); await this.tpaRecalModal.waitFor({ state: 'visible' });
//if(await this.acknowledgeAdasButton.isEnabled({timeout: 2500})){ await this.scheduleTPAWithAdas();
// await this.acknowledgeAdasButton.click();
// await this.gotItButton.click();
// await this.page.waitForTimeout(1000);
//}
} }
} }
async scheduleWithSafeliteADAS() { async scheduleWithSafeliteADAS() {
await this.learnMoreLink.click(); await this.learnMoreLink.click();
await this.yesButton.click(); await this.yesButton.click();
await this.continueButton.click(); await this.tpaRecalModalContinueButton.click();
} }
async scheduleTPAWithAdas() { async scheduleTPAWithAdas() {
await this.learnMoreLink.click(); await this.learnMoreLink.click();
await this.noButton.click(); await this.noButton.click();
await this.acknowledgeAdasCheckbox.click(); await this.acknowledgeAdasCheckbox.click();
await this.continueButton.click(); await this.tpaRecalModalContinueButton.click();
} }
async validateStateLawModalIsVisible() { async validateStateLawModalIsVisible() {