DigitalConsumer.FixMyGlass/playwright-tests/tests/CashReplaceMultiSlidingGlassDropoff.ts
maguire-arman e3d2373409 Sets payment method to self-pay for cash clients
Configures test data to explicitly set the payment method to "SelfPay" for test cases involving cash clients.
This change ensures that the payment process is correctly initiated and handled when customers choose to pay directly.
2025-06-18 10:08:02 -04:00

119 lines
No EOL
3.9 KiB
TypeScript

//Imports here
import { ITestData } from 'framework/TestData'
import { VehicleDamage, PartQuestionType, PaymentType, ServicePackage, ServiceLocation } from 'safelite-playwright-core';
import { ITestCase } from '../framework/Typedefs'
import { VehicleLookupType } from 'safelite-playwright-core';
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
import { PaymentMethod } from 'framework/localTypes/Enums';
// Set the seed before generating any data
setFakerSeedFromTestName("CashReplaceMultiSlidingGlassDropoff");
// Now get the test data with the seeded faker
const cashReplaceMultiSlidingGlassDropoffData: Partial<ITestData> = {
...getDefaultTestData(), // Get default data with current seed
// CASH Client
paymentMethod: PaymentMethod.SelfPay,
// Override customer postal code
customerDetails: {
...getDefaultTestData().customerDetails!,
address: {
...getDefaultTestData().customerDetails!.address,
postalCode: '43085'
}
},
// Flag for recalibration vehicle
isRecalVehicle: true,
// Key feature: Standard Package
servicePackage: ServicePackage.Standard,
// Override for drop-off service
appointmentDetails: {
serviceLocation: ServiceLocation.DropOff,
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
},
// Override vehicle details
vehicleDetails: {
...getDefaultTestData().vehicleDetails!,
year: '2018',
make: 'Ford',
model: 'F Series F150',
style: '4 door crew cab',
vehicleLookupType: VehicleLookupType.Zip
},
// Key feature: multiple damaged glasses
vehicleDamage: [
VehicleDamage.WindshieldCrack,
VehicleDamage.PassengerFrontDoor,
VehicleDamage.PassengerRearDoor,
VehicleDamage.RearSliding
],
// Override payment details
paymentDetails: {
paymentType: PaymentType.PayAtService
},
// Part questions related to rain sensing
partQuestions: [
{
partQuestionType: PartQuestionType.GeneralQuestion1,
isOnPage: true,
optionToSelect: 'Yes'
},
],
// Capability Questions
capabilityQuestions: [
{
partQuestionType: PartQuestionType.GeneralQuestion1,
isOnPage: true,
optionToSelect: 'Yes'
},
],
// Vehicle part questions for multiple glass parts
vehiclePartQuestions: [
{
partQuestionType: PartQuestionType.WindshieldColor,
isOnPage: true,
optionToSelect: 'Green Tint',
secondaryQuestionOptionToSelect: 'rain sensor, solar, soundproofing, third visor frit, lane departure warning system, heated glass wiper park, w/combination bracket'
},
{
partQuestionType: PartQuestionType.PassengerFrontColor,
isOnPage: true,
optionToSelect: 'Green Tint',
secondaryQuestionOptionToSelect: 'solar, passenger side, front, laminated, soundproofing'
},
{
partQuestionType: PartQuestionType.PassengerRearColor,
isOnPage: true,
optionToSelect: 'Gray Tint Privacy',
secondaryQuestionOptionToSelect: 'solar, passenger side, rear, platinum edition, 2 hole'
},
{
partQuestionType: PartQuestionType.RearSlidingWindowColor,
isOnPage: true,
optionToSelect: 'Gray Tint Privacy',
secondaryQuestionOptionToSelect: 'heated glass, solar, slider, power, kit'
}
]
}
const cashReplaceMultiSlidingGlassDropoffTests: ITestCase[] = [];
const tc = {
name: `CashReplaceMultiSlidingGlassDropoff`,
tags: ['@E2E','@CashReplaceMultiSlidingGlassDropoff', '@test_report', '@CASH'],
testData: cashReplaceMultiSlidingGlassDropoffData
};
cashReplaceMultiSlidingGlassDropoffTests.push(tc);
export default cashReplaceMultiSlidingGlassDropoffTests;