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:
parent
88bc6c2077
commit
565d9f473e
2 changed files with 20 additions and 22 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
// Imports here
|
// Imports here
|
||||||
import { ITestData } from 'framework/TestData';
|
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 { ITestCase } from '../../framework/Typedefs'
|
||||||
import { getNextWeekday } from 'safelite-playwright-core';
|
import { getNextWeekday } from 'safelite-playwright-core';
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
|
|
@ -40,13 +40,13 @@ const baseInvalidZipData: Partial<ITestData> = {
|
||||||
interface LookupTestCase {
|
interface LookupTestCase {
|
||||||
type: VehicleLookupType;
|
type: VehicleLookupType;
|
||||||
vehicleDetails: {
|
vehicleDetails: {
|
||||||
year: string;
|
year: string,
|
||||||
make: string;
|
make: string,
|
||||||
model: string;
|
model: string,
|
||||||
style: string;
|
style?: string,
|
||||||
licensePlateNumber?: string;
|
vin?: string|string[],
|
||||||
licensePlateState?: string;
|
licensePlate?: ILicensePlate | ILicensePlate[],
|
||||||
vin?: string;
|
vehicleLookupType?: VehicleLookupType,
|
||||||
};
|
};
|
||||||
enterFunnelWithZip?: boolean;
|
enterFunnelWithZip?: boolean;
|
||||||
customerDetails?: {
|
customerDetails?: {
|
||||||
|
|
@ -83,8 +83,7 @@ const lookupTypesToTest: LookupTestCase[] = [
|
||||||
make: 'Hyundai',
|
make: 'Hyundai',
|
||||||
model: 'Sonata',
|
model: 'Sonata',
|
||||||
style: '4 door sedan',
|
style: '4 door sedan',
|
||||||
licensePlateNumber: 'FTY 7776',
|
licensePlate: { licensePlateNumber: 'FTY 7776', licensePlateState: 'Texas' },
|
||||||
licensePlateState: 'Texas'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Imports here
|
// Imports here
|
||||||
import { ITestData } from 'framework/TestData';
|
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 { ITestCase } from '../../framework/Typedefs'
|
||||||
import { getNextWeekday } from 'safelite-playwright-core';
|
import { getNextWeekday } from 'safelite-playwright-core';
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
|
|
@ -40,13 +40,13 @@ const baseVinNotFoundData: Partial<ITestData> = {
|
||||||
interface LookupTestCase {
|
interface LookupTestCase {
|
||||||
type: VehicleLookupType;
|
type: VehicleLookupType;
|
||||||
vehicleDetails: {
|
vehicleDetails: {
|
||||||
year: string;
|
year: string,
|
||||||
make: string;
|
make: string,
|
||||||
model: string;
|
model: string,
|
||||||
style: string;
|
style?: string,
|
||||||
licensePlateNumber?: string;
|
vin?: string|string[],
|
||||||
licensePlateState?: string;
|
licensePlate?: ILicensePlate | ILicensePlate[],
|
||||||
vin?: string;
|
vehicleLookupType?: VehicleLookupType,
|
||||||
};
|
};
|
||||||
enterFunnelWithZip?: boolean;
|
enterFunnelWithZip?: boolean;
|
||||||
customerDetails?: {
|
customerDetails?: {
|
||||||
|
|
@ -93,8 +93,7 @@ const lookupTypesToTest: LookupTestCase[] = [
|
||||||
make: 'Hyundai',
|
make: 'Hyundai',
|
||||||
model: 'Sonata',
|
model: 'Sonata',
|
||||||
style: '4 door sedan',
|
style: '4 door sedan',
|
||||||
licensePlateNumber: '6WYN462',
|
licensePlate: { licensePlateNumber: '6WYN462', licensePlateState: 'Texas' },
|
||||||
licensePlateState: 'Texas'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -121,14 +120,14 @@ lookupTypesToTest.forEach((lookupType) => {
|
||||||
...lookupType.vehicleDetails,
|
...lookupType.vehicleDetails,
|
||||||
vehicleLookupType: lookupType.type
|
vehicleLookupType: lookupType.type
|
||||||
},
|
},
|
||||||
enterFunnelWithZip: lookupType.enterFunnelWithZip
|
isEnterFunnelWithZip: lookupType.enterFunnelWithZip
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle special case for Address lookup which has different customer details
|
// Handle special case for Address lookup which has different customer details
|
||||||
if (lookupType.type === VehicleLookupType.Address && lookupType.customerDetails) {
|
if (lookupType.type === VehicleLookupType.Address && lookupType.customerDetails) {
|
||||||
testData.customerDetails = {
|
testData.customerDetails = {
|
||||||
...baseVinNotFoundData.customerDetails!,
|
...baseVinNotFoundData.customerDetails!,
|
||||||
address: lookupType.customerDetails.address
|
address: lookupType.customerDetails.address,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue