Added new test to cover unverified insurance flow

This commit is contained in:
JennyNou 2025-06-09 15:23:54 -04:00
parent c2abf5d7aa
commit 3e7d251244

View file

@ -0,0 +1,86 @@
//Imports here
import { ITestData } from "@business-logic/types/ITestData"
import { PaymentMethod, AppointmentType, DamageType, PartQuestionType } 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("InsuranceUnverified");
// Now get the test data with the seeded faker
const insuranceUnverifiedData: Partial<ITestData> = {
...getDefaultTestData(), // Get default data with current seed
// Key feature: Insurance flow with GEICO
paymentMethod: PaymentMethod.Insurance,
// Insurance claim flags
isPolicyFound: false,
isPolicyUnverified: true,
isRecalNotification: true,
// Override customer details with specific name and California location
customerDetails: {
...getDefaultTestData().customerDetails!,
firstName: 'Jane',
lastName: 'Unverified',
address: {
...getDefaultTestData().customerDetails!.address,
city: 'Richmond',
state: 'Virginia',
postalCode: '23219'
}
},
// Insurance claim details
claimDetails: {
client: '21st Century',
policyNumber: 'UnverifiedMock',
policyDeductible: "Unverified",
policyZip: '43123',
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: '2014',
make: 'Honda',
model: 'Accord',
style: '4 door sedan',
vehicleLookupType: VehicleLookupType.Zip,
},
// Part questions related to recalibration
partQuestions: [
{
partQuestionType: PartQuestionType.GeneralQuestion1,
isOnPage: true,
optionToSelect: 'Yes'
},
],
// Override for in-shop appointment
appointmentDetails: {
serviceLocation: AppointmentType.InShop,
shopAddress: '5719 Brandt Pike, Dayton, OH 45424',
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
},
// Override payment details (empty because we skip payment method page in insurance flow)
paymentDetails: {}
}
const insuranceUnverifiedTests: TestCase[] = [];
const tc = new TestCase({
name: `InsuranceUnverified`,
tags: ['@E2E','@InsuranceUnverified', '@test_report', '@Insurance'],
testData: insuranceUnverifiedData
}, undefined, 'InsuranceUnverified');
insuranceUnverifiedTests.push(tc);
export default insuranceUnverifiedTests;