89 lines
No EOL
3.2 KiB
TypeScript
89 lines
No EOL
3.2 KiB
TypeScript
import ClientData from "@business-logic/data/ClientData";
|
|
import TestCase from "@business-logic/types/TestCase";
|
|
import { DamageType, PartQuestionType, PaymentType, ServiceLocation, ServicePackage, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
|
|
import { ITestData } from "@business-logic/types/ITestData"
|
|
import { faker } from "@faker-js/faker";
|
|
import { getNextWeekday } from "@impl/utils/DateUtils";
|
|
import MockPolicyData from "@business-logic/data/MockPolicyData";
|
|
import { ICustomerDetails } from "@business-logic/types/CustomerDetails";
|
|
|
|
const nextWeekday = getNextWeekday();
|
|
const customerDetails: ICustomerDetails = {
|
|
firstName: faker.person.firstName(),
|
|
lastName: faker.person.lastName(),
|
|
email: 'itqatest@safelite.com',
|
|
phoneNumber: '614-531-0031',
|
|
notes: 'Automated Test',
|
|
address: {
|
|
street: faker.location.streetAddress(),
|
|
city: 'San Jose',
|
|
state: 'CA',
|
|
postalCode: '97230-6373',
|
|
country: 'United States'
|
|
}
|
|
}
|
|
|
|
const policyNumber = `~AutomatedScenario0029a${crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase()}`; // Ensure unique policy number for each test run since same key in request can cause 500 error
|
|
const policySoap = MockPolicyData.getPolicySoapByScenario('0029a', customerDetails, policyNumber);
|
|
|
|
const advancedScenario0029Data: Partial<ITestData> = {
|
|
clientTag: '',
|
|
isDuplicateClaim: false,
|
|
isPolicyFound: true,
|
|
isUnverifiedPolicyAfterVehicleLookup: true,
|
|
hasStateLawPopup: true,
|
|
isNoComp: false,
|
|
endorsements: undefined,
|
|
vehiclePartQuestions: [
|
|
{
|
|
partQuestionType: PartQuestionType.WindshieldColor,
|
|
isOnPage: true,
|
|
optionToSelect: 'Heated glass, Encap, Asymmetrically Strengthen'
|
|
},
|
|
],
|
|
isUseVehicleOnPolicy: false,
|
|
servicePackage: faker.helpers.enumValue(ServicePackage),
|
|
customerDetails: customerDetails,
|
|
claimDetails: {
|
|
policyNumber: policyNumber,
|
|
policyDeductible: 500,
|
|
damageDate: '2017-06-02',
|
|
damageCause: DamageType.Vandalism
|
|
},
|
|
policySoap: policySoap,
|
|
vehicleDetails: {
|
|
year: '2017',
|
|
make: 'Freightliner',
|
|
model: '114sd',
|
|
vehicleLookupType: VehicleLookupType.Vin,
|
|
vin: '1FVMG3DV5HHJA1388',
|
|
},
|
|
vehicleDamage: [
|
|
VehicleDamage.WindshieldCrack,
|
|
],
|
|
appointmentDetails: {
|
|
serviceLocation: ServiceLocation.InShop,
|
|
shopAddress: undefined,
|
|
appointmentDate: nextWeekday
|
|
},
|
|
paymentDetails: {
|
|
paymentType: PaymentType.PayAtService
|
|
}
|
|
}
|
|
|
|
// TODO: Add validation for deductible/covered amount
|
|
const advancedClients = ClientData.getAdvancedClients();
|
|
const advancedScenario0029TestCases: TestCase[] = [];
|
|
for (const client of advancedClients) {
|
|
const data = { ...advancedScenario0029Data };
|
|
data.clientTag = client.clientTag;
|
|
data.accountNumber = client.accountNumber;
|
|
const tc = new TestCase({
|
|
name: `0029a Advanced client Unlisted Vehicle: "${client.accountName}"`,
|
|
tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Advanced', '@INSR-2057'],
|
|
testData: data
|
|
}, undefined, '0029a');
|
|
advancedScenario0029TestCases.push(tc);
|
|
}
|
|
|
|
export default advancedScenario0029TestCases; |