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

85 lines
No EOL
2.8 KiB
TypeScript

//Imports here
import { ITestData } from 'framework/TestData'
import { 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 before generating any data
setFakerSeedFromTestName("CashReplaceSafeliteCanNotRecalMobile");
// Now get the test data with the seeded faker
const cashReplaceSafeliteCanNotRecalMobileData: Partial<ITestData> = {
...getDefaultTestData(), // Get default data with current seed
// CASH Client
paymentMethod: PaymentMethod.SelfPay,
// Special flag to skip estimate page
isSkipEstimatePage: true,
// Special flag to verify safelite can not recalibrate in the backend
isCanNotRecal: true,
// Override customer postal code
customerDetails: {
...getDefaultTestData().customerDetails!,
address: {
...getDefaultTestData().customerDetails!.address,
postalCode: '21237'
}
},
// Override vehicle details - vehicle with recalibration that Safelite cannot perform
vehicleDetails: {
...getDefaultTestData().vehicleDetails!,
year: '2009',
make: 'Volkswagen',
model: 'Passat CC',
style: '4 door sedan',
vin: 'VWML73C79E552439',
vehicleLookupType: VehicleLookupType.Zip
},
// No need to override vehicleDamage as it already defaults to WindshieldCrack
// Override for mobile service
appointmentDetails: {
serviceLocation: ServiceLocation.Mobile,
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate,
serviceAddress: {
// Use street address from current faker seed
street: "5050 Silver Oak Dr",
city: 'Rosedale',
state: 'MD',
postalCode: '21237',
country: 'United States'
},
},
// Payment at service
paymentDetails: {
paymentType: PaymentType.PayAtService
},
// Part questions related to recalibration
partQuestions: [
{
partQuestionType: PartQuestionType.GeneralQuestion1,
isOnPage: true,
optionToSelect: 'Yes'
},
]
}
const cashReplaceSafeliteCanNotRecalMobileTests: ITestCase[] = [];
const tc = {
name: `CashReplaceSafeliteCanNotRecalMobile`,
tags: ['@E2E','@CashReplaceSafeliteCanNotRecalMobile', '@test_report', '@CASH'],
testData: cashReplaceSafeliteCanNotRecalMobileData
};
cashReplaceSafeliteCanNotRecalMobileTests.push(tc);
export default cashReplaceSafeliteCanNotRecalMobileTests;