71 lines
No EOL
2.8 KiB
TypeScript
71 lines
No EOL
2.8 KiB
TypeScript
import test, { expect, type Locator, type Page } from '@playwright/test';
|
|
import { BasePage } from './BasePage';
|
|
|
|
export class ProviderPreferencePage extends BasePage {
|
|
readonly page: Page;
|
|
readonly scheduleNowButton: Locator;
|
|
readonly findAnotherShopButton: Locator;
|
|
|
|
readonly acknowledgeAdasCheckbox: Locator;
|
|
readonly gotItButton: Locator;
|
|
readonly learnMoreLink: Locator;
|
|
readonly yesButton: Locator;
|
|
readonly noButton: Locator;
|
|
readonly acknowledgeCheckbox: Locator;
|
|
readonly stateLawModalText: Locator;
|
|
readonly stateLawModalOkayButton: Locator;
|
|
issPageValue = 'provider-preference';
|
|
|
|
constructor(page: Page) {
|
|
super(page);
|
|
this.page = page;
|
|
|
|
this.scheduleNowButton = this.page.getByRole('button', { name: 'Schedule now' });
|
|
this.findAnotherShopButton = this.page.getByRole('link', { name: 'Find another shop' });
|
|
|
|
//Recal modal
|
|
this.learnMoreLink = this.page.locator('#moreDetails');
|
|
this.yesButton = this.page.getByRole('button', { name: 'Yes' }); // schedule with Safelite
|
|
this.noButton = this.page.getByRole('button', { name: 'No' }); // find another shop (TPA?)
|
|
this.acknowledgeAdasCheckbox = this.page.getByRole('checkbox', { name: 'tpaAcknowledgement' }); // shows up when user clicks no on recal 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.stateLawModalOkayButton = this.page.getByRole('button', { name: 'Okay' })
|
|
}
|
|
|
|
async selectProvider(isSafelite = true) {
|
|
if (isSafelite) {
|
|
await this.scheduleNowButton.click();
|
|
await this.nextPage();
|
|
}
|
|
else {
|
|
await this.findAnotherShopButton.waitFor({ state: 'visible' });
|
|
await this.findAnotherShopButton.click();
|
|
await this.continueButton.click();
|
|
//if(await this.acknowledgeAdasButton.isEnabled({timeout: 2500})){
|
|
// await this.acknowledgeAdasButton.click();
|
|
// await this.gotItButton.click();
|
|
// await this.page.waitForTimeout(1000);
|
|
//}
|
|
}
|
|
}
|
|
async scheduleWithSafeliteADAS() {
|
|
await this.learnMoreLink.click();
|
|
await this.yesButton.click();
|
|
await this.continueButton.click();
|
|
}
|
|
|
|
async scheduleTPAWithAdas() {
|
|
await this.learnMoreLink.click();
|
|
await this.noButton.click();
|
|
await this.acknowledgeAdasCheckbox.click();
|
|
await this.continueButton.click();
|
|
}
|
|
|
|
async validateStateLawModalIsVisible() {
|
|
await expect.soft(this.stateLawModalText).toBeVisible();
|
|
}
|
|
} |