DigitalConsumer.ISS/playwright-tests/pages/TpaSubmitPage.ts
2026-03-20 10:32:40 -04:00

38 lines
No EOL
1.6 KiB
TypeScript

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.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');
}
/* 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
}