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

84 lines
No EOL
2.9 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,
vehiclePartQuestions: [
{
partQuestionType: PartQuestionType.WindshieldColor,
isOnPage: true,
optionToSelect: 'Solar'
},
// {
// partQuestionType: PartQuestionType.DriverFrontColor,
// isOnPage: true,
// optionToSelect: 'Green Tint'
// },
],
isSafelite: true,
servicePackage: faker.helpers.enumValue(ServicePackage),
customerDetails: {
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
email: faker.internet.email(),
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: '1000 Hart Road',
city: 'Columbus',
state: 'OHIO',
postalCode: '43223',
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: '2011',
make: 'Nissan',
model: 'XTerra',
style: '4 door utility',
vin: '5N1AN0NW9BC524974',
vehicleLookupType: VehicleLookupType.Vin,
},
vehicleDamage: [
VehicleDamage.WindshieldCrack,
// VehicleDamage.DriverFrontDoor,
],
appointmentDetails: {
serviceLocation: ServiceLocation.DropOff,
shopAddress: undefined,
appointmentDate: nextWeekday
}
}
const essentialClients = ClientData.getEssentialClients();
const essentialReplacePartsQuestionsDropoff_0015: TestCase[] = [];
for (const client of essentialClients) {
const data = { ...essentialReplaceData };
data.clientTag = client.clientTag;
data.isAuthenticationRequired = client.clientFlags.isAuthenticationEnabled ?? false
const tc = new TestCase({
name: `0015 Essential Replace Client: "${client.accountName}"`,
tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Essentials','@0015'],
testData: data
}, undefined, '0015');
essentialReplacePartsQuestionsDropoff_0015.push(tc);
}
export default essentialReplacePartsQuestionsDropoff_0015;