DigitalConsumer.FixMyGlass/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts
maguire-arman 8da9b21539 Updates with 631 changes
Improves the handling of cash to insurance flows, including adding new test cases and adjusting logic for policy verification and payment methods.
Also, updates UI elements to ensure correct display of deductible information and handles split windshield scenarios.
The `safelite-playwright-core` dependency is updated to version 1.0.22.
2025-06-23 14:17:34 -04:00

81 lines
2.7 KiB
TypeScript

//Imports here
import { ITestData } from 'framework/TestData'
import { ServiceLocation } from "safelite-playwright-core";
import { DamageType, PartQuestionType, PaymentType } from 'safelite-playwright-core'
import { ITestCase } from '../framework/Typedefs'
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
// Set the seed for consistent data generation
setFakerSeedFromTestName("CashReplaceSwitchToInsuranceProgressiveNoComp");
// Define insurance test data for Progressive
const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial<ITestData> = {
...getDefaultTestData(),
isCashInsuranceFlow: true,
// Override customer details based on provided ZIP code
customerDetails: {
...getDefaultTestData().customerDetails!,
address: {
...getDefaultTestData().customerDetails!.address,
postalCode: "70458",
},
},
// Vehicle details for a 2012 Chrysler 300
vehicleDetails: {
...getDefaultTestData().vehicleDetails!,
year: "2012",
make: "Chrysler",
model: "300",
style: "4 door sedan"
},
partQuestions: [
{
partQuestionType: PartQuestionType.GeneralQuestion1,
isOnPage: true,
optionToSelect: 'Yes'
},
],
// Override payment details
paymentDetails: {
paymentType: PaymentType.PayWithInsurance, // Ensures insurance payment method is selected
},
// Insurance claim details
claimDetails: {
client: "Progressive",
policyNumber: "Mock495646B",
policyDeductible: 0,
damageDate: new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }),
damageCause: DamageType.Rock,
},
isPolicyFound: true,
isUseVehicleOnPolicy: true,
isPolicyDriver: true,
// Appointment details for in-shop service
appointmentDetails: {
serviceLocation: ServiceLocation.InShop,
shopAddress: "8985 Yellow Brick Rd, Rosedale, MD 21237",
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate,
},
};
// Create and register the test case
const cashReplaceSwitchToInsuranceProgressiveNoCompTests: ITestCase[] = [];
const tc = {
name: `CashReplaceSwitchToInsuranceProgressiveNoComp`,
tags: ["@E2E", "@CashReplaceSwitchToInsuranceProgressiveNoComp", "@test_report", "@CASH"],
testData: cashReplaceSwitchToInsuranceProgressiveNoCompData,
};
cashReplaceSwitchToInsuranceProgressiveNoCompTests.push(tc);
export default cashReplaceSwitchToInsuranceProgressiveNoCompTests;