128 lines
No EOL
4.4 KiB
TypeScript
128 lines
No EOL
4.4 KiB
TypeScript
import ClientData from "@business-logic/data/ClientData";
|
|
import TestCase from "@business-logic/types/TestCase";
|
|
import { DamageType, PartQuestionType, PaymentType, ServiceLocation, ServicePackage, VehicleDamage } 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: 'PLANO',
|
|
state: 'TX',
|
|
postalCode: '75023',
|
|
country: 'United States'
|
|
}
|
|
}
|
|
var policyNumber = '';
|
|
if ((process.env.ENABLE_MOCK_TESTING ?? 'false') === 'true') {
|
|
policyNumber = '~AutomatedScenario0002aMockPolicy002';
|
|
customerDetails.firstName = 'Rosie';
|
|
customerDetails.lastName = 'Cormier';
|
|
customerDetails.address.street = '69825 W Pine Street';
|
|
} else {
|
|
policyNumber = `~AutomatedScenario0002a${crypto.randomUUID().replace(/-/g, '').slice(0, 16).toUpperCase()}`;
|
|
};
|
|
const policySoap = MockPolicyData.getPolicySoapByScenario('0002a', customerDetails, policyNumber);
|
|
|
|
const advancedScenario0002Data: Partial<ITestData> = {
|
|
isMockTesting: process.env.ENABLE_MOCK_TESTING === 'true' || false,
|
|
clientTag: '',
|
|
isDuplicateClaim: false,
|
|
isPolicyFound: true,
|
|
isNoComp: false,
|
|
hasStateLawPopup: false,
|
|
hasOemEndorsement: true,
|
|
endorsements: undefined,
|
|
vehiclePartQuestions: [
|
|
// {
|
|
// partQuestionType: PartQuestionType.WindshieldColor,
|
|
// isOnPage: true,
|
|
// optionToSelect: 'Green Tint, Blue Shade'
|
|
// },
|
|
// {
|
|
// partQuestionType: PartQuestionType.WindshieldColor,
|
|
// isOnPage: true,
|
|
// optionToSelect: 'Green Tint'
|
|
// },
|
|
// {
|
|
// partQuestionType: PartQuestionType.DriverFrontColor,
|
|
// isOnPage: true,
|
|
// optionToSelect: 'Green Tint'
|
|
// },
|
|
// {
|
|
// partQuestionType: PartQuestionType.DriverQuarterColor,
|
|
// isOnPage: true,
|
|
// optionToSelect: 'Green Tint'
|
|
// },
|
|
// {
|
|
// partQuestionType: PartQuestionType.DriverRearColor,
|
|
// isOnPage: true,
|
|
// optionToSelect: 'Green Tint'
|
|
// }
|
|
// {
|
|
// partQuestionType: PartQuestionType.LeatherSeats,
|
|
// isOnPage: true,
|
|
// optionToSelect: 'Yes'
|
|
// }
|
|
],
|
|
isSafelite: true,
|
|
servicePackage: ServicePackage.Premium,
|
|
customerDetails: customerDetails,
|
|
claimDetails: {
|
|
policyNumber: policyNumber,
|
|
policyDeductible: 50,
|
|
damageDate: '2023-08-01',
|
|
damageCause: DamageType.Vandalism
|
|
},
|
|
policySoap: policySoap,
|
|
vehicleDetails: {
|
|
year: '2006',
|
|
make: 'Chrysler',
|
|
model: '300',
|
|
style: '4 door sedan'
|
|
},
|
|
vehicleDamage: [
|
|
// VehicleDamage.WindshieldThreeChips,
|
|
VehicleDamage.WindshieldCrack,
|
|
// VehicleDamage.DriverFrontDoor,
|
|
// VehicleDamage.DriverQuarterPanel,
|
|
// VehicleDamage.DriverRearDoor,
|
|
// VehicleDamage.PassengerFrontDoor,
|
|
// VehicleDamage.PassengerQuarterPanel,
|
|
// VehicleDamage.PassengerRearDoor,
|
|
//VehicleDamage.RearWindow
|
|
],
|
|
appointmentDetails: {
|
|
serviceLocation: ServiceLocation.DropOff,
|
|
shopAddress: undefined,
|
|
appointmentDate: nextWeekday
|
|
},
|
|
paymentDetailsAdyen: ClientData.getPaypalDetailsAdyen()
|
|
|
|
}
|
|
|
|
// TODO: Add validation for deductible/covered amount
|
|
|
|
const advancedClients = ClientData.getAdvancedClients();
|
|
const advancedScenario0002TestCases: TestCase[] = [];
|
|
for (const client of advancedClients) {
|
|
const data = { ...advancedScenario0002Data };
|
|
data.clientTag = client.clientTag;
|
|
const tc = new TestCase({
|
|
name: `0002a_Advanced_Replace_Deductible_Client: "${client.accountName}"`,
|
|
tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Advanced'],
|
|
testData: data
|
|
}, undefined, '0002a');
|
|
advancedScenario0002TestCases.push(tc);
|
|
}
|
|
|
|
export default advancedScenario0002TestCases; |