DigitalConsumer.ISS/playwright-tests/pages/TpaSubmitPage.ts
2026-04-14 10:09:52 -04:00

35 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');
}
async validateDeductible(claimDetails: IClaimDetails, isUnverifiedPolicyAfterVehicleLookup: boolean, isPolicyFound: boolean) {
const deductibleTextValue = await this.deductible.textContent();
await expect(this.deductible).toBeVisible();
if (claimDetails.policyDeductible !== -1 && !isUnverifiedPolicyAfterVehicleLookup) {
expect.soft(deductibleTextValue).toContain(claimDetails.policyDeductible.toLocaleString());
} else
expect.soft(deductibleTextValue).toEqual('Verifying coverage');
}
// TODO: Validate change preferred shop and contact details flows
}