Add and fix validation for TPA flow

This commit is contained in:
JennyNou 2026-03-20 10:32:40 -04:00
parent e25466cd07
commit e537e41c98
3 changed files with 43 additions and 16 deletions

View file

@ -4,16 +4,30 @@ import { BasePage } from './BasePage';
export class TpaConfirmationPage extends BasePage {
readonly page: Page;
readonly successMessage: Locator;
readonly shopConfirmationMessage: Locator;
readonly issPageValue = 'tpa-confirmation';
constructor(page: Page) {
super(page);
this.page = page;
this.successMessage = page.getByText('Success');
this.successMessage = page.getByText('Thank you for submitting your claim; there is one final step.');
this.shopConfirmationMessage = page.locator('div.subheader').first()
}
async getTpaShopSelectedName() {
const sessionStorage = JSON.parse(await this.page.evaluate('sessionStorage.getItem(\'submittedOrder\')'));
const tpaShopSelectedName = sessionStorage.serviceLocation.provider.companyName;
return tpaShopSelectedName;
}
async validateSuccessMessage() {
await expect(this.successMessage).toBeVisible();
}
const shopConfirmationMessageText = await this.shopConfirmationMessage.textContent();
const tpaShopSelectedNameText = await this.getTpaShopSelectedName();
await this.successMessage.waitFor({ state: 'visible' });
await expect(this.successMessage).toBeVisible();
expect.soft(shopConfirmationMessageText?.toLowerCase()).toContain(
('Your information has been sent to' + ' ' + tpaShopSelectedNameText).toLowerCase()
);
}
}

View file

@ -4,22 +4,15 @@ import { BasePage } from './BasePage';
export class TpaSearchPage extends BasePage {
readonly page: Page;
readonly firstLocationButton: Locator;
readonly doNotSeeMyShopButton: Locator;
//readonly doNotSeeMyShopButton: Locator;
issPageValue = 'tpa-search';
constructor(page: Page) {
super(page);
this.page = page;
// this.firstLocationButton = page.locator("fieldset[aria-labelledby='chooseShop']/span").first();
this.firstLocationButton = page.locator("#buttonLabelSpan").first();
this.doNotSeeMyShopButton = page.getByRole('link', { name: 'I don\'t see my shop' });
this.firstLocationButton = page.locator('div.button-content').first();
}
async selectDoNotSeeMyShop() {
await this.doNotSeeMyShopButton.click()
}
async selectFirstLocation() {
await this.firstLocationButton.click();
}

View file

@ -1,18 +1,38 @@
import { expect, type Locator, type Page } from '@playwright/test';
import { BasePage } from './BasePage';
import { IClaimDetails } from '@business-logic/types/CustomerDetails';
export class TpaSubmitPage extends BasePage {
readonly page: Page;
readonly deductible: Locator;
readonly recalAlert: Locator;
readonly learnMoreLink: Locator;
readonly recalModal: Locator;
readonly closeRecalModalButton: Locator;
issPageValue = 'tpa-submit';
constructor(page: Page) {
super(page);
this.page = page;
this.deductible = page.getByText('Deductible $');
this.recalAlert = page.getByRole('alert').filter({ hasText: 'Some vehicle safety features may not work properly.'});
this.learnMoreLink = page.getByRole('link', { name: 'Learn more' });
this.recalModal = page.getByRole('dialog').filter({ hasText: 'IMPORTANT SERVICE REQUIRED' }).first();
this.closeRecalModalButton = page.locator('.modalbtn', { hasText: 'Close' });
this.deductible = page.locator('span#deductible-value, span.deductible-value');
}
async validateDeductible(expDeductible) {
await expect(this.deductible).toContainText(expDeductible);
/* TODO: Fix flakiness of recal alert
/*async validateRecalAlert() {
await this.recalAlert.waitFor({ state: 'visible', timeout: 5000 });
await this.learnMoreLink.click();
await this.recalModal.waitFor({ state: 'visible', timeout: 5000 });
await this.recalModal.getByRole('button', { name: 'Close' }).click();
}*/
async validateDeductible(claimDetails: IClaimDetails) {
await expect(this.deductible).toContainText(claimDetails.policyDeductible.toLocaleString());
}
// TODO: Validate change preferred shop and contact details flows
}