DigitalConsumer.FixMyGlass/playwright-tests/tests/CashReplaceMultiGlassPromoInshop.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

109 lines
No EOL
3.8 KiB
TypeScript

//Imports here
import { ITestData } from 'framework/TestData'
import { VehicleDamage, PartQuestionType, PaymentType } 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("CashReplaceMultiGlassPromoInshop");
// Now get the test data with the seeded faker
const cashReplaceMultiGlassPromoInshopData: Partial<ITestData> = {
...getDefaultTestData(), // Get default data with current seed
// CASH Client
paymentMethod: PaymentMethod.SelfPay,
// Flag for recalibration vehicle
isRecalVehicle: true,
// Override customer details - different postal code
customerDetails: {
...getDefaultTestData().customerDetails!,
address: {
...getDefaultTestData().customerDetails!.address,
postalCode: '43085'
}
},
// Override vehicle details with VIN lookup
vehicleDetails: {
...getDefaultTestData().vehicleDetails!,
year: '2019',
make: 'Subaru',
model: 'Outback',
style: '4 door station wagon',
vin: '4S4BSENC4K3221004',
vehicleLookupType: VehicleLookupType.Vin
},
// Key feature: multiple damaged glasses
vehicleDamage: [
VehicleDamage.WindshieldCrack,
VehicleDamage.DriverFrontDoor,
VehicleDamage.DriverRearDoor,
VehicleDamage.DriverVentGlass,
VehicleDamage.PassengerVentGlass,
VehicleDamage.RearWindow
],
// Override payment details
paymentDetails: {
paymentType: PaymentType.PayAtService,
// Add promo code
promoCode: '20CALL',
},
// Vehicle part questions for multiple glass parts
vehiclePartQuestions: [
{
partQuestionType: PartQuestionType.WindshieldColor,
isOnPage: true,
optionToSelect: 'Green Tint, Blue Shade',
secondaryQuestionOptionToSelect: 'solar, lane departure warning system, heated glass wiper park, high beam assist, soundproofing'
},
{
partQuestionType: PartQuestionType.DriverFrontColor,
isOnPage: true,
optionToSelect: 'Green Tint',
secondaryQuestionOptionToSelect: 'solar, driver side, front, soundproofing, laminated'
},
{
partQuestionType: PartQuestionType.DriverRearColor,
isOnPage: true,
optionToSelect: 'Gray Tint Privacy',
secondaryQuestionOptionToSelect: 'solar, driver side, rear'
},
{
partQuestionType: PartQuestionType.DriverVentColor,
isOnPage: true,
optionToSelect: 'Gray Tint Privacy',
secondaryQuestionOptionToSelect: 'solar, driver side, rear'
},
{
partQuestionType: PartQuestionType.PassengerVentColor,
isOnPage: true,
optionToSelect: 'Gray Tint Privacy',
secondaryQuestionOptionToSelect: 'solar, passenger side, rear'
},
{
partQuestionType: PartQuestionType.RearWindowColor,
isOnPage: true,
optionToSelect: 'Green Tint',
secondaryQuestionOptionToSelect: 'heated glass, solar, antenna, manual liftgate, 1 hole'
}
]
}
const cashReplaceMultiGlassPromoInshopTests: ITestCase[] = [];
const tc = {
name: `CashReplaceMultiGlassPromoInshop`,
tags: ['@E2E','@CashReplaceMultiGlassPromoInshop', '@test_report', '@CASH'],
testData: cashReplaceMultiGlassPromoInshopData
};
cashReplaceMultiGlassPromoInshopTests.push(tc);
export default cashReplaceMultiGlassPromoInshopTests;