Adds support for heavy truck insurance flow

Adds a new test case for a big truck insurance flow.
This includes updating the test data to include a flag for heavy trucks and the zip code.

Renames `isHeavyTruckVehicle` to `isHeavyTruckVehicleAlert` for clarity.
This commit is contained in:
maguire-arman 2025-05-20 10:42:49 -04:00
parent 5c92fe8322
commit c49228220d
6 changed files with 94 additions and 5 deletions

View file

@ -1,5 +1,5 @@
export default interface IAlertFlags {
isHeavyTruckVehicle?: boolean,
isHeavyTruckVehicleAlert?: boolean,
isRepairReplace?: boolean,
isSplitWindshield?: boolean,
isRepairOnly?: boolean,

View file

@ -29,6 +29,7 @@ export interface ITestData {
endorsements: IEndorsementDetails[],
hasOemEndorsement: boolean, // OEM Endorsement does not appear on endorsements page, so it has a separate flag.s
skipEstimatePage: boolean,
isHeavyTruck: boolean,
isRecalVehicle: boolean,
canNotRecal: boolean,
dynamicRecal: boolean,

View file

@ -11,6 +11,7 @@ export class VehicleSelectionPage extends BasePage {
readonly makeDropdown: Locator;
readonly modelDropdown: Locator;
readonly styleDropdown: Locator;
readonly zipCodeTextBox: Locator;
readonly discontinuedServiceAlert: Locator;
url = process.env['BASE_URL']! + '/fmg/?fmgPage=vehicle';
@ -22,6 +23,7 @@ export class VehicleSelectionPage extends BasePage {
this.makeDropdown = this.page.locator('#makeQuestionField');
this.modelDropdown = this.page.locator('#modelQuestionField');
this.styleDropdown = this.page.locator('#styleQuestionField');
this.zipCodeTextBox = this.page.getByRole('textbox', { name: 'Zip code' });
this.discontinuedServiceAlert = this.page.locator('.alert-danger.widget-name-AlertNoServiceWidget');
// this.validateURL(this.url);
}
@ -48,13 +50,17 @@ export class VehicleSelectionPage extends BasePage {
@step("VehicleSelectionPage >> Select Vehicle: ")
async handleVehicleSelectionPage(testData: Partial<ITestData>) {
await this.validateProgressBar("4");
const { vehicleDetails } = testData;
const { isHeavyTruckVehicle, isSplitWindshield } = testData.alertFlags || {};
const { vehicleDetails, isHeavyTruck, customerDetails } = testData;
const { isHeavyTruckVehicleAlert, isSplitWindshield } = testData.alertFlags || {};
await this.selectVehicle(vehicleDetails!);
if (isHeavyTruck) {
await this.zipCodeTextBox.fill(customerDetails?.address.postalCode!);
}
// Handle alert conditions for vehicle selection
if (isHeavyTruckVehicle || isSplitWindshield) {
if (isHeavyTruckVehicleAlert || isSplitWindshield) {
await this.checkForAlertMessages();
throw new TestSuccessAlert('Both assertions are met successfully.');
}

View file

@ -31,6 +31,7 @@ import cashRepairInShopAfterPayTests from "./CashRepairInShopAfterPay";
import cashRepairInShopPayPalTests from "./CashRepairInShopPayPal";
import cashReplaceMultiSlidingGlassDropoffTests from "./CashReplaceMultiSlidingGlassDropoff";
import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile";
import insuranceBigTruckVerifiedTests from "./BigTruckInsuranceVerifiedFlow";
/**
* Master Test Runner
@ -67,6 +68,7 @@ const allStandardTests = [
{name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests},
{name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests},
{name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests},
{name: "BigTruckInsuranceVerifiedFlow", tests: insuranceBigTruckVerifiedTests},
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
// {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests}

View file

@ -0,0 +1,80 @@
//Imports here
import { ITestData } from "@business-logic/types/ITestData"
import { PaymentMethod, AppointmentType, DamageType, PaymentType } from "@business-logic/types/Enums";
import TestCase from "@business-logic/types/TestCase";
import { VehicleLookupType } from "@business-logic/types/Enums";
import { getDefaultTestData, setFakerSeedFromTestName } from "@business-logic/constants/DefaultTestData";
// Set the seed based on test name for consistent but unique data
setFakerSeedFromTestName("InsuranceBigTruckVerified");
// Now get the test data with the seeded faker
const insuranceBigTruckVerifiedData: Partial<ITestData> = {
...getDefaultTestData(), // Get default data with current seed
// Key feature: Insurance flow with GEICO
paymentMethod: PaymentMethod.Insurance,
// Insurance claim flags
isDuplicateClaim: true,
isPolicyFound: true,
isUseVehicleOnPolicy: true,
isHeavyTruck: true,
// Override customer details with specific name and California location
customerDetails: {
...getDefaultTestData().customerDetails!,
firstName: 'Big',
lastName: 'Truck',
address: {
...getDefaultTestData().customerDetails!.address,
city: 'Ontario',
state: 'California',
postalCode: '55414'
}
},
// Insurance claim details
claimDetails: {
client: 'USAA',
policyNumber: 'Mock900040BigTruck',
policyDeductible: 2000.00,
damageDate: new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-US', {month: '2-digit', day: '2-digit', year: 'numeric'}),
damageCause: DamageType.Rock
},
// Hyundai vehicle details with VIN lookup
vehicleDetails: {
...getDefaultTestData().vehicleDetails!,
year: '2025',
make: 'Peterbilt',
model: '579',
style: 'conventional cab',
vin: '1XPBDP9X6SD693446',
vehicleLookupType: VehicleLookupType.Vin,
},
// No need to override vehicleDamage as it already defaults to WindshieldCrack
// Override for in-shop appointment
appointmentDetails: {
serviceLocation: AppointmentType.InShop,
shopAddress: '504 Malcolm Ave SE, Minneapolis, MN 55414',
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
},
// Override payment details (empty because we skip payment method page in insurance flow)
paymentDetails: {}
}
const insuranceBigTruckVerifiedTests: TestCase[] = [];
const tc = new TestCase({
name: `InsuranceBigTruckVerified`,
tags: ['@E2E','@InsuranceBigTruckVerified', '@test_report', '@Insurance'],
testData: insuranceBigTruckVerifiedData
}, undefined, 'InsuranceBigTruckVerified');
insuranceBigTruckVerifiedTests.push(tc);
export default insuranceBigTruckVerifiedTests;

View file

@ -18,7 +18,7 @@ const heavyTruckData: Partial<ITestData> = {
style: 'conventional cab'
},
alertFlags: {
isHeavyTruckVehicle: true
isHeavyTruckVehicleAlert: true
},
vehicleDamage: [
VehicleDamage.WindshieldOneChip,