DigitalConsumer.ISS/playwright-tests/tests/0013_EssentialReplace.ts
2026-03-30 20:46:59 -04:00

75 lines
No EOL
2.7 KiB
TypeScript

import ClientData from "@business-logic/data/ClientData";
import { DamageType, PartQuestionType, ServiceLocation, ServicePackage, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
import { ITestData } from "@business-logic/types/ITestData"
import TestCase from "@business-logic/types/TestCase";
import { faker } from "@faker-js/faker";
import { getNextWeekday } from "@impl/utils/DateUtils";
const nextWeekday = getNextWeekday();
const essentialReplaceData: Partial<ITestData> = {
clientTag: 'ALL_ESSENTIAL',
isDuplicateClaim: false,
isPolicyFound: false,
endorsements: [],
isReplace: false,
partQuestions: [],
isSafelite: true,
servicePackage: faker.helpers.enumValue(ServicePackage),
customerDetails: {
firstName: faker.person.firstName(),
lastName: 'Tyler',
email: "itqatest@safelite.com",
phoneNumber: faker.helpers.fromRegExp(/[2-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]/),
notes: 'Automated Test',
address: {
street: '503 OLD CHATTANOOGA PIKE SW CLEVELAND',// DO NOT use fake address here as this scenario search vehicle by address //faker.location.streetAddress(),
city: 'Cleveland',
state: 'TENNESSEE',
postalCode: '37311',
country: 'United States'
}
},
claimDetails: {
policyNumber: faker.string.alphanumeric(5),
policyDeductible: -1, // Not advanced, so we don't care about deductible.
damageDate: '2024-10-10',
damageCause: DamageType.Other
},
vehicleDetails: {
year: '2010',
make: 'Lincoln',
model: 'MKZ',
style: '4 door sedan',
vehicleLookupType: VehicleLookupType.Address,
},
vehicleDamage: [
VehicleDamage.WindshieldCrack,
VehicleDamage.DriverFrontDoor,
VehicleDamage.DriverRearDoor,
VehicleDamage.PassengerFrontDoor,
VehicleDamage.PassengerRearDoor,
],
appointmentDetails: {
serviceLocation: ServiceLocation.InShop,
shopAddress: undefined,
appointmentDate: nextWeekday
}
}
const essentialClients = ClientData.getEssentialClients();
const essentialReplaceTestCases: TestCase[] = [];
for (const client of essentialClients) {
const data = {...essentialReplaceData};
data.clientTag = client.clientTag;
data.isAuthenticationRequired = client.clientFlags.isAuthenticationEnabled ?? false
const tc = new TestCase({
name: `0013 Essential Replace Client: "${client.accountName}"`,
tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Essentials'],
testData: data
}, undefined, '0013');
essentialReplaceTestCases.push(tc);
}
export default essentialReplaceTestCases;