Merge pull request #3169 from Safelite/jnou/cash-999
Add Playwright Tests for Insurance Details Page
This commit is contained in:
commit
326bd25705
3 changed files with 65 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import VehiclePartQuestionsPage from "../pages/VehiclePartsPage"
|
|||
import CapabilityQuestionsPage from "../pages/CapabilityQuestionsPage"
|
||||
import MoldingQuestionsPage from "../pages/MoldingQuestionsPage"
|
||||
import { InsuranceCompanyPage } from "../pages/InsuranceCompanyPage"
|
||||
import { InsuranceDetailsPage } from "../pages/InsuranceDetailsPage"
|
||||
import { CCPolicyInfoPage } from "../pages/CCPolicyInfoPage"
|
||||
import { DuplicateCheckPage } from "../pages/DuplicateCheckPage"
|
||||
import { PolicyVehiclesPage } from "../pages/PolicyVehiclesPage"
|
||||
|
|
@ -42,6 +43,7 @@ export interface ITestPages {
|
|||
estimatePage: EstimatePage,
|
||||
homePage: HomePage,
|
||||
insuranceCompanyPage: InsuranceCompanyPage,
|
||||
insuranceDetailsPage: InsuranceDetailsPage,
|
||||
leadgenHomePage: LeadgenHomePage,
|
||||
moldingQuestionsPage: MoldingQuestionsPage,
|
||||
orderConfirmationPage: OrderConfirmationPage,
|
||||
|
|
@ -78,6 +80,7 @@ export const createTestPages: TestPagesFactory<ITestPages> = (page: Page) => {
|
|||
estimatePage: new EstimatePage(page),
|
||||
homePage: new HomePage(page),
|
||||
insuranceCompanyPage: new InsuranceCompanyPage(page),
|
||||
insuranceDetailsPage: new InsuranceDetailsPage(page),
|
||||
leadgenHomePage: new LeadgenHomePage(page),
|
||||
moldingQuestionsPage: new MoldingQuestionsPage(page),
|
||||
orderConfirmationPage: new OrderConfirmationPage(page),
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export enum ProgressBarPercentages {
|
|||
VehiclePartsPage = '20%',
|
||||
ServicePackagePage = '60%',
|
||||
InsuranceCompanyPage = '60%',
|
||||
InsuranceDetailsPage = '55%',
|
||||
ServiceLocationPage = '76%',
|
||||
SchedulePage = '76%',
|
||||
MobileDetailsPage = '76%',
|
||||
|
|
|
|||
61
playwright-tests/pages/InsuranceDetailsPage.ts
Normal file
61
playwright-tests/pages/InsuranceDetailsPage.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { type Locator, type Page } from '@playwright/test';
|
||||
import { BasePage } from './BasePage';
|
||||
import { step } from 'framework/localTypes/Step';
|
||||
import { ITestData } from 'framework/TestData';
|
||||
import { ProgressBarPercentages } from 'framework/localTypes/Enums';
|
||||
|
||||
export class InsuranceDetailsPage extends BasePage {
|
||||
|
||||
readonly page: Page;
|
||||
readonly insuranceCompany: Locator;
|
||||
readonly policyNumber: Locator;
|
||||
readonly dateOfLoss: Locator;
|
||||
readonly damageCause: Locator;
|
||||
readonly claimNumber: Locator; // conditional — only shown for certain insurers like Kentucky Farm Bureau
|
||||
readonly streetAddress: Locator;
|
||||
readonly apartment: Locator;
|
||||
readonly city: Locator;
|
||||
readonly policyState: Locator;
|
||||
readonly policyZip: Locator;
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page);
|
||||
this.page = page;
|
||||
|
||||
this.insuranceCompany = page.getByLabel('Insurance company');
|
||||
this.policyNumber = page.getByLabel('Policy number');
|
||||
this.dateOfLoss = page.getByLabel('Approximate date of loss');
|
||||
this.claimNumber = page.getByLabel('Claim Number');
|
||||
this.damageCause = page.getByLabel('How did the damage occur?');
|
||||
this.streetAddress = page.getByLabel('Street address');
|
||||
this.apartment = page.getByLabel('Apt. number (optional)');
|
||||
this.city = page.getByLabel('City');
|
||||
this.policyState = page.getByLabel('State');
|
||||
this.policyZip = page.getByLabel('Zip');
|
||||
}
|
||||
|
||||
private async populatePage(testData: Partial<ITestData>): Promise<void> {
|
||||
const { claimDetails, customerDetails } = testData;
|
||||
|
||||
await this.policyNumber.fill(claimDetails!.policyNumber);
|
||||
await this.dateOfLoss.fill(claimDetails!.damageDate);
|
||||
await this.damageCause.selectOption(claimDetails!.damageCause);
|
||||
await this.streetAddress.fill(customerDetails!.address.street);
|
||||
await this.apartment.fill(customerDetails!.address.aptNumber ?? '');
|
||||
await this.city.fill(customerDetails!.address.city);
|
||||
await this.policyState.selectOption(customerDetails!.address.state);
|
||||
await this.policyZip.fill(customerDetails!.address.postalCode);
|
||||
|
||||
if (await this.claimNumber.isVisible()) {
|
||||
await this.claimNumber.fill(claimDetails!.claimNumber ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
@step("InsuranceDetailsPage >> Fill out insurance details for non integrated insurance flow")
|
||||
async handleInsuranceDetailsPage(testData: Partial<ITestData>): Promise<void> {
|
||||
await this.validateProgressBar(ProgressBarPercentages.InsuranceDetailsPage);
|
||||
await this.populatePage(testData);
|
||||
await this.nextPage();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue