DigitalConsumer.ISS/playwright-tests/tests/advanced/0004a_NoDeductibleAdas.ts

83 lines
No EOL
2.9 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: 'PALM COAST',
state: 'FL',
postalCode: '32137-8523',
country: 'United States'
}
}
const policyNumber = `~AutomatedScenario0004a${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('0004a', customerDetails, policyNumber);
const advancedScenario0004aData: Partial<ITestData> = {
clientTag: '',
isDuplicateClaim: false,
isPolicyFound: true,
isNoComp: false,
hasStateLawPopup: false,
endorsements: undefined,
partQuestions: [],
isSafelite: true,
servicePackage: faker.helpers.enumValue(ServicePackage),
customerDetails: customerDetails,
claimDetails: {
policyNumber: policyNumber,
policyDeductible: 0,
damageDate: '2022-07-26',
damageCause: faker.helpers.enumValue(DamageType),
},
policySoap: policySoap,
vehicleDetails: {
year: '2021',
make: 'Subaru',
model: 'Outback',
style: ''
},
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 advancedScenario0004aTestCases: TestCase[] = [];
for (const client of advancedClients) {
const data = { ...advancedScenario0004aData };
data.clientTag = client.clientTag;
data.accountNumber = client.accountNumber;
const tc = new TestCase({
name: `0004a Advanced Replace Deductible Client: "${client.accountName}"`,
tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Advanced'],
testData: data
}, undefined, '0004a');
advancedScenario0004aTestCases.push(tc);
}
export default advancedScenario0004aTestCases;