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

83 lines
No EOL
2.5 KiB
TypeScript

//Imports here
import { ITestData } from 'framework/TestData'
import { ServicePackage, ServiceLocation, 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 based on test name for consistent but unique data
setFakerSeedFromTestName("CashReplaceWiperDropoff");
// Now get the test data with the seeded faker
const cashReplaceWiperDropoffData: Partial<ITestData> = {
...getDefaultTestData(), // Get default data with current seed
// CASH Client
paymentMethod: PaymentMethod.SelfPay,
// Key feature: Standard package which includes wipers
servicePackage: ServicePackage.Standard,
// Special flags
isSkipEstimatePage: true,
isRecalVehicle: true,
// Override customer postal code
customerDetails: {
...getDefaultTestData().customerDetails!,
address: {
...getDefaultTestData().customerDetails!.address,
postalCode: '43085'
}
},
// Override vehicle details - 2023 Audi A8
vehicleDetails: {
...getDefaultTestData().vehicleDetails!,
year: '2023',
make: 'Audi',
model: 'A8',
style: '4 door sedan',
vin: 'WAULDAF81PN003021',
vehicleLookupType: VehicleLookupType.Zip
},
// No need to override vehicleDamage as it already defaults to WindshieldCrack
// Override for drop-off service
appointmentDetails: {
serviceLocation: ServiceLocation.DropOff,
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
},
// Payment at service
paymentDetails: {
paymentType: PaymentType.PayAtService
},
// Part questions related to recalibration
partQuestions: [
{
partQuestionType: PartQuestionType.GeneralQuestion1,
isOnPage: true,
optionToSelect: 'Yes'
},
{
partQuestionType: PartQuestionType.GeneralQuestion2,
isOnPage: false,
optionToSelect: 'Yes'
},
]
}
const cashReplaceWiperDropoffTests: ITestCase[] = [];
const tc = {
name: `CashReplaceWiperDropoff`,
tags: ['@E2E','@CashReplaceWiperDropoff', '@test_report', '@CASH'],
testData: cashReplaceWiperDropoffData
};
cashReplaceWiperDropoffTests.push(tc);
export default cashReplaceWiperDropoffTests;