DigitalConsumer.ISS/playwright-tests/tests/advanced/0016a_NoCompAllGlass.ts
2026-03-25 16:12:53 -04:00

125 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";
import { IAddress } from "@business-logic/types/IAddress";
const nextWeekday = getNextWeekday();
const customerAddress: IAddress = {
street: faker.location.streetAddress(),
city: 'Somersworth',
state: 'NH',
postalCode: '03878',
country: 'United States'
}
const customerDetails: ICustomerDetails = {
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
email: 'itqatest@safelite.com',
phoneNumber: '614-531-0031',
notes: 'Automated Test',
address: customerAddress
}
const policyNumber = `~AutomatedScenario0016a${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('0016a', customerDetails, policyNumber);
const advancedScenario0016Data: Partial<ITestData> = {
clientTag: '',
isDuplicateClaim: false,
isPolicyFound: true,
isNoComp: true,
hasStateLawPopup: false,
endorsements: undefined,
vehiclePartQuestions: [
{
partQuestionType: PartQuestionType.WindshieldColor,
isOnPage: true,
optionToSelect: 'Solar, Third Visor Frit, soundproofing, Infrared Interlayer'
},
{
partQuestionType: PartQuestionType.DriverFrontColor,
isOnPage: true,
optionToSelect: 'Solar, Driver side, Front'
},
{
partQuestionType: PartQuestionType.DriverRearColor,
isOnPage: true,
optionToSelect: 'Solar, Driver side, Rear'
},
{
partQuestionType: PartQuestionType.DriverVentColor,
isOnPage: true,
optionToSelect: 'Solar, Driver side, Rear'
},
{
partQuestionType: PartQuestionType.PassengerFrontColor,
isOnPage: true,
optionToSelect: 'Solar, Passenger side, Front'
},
{
partQuestionType: PartQuestionType.PassengerRearColor,
isOnPage: true,
optionToSelect: 'Solar, Passenger side, Rear'
},
{
partQuestionType: PartQuestionType.RearWindowColor,
isOnPage: true,
optionToSelect: 'Heated glass, Solar'
},
],
isSafelite: true,
servicePackage: ServicePackage.Standard,
customerDetails: customerDetails,
claimDetails: {
policyNumber: policyNumber,
policyDeductible: 9999,
damageDate: '2023-08-01',
damageCause: faker.helpers.enumValue(DamageType)
},
policySoap: policySoap,
vehicleDetails: {
year: '2021',
make: 'Subaru',
model: 'WRX',
style: ''
},
vehicleDamage: [
VehicleDamage.WindshieldCrack,
VehicleDamage.RearWindow,
VehicleDamage.DriverFrontDoor,
VehicleDamage.DriverRearDoor,
VehicleDamage.DriverVentGlass,
VehicleDamage.PassengerFrontDoor,
VehicleDamage.PassengerRearDoor,
// VehicleDamage.PassengerVentGlass // TODO: Verify if this is intentionally not in UI
],
appointmentDetails: {
serviceLocation: ServiceLocation.InShop,
serviceAddress: undefined,
appointmentDate: nextWeekday
},
paymentDetails: ClientData.getDefaultPaypalDetails()
}
// TODO: Add validation for deductible/covered amount
const advancedClients = ClientData.getAdvancedClients();
const advancedScenario0016TestCases: TestCase[] = [];
for (const client of advancedClients) {
const data = {...advancedScenario0016Data};
data.clientTag = client.clientTag;
const tc = new TestCase({
name: `0016a Advanced Replace NoComp All Glass Client: "${client.accountName}"`,
tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Advanced', '@Defect-INSR-2138'],
testData: data
}, undefined, '0016a');
advancedScenario0016TestCases.push(tc);
}
export default advancedScenario0016TestCases;