fixes zip alert validation issue

Refactors the vehicle lookup test data structure to improve data handling and flexibility.
Consolidates license plate information into a dedicated object within vehicle details.
This commit is contained in:
maguire-arman 2025-06-25 16:25:04 -04:00
parent 88bc6c2077
commit 565d9f473e
2 changed files with 20 additions and 22 deletions

View file

@ -1,6 +1,6 @@
// Imports here
import { ITestData } from 'framework/TestData';
import { VehicleDamage, ServiceLocation, VehicleLookupType } from 'safelite-playwright-core';
import { VehicleDamage, ServiceLocation, VehicleLookupType, ILicensePlate } from 'safelite-playwright-core';
import { ITestCase } from '../../framework/Typedefs'
import { getNextWeekday } from 'safelite-playwright-core';
import { faker } from "@faker-js/faker";
@ -40,13 +40,13 @@ const baseInvalidZipData: Partial<ITestData> = {
interface LookupTestCase {
type: VehicleLookupType;
vehicleDetails: {
year: string;
make: string;
model: string;
style: string;
licensePlateNumber?: string;
licensePlateState?: string;
vin?: string;
year: string,
make: string,
model: string,
style?: string,
vin?: string|string[],
licensePlate?: ILicensePlate | ILicensePlate[],
vehicleLookupType?: VehicleLookupType,
};
enterFunnelWithZip?: boolean;
customerDetails?: {
@ -83,8 +83,7 @@ const lookupTypesToTest: LookupTestCase[] = [
make: 'Hyundai',
model: 'Sonata',
style: '4 door sedan',
licensePlateNumber: 'FTY 7776',
licensePlateState: 'Texas'
licensePlate: { licensePlateNumber: 'FTY 7776', licensePlateState: 'Texas' },
}
},
{

View file

@ -1,6 +1,6 @@
// Imports here
import { ITestData } from 'framework/TestData';
import { VehicleDamage, ServiceLocation, VehicleLookupType } from 'safelite-playwright-core';
import { VehicleDamage, ServiceLocation, VehicleLookupType, ILicensePlate } from 'safelite-playwright-core';
import { ITestCase } from '../../framework/Typedefs'
import { getNextWeekday } from 'safelite-playwright-core';
import { faker } from "@faker-js/faker";
@ -40,13 +40,13 @@ const baseVinNotFoundData: Partial<ITestData> = {
interface LookupTestCase {
type: VehicleLookupType;
vehicleDetails: {
year: string;
make: string;
model: string;
style: string;
licensePlateNumber?: string;
licensePlateState?: string;
vin?: string;
year: string,
make: string,
model: string,
style?: string,
vin?: string|string[],
licensePlate?: ILicensePlate | ILicensePlate[],
vehicleLookupType?: VehicleLookupType,
};
enterFunnelWithZip?: boolean;
customerDetails?: {
@ -93,8 +93,7 @@ const lookupTypesToTest: LookupTestCase[] = [
make: 'Hyundai',
model: 'Sonata',
style: '4 door sedan',
licensePlateNumber: '6WYN462',
licensePlateState: 'Texas'
licensePlate: { licensePlateNumber: '6WYN462', licensePlateState: 'Texas' },
}
},
{
@ -121,14 +120,14 @@ lookupTypesToTest.forEach((lookupType) => {
...lookupType.vehicleDetails,
vehicleLookupType: lookupType.type
},
enterFunnelWithZip: lookupType.enterFunnelWithZip
isEnterFunnelWithZip: lookupType.enterFunnelWithZip
};
// Handle special case for Address lookup which has different customer details
if (lookupType.type === VehicleLookupType.Address && lookupType.customerDetails) {
testData.customerDetails = {
...baseVinNotFoundData.customerDetails!,
address: lookupType.customerDetails.address
address: lookupType.customerDetails.address,
};
}