Adds test and support for split windshield replacements
Adds a new test case for cash replacements of split windshields. Normalizes "SPLIT WINDSHIELD" types to "WINDSHIELD" in the parts array to ensure correct part validation during order processing. Extends the `vehicleDamage` enum to include `DriverSplitWindshield` and `PassengerSplitWindshield`.
This commit is contained in:
parent
54a8036a0d
commit
89274929cb
4 changed files with 98 additions and 6 deletions
|
|
@ -101,6 +101,8 @@ export enum PartQuestionType {
|
||||||
RearWindowColor = 'Rear-Stationary',
|
RearWindowColor = 'Rear-Stationary',
|
||||||
RearSlidingWindowColor = 'Rear-Slider',
|
RearSlidingWindowColor = 'Rear-Slider',
|
||||||
DriverSideColor = 'Driver-SideDoor',
|
DriverSideColor = 'Driver-SideDoor',
|
||||||
|
DriverWindshield = 'Windshield-Driver',
|
||||||
|
PassengerWindshield = 'Windshield-Passenger',
|
||||||
// use generalized tag for other part questions
|
// use generalized tag for other part questions
|
||||||
GeneralQuestion1 = 'question-0-1',
|
GeneralQuestion1 = 'question-0-1',
|
||||||
GeneralQuestion2 = 'question-0-2',
|
GeneralQuestion2 = 'question-0-2',
|
||||||
|
|
|
||||||
|
|
@ -156,10 +156,20 @@ export class ServicePackagesPage extends BasePage {
|
||||||
|
|
||||||
// Validate the presence of specific parts in the glassParts array
|
// Validate the presence of specific parts in the glassParts array
|
||||||
const glassParts = vuexState.order?.lineItems?.glassParts;
|
const glassParts = vuexState.order?.lineItems?.glassParts;
|
||||||
|
|
||||||
|
const WINDSHIELD_TYPES = [
|
||||||
|
"SINGLE WINDSHIELD",
|
||||||
|
"DRIVER SPLIT WINDSHIELD",
|
||||||
|
"PASSENGER SPLIT WINDSHIELD"
|
||||||
|
];
|
||||||
|
|
||||||
if (glassParts?.length > 0) {
|
if (glassParts?.length > 0) {
|
||||||
for (const partType of vehicleDamage) {
|
for (const partType of vehicleDamage) {
|
||||||
const hasPartType = glassParts.some(glassPart => glassPart.partType === partType);
|
// Normalize part type to "WINDSHIELD" if it matches any of the defined types (Split Windshield types)
|
||||||
|
const normalizedPartType = WINDSHIELD_TYPES.includes(partType) ? "WINDSHIELD" : partType;
|
||||||
|
|
||||||
|
const hasPartType = glassParts.some(glassPart => glassPart.partType === normalizedPartType);
|
||||||
|
|
||||||
await expect(hasPartType, `Expected part type: ${partType}`).toBe(true);
|
await expect(hasPartType, `Expected part type: ${partType}`).toBe(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile";
|
||||||
import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp";
|
import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp";
|
||||||
import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified";
|
import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified";
|
||||||
import insuranceUnverifiedTests from "./InsuranceUnverified";
|
import insuranceUnverifiedTests from "./InsuranceUnverified";
|
||||||
|
import CashReplaceSplitWindshieldTests from "./CashReplaceSplitWindshield";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Master Test Runner
|
* Master Test Runner
|
||||||
|
|
@ -69,11 +70,12 @@ const allStandardTests = [
|
||||||
{name: "CashReplaceVinMobile", tests: cashReplaceVinMobileTests},
|
{name: "CashReplaceVinMobile", tests: cashReplaceVinMobileTests},
|
||||||
{name: "CashReplaceWiperDropoff", tests: cashReplaceWiperDropoffTests},
|
{name: "CashReplaceWiperDropoff", tests: cashReplaceWiperDropoffTests},
|
||||||
{name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests},
|
{name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests},
|
||||||
|
{name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests},
|
||||||
|
{name: "CashReplaceSplitWindshield", tests: CashReplaceSplitWindshieldTests},
|
||||||
{name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests},
|
{name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests},
|
||||||
{name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests},
|
{name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests},
|
||||||
{name: "InsuranceNoCompProgressive", tests: insuranceNoCompProgressiveTests},
|
{name: "InsuranceNoCompProgressive", tests: insuranceNoCompProgressiveTests},
|
||||||
{name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests},
|
// {name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests},
|
||||||
{name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests},
|
|
||||||
{name: "InsuranceUnverified", tests: insuranceUnverifiedTests},
|
{name: "InsuranceUnverified", tests: insuranceUnverifiedTests},
|
||||||
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
||||||
// {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests}
|
// {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests}
|
||||||
|
|
@ -170,10 +172,13 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
} = testCase.testData;
|
} = testCase.testData;
|
||||||
|
|
||||||
// Check if the vehicle damage includes a windshield crack
|
// Check if the vehicle damage includes a windshield crack
|
||||||
const hasWindshieldCrack = vehicleDamage!.some(damage =>
|
const hasWindshieldCrack = vehicleDamage!.some(damage =>
|
||||||
damage === VehicleDamage.WindshieldCrack
|
damage === VehicleDamage.WindshieldCrack ||
|
||||||
|
damage === VehicleDamage.DriverSplitWindshield ||
|
||||||
|
damage === VehicleDamage.PassengerSplitWindshield
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//============================= TEST WORKFLOW STEPS =============================
|
//============================= TEST WORKFLOW STEPS =============================
|
||||||
|
|
||||||
// Use Environment Variable to decide whether or not we want to skip content site aka home page
|
// Use Environment Variable to decide whether or not we want to skip content site aka home page
|
||||||
|
|
@ -276,6 +281,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
// Select service location
|
// Select service location
|
||||||
let serviceLocationPage = testCase.pages.serviceLocationPage;
|
let serviceLocationPage = testCase.pages.serviceLocationPage;
|
||||||
await serviceLocationPage.handleServiceLocationPage(testCase.testData);
|
await serviceLocationPage.handleServiceLocationPage(testCase.testData);
|
||||||
|
|
||||||
|
|
||||||
// Schedule appointment
|
// Schedule appointment
|
||||||
let schedulePage = testCase.pages.schedulePage;
|
let schedulePage = testCase.pages.schedulePage;
|
||||||
|
|
|
||||||
74
playwright-tests/tests/CashReplaceSplitWindshield.ts
Normal file
74
playwright-tests/tests/CashReplaceSplitWindshield.ts
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
//Imports here
|
||||||
|
import { ITestData } from "@business-logic/types/ITestData"
|
||||||
|
import { AppointmentType, PartQuestionType, PaymentType, VehicleDamage } from "@business-logic/types/Enums";
|
||||||
|
import TestCase from "@business-logic/types/TestCase";
|
||||||
|
import { VehicleLookupType } from "@business-logic/types/Enums";
|
||||||
|
import { getDefaultTestData, setFakerSeedFromTestName } from "@business-logic/constants/DefaultTestData";
|
||||||
|
|
||||||
|
// Set the seed before generating any data
|
||||||
|
setFakerSeedFromTestName("CashReplaceSplitWindshield.ts");
|
||||||
|
|
||||||
|
// Now get the test data with the seeded faker
|
||||||
|
const CashReplaceSplitWindshieldData: Partial<ITestData> = {
|
||||||
|
...getDefaultTestData(), // Get default data with current seed
|
||||||
|
|
||||||
|
isHeavyTruck: true, // Flag for big truck
|
||||||
|
|
||||||
|
customerDetails: {
|
||||||
|
...getDefaultTestData().customerDetails!,
|
||||||
|
address: {
|
||||||
|
...getDefaultTestData().customerDetails!.address,
|
||||||
|
postalCode: '55414'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Override vehicle details
|
||||||
|
vehicleDetails: {
|
||||||
|
...getDefaultTestData().vehicleDetails!,
|
||||||
|
year: '2006',
|
||||||
|
make: 'Navistar',
|
||||||
|
model: '5000 I',
|
||||||
|
style: '2 door conventional cab',
|
||||||
|
vehicleLookupType: VehicleLookupType.Zip
|
||||||
|
},
|
||||||
|
|
||||||
|
vehiclePartQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.DriverWindshield,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'Green Tint',
|
||||||
|
secondaryQuestionOptionToSelect: 'driver side, encap, asymmetrically strengthen'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.PassengerWindshield,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'Green Tint',
|
||||||
|
secondaryQuestionOptionToSelect: 'passenger side, encap, asymmetrically strengthen'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
// Override default vehicle damage (Split Windshield)
|
||||||
|
vehicleDamage: [VehicleDamage.DriverSplitWindshield, VehicleDamage.PassengerSplitWindshield],
|
||||||
|
|
||||||
|
// Override appointment details
|
||||||
|
appointmentDetails: {
|
||||||
|
...getDefaultTestData().appointmentDetails!,
|
||||||
|
shopAddress: "504 Malcolm Ave Se, Minneapolis, MN 55414"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Override payment details
|
||||||
|
paymentDetails: {
|
||||||
|
paymentType: PaymentType.PayAtService
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const CashReplaceSplitWindshieldTests: TestCase[] = [];
|
||||||
|
|
||||||
|
const tc = new TestCase({
|
||||||
|
name: `CashReplaceSplitWindshield`,
|
||||||
|
tags: ['@E2E','@CashReplaceSplitWindshield', '@test_report', '@CASH'],
|
||||||
|
testData: CashReplaceSplitWindshieldData
|
||||||
|
}, undefined, 'CashReplaceSplitWindshield');
|
||||||
|
CashReplaceSplitWindshieldTests.push(tc);
|
||||||
|
|
||||||
|
export default CashReplaceSplitWindshieldTests;
|
||||||
Loading…
Reference in a new issue