DigitalConsumer.ISS/playwright-tests/tests/advanced/0031a_ReplaceServiceableBigTruck.ts
Rob Donahey d539df9550
Feature/insr 7038: Playwright tests for big truck scenarios (#963)
List of commits in this pr:

* Begin essential Playwright test cases for big truck

* Implement non serviceable big truck vin lookup and fix test case tags

* Rename non serviceable vin cases

* Common sense .env.dev example

* Move extraneous stuff to .env.example

* Add playwright environment file to gitignore

* Stop tracking .env.dev

* Specify file ignore

* Ignore .env

* Implement advanced tests for big truck

* Remove duplicate smoke test

* Implement PR feedback

* Add  comments to type definitions for clarity for any future uses

* More descriptive env comment
2025-10-16 16:07:01 -04:00

93 lines
3.2 KiB
TypeScript

import ClientData from "@business-logic/data/ClientData";
import TestCase from "@business-logic/types/TestCase";
import { DamageType, PartQuestionType, 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: 'HOUSTON',
state: 'TX',
postalCode: '77001',
country: 'United States'
}
}
const policyNumber = `~AutomatedScenario0031a${faker.string.uuid().substring(0, 6)}`;
const policySoap = MockPolicyData.getPolicySoapByScenario('0031a', customerDetails, policyNumber);
const advancedScenario0031Data: Partial<ITestData> = {
clientTag: '',
isDuplicateClaim: false,
isPolicyFound: true,
isNoComp: false,
hasStateLawPopup: false,
endorsements: undefined,
partQuestions: [
{
partQuestionType: PartQuestionType.LaneKeepAssist,
isOnPage: true,
optionToSelect: 'Yes',
}
],
vehiclePartQuestions: [
{
partQuestionType: PartQuestionType.WindshieldColor,
isOnPage: true,
optionToSelect: 'Green Tint',
secondaryQuestionOptionToSelect: 'one-piece, w/lane departure warning system',
},
],
isSafelite: true,
servicePackage: faker.helpers.enumValue(ServicePackage),
customerDetails: customerDetails,
claimDetails: {
policyNumber: policyNumber,
policyDeductible: 250,
damageDate: '2025-09-01',
damageCause: DamageType.Rock,
},
policySoap: policySoap,
vehicleDetails: {
year: '2021',
make: 'Freightliner',
model: 'Cascadia',
style: 'conventional cab',
vin: '3AKJHPDV7MSLJ2958',
},
vehicleDamage: [
VehicleDamage.WindshieldCrackSingleWindshield,
],
appointmentDetails: {
serviceLocation: ServiceLocation.InShop,
shopAddress: undefined,
appointmentDate: nextWeekday
},
paymentDetails: ClientData.getDefaultPaypalDetails()//ClientData.getDefaultCreditCardDetails()
}
// TODO: Add validation for deductible/covered amount
const advancedClients = ClientData.getAdvancedClients();
const advancedScenario0031TestCases: TestCase[] = [];
for (const client of advancedClients) {
const data = { ...advancedScenario0031Data };
data.clientTag = client.clientTag;
const tc = new TestCase({
name: `0031a Advanced Replace Serviceable Big Truck: "${client.accountName}"`,
tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Advanced'],
testData: data
}, undefined, '0031a');
advancedScenario0031TestCases.push(tc);
}
export default advancedScenario0031TestCases;