DigitalConsumer.FixMyGlass/playwright-tests/tests/CashReplaceMultiGlassPromoInshop.ts
2026-05-03 12:24:21 -04:00

126 lines
No EOL
4.2 KiB
TypeScript

//Imports here
import { ITestData, getDefaultExperimentsData } 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.Zip
},
// Special flag to skip estimate page
isSkipEstimatePage: true,
// 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',
},
// override part questions
partQuestions: [
{
partQuestionType: PartQuestionType.GeneralQuestion1,
isOnPage: true,
optionToSelect: 'Yes'
}
],
// Vehicle part questions for multiple glass parts
vehiclePartQuestions: [
{
partQuestionType: PartQuestionType.WindshieldColor,
isOnPage: true,
optionToSelect: 'Green Tint, Blue Shade',
secondaryQuestionOptionToSelect: 'solar, lane departure warning system, hwp, 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'
}
],
// Experiments
experiments: {
...getDefaultExperimentsData()
}
}
const cashReplaceMultiGlassPromoInshopTests: ITestCase[] = [];
const tc = {
name: `CashReplaceMultiGlassPromoInshop`,
tags: ['@E2E','@CashReplaceMultiGlassPromoInshop', '@test_report', '@CASH', '@CASH-1182'],
testData: cashReplaceMultiGlassPromoInshopData
};
cashReplaceMultiGlassPromoInshopTests.push(tc);
export default cashReplaceMultiGlassPromoInshopTests;