From 89274929cb2f455fb4bd521db60830cf977bf52d Mon Sep 17 00:00:00 2001 From: maguire-arman Date: Mon, 23 Jun 2025 09:59:47 -0400 Subject: [PATCH] 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`. --- .../business-logic/types/Enums.ts | 2 + playwright-tests/pages/ServicePackagesPage.ts | 14 +++- playwright-tests/tests/0000__M.test.ts | 14 +++- .../tests/CashReplaceSplitWindshield.ts | 74 +++++++++++++++++++ 4 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 playwright-tests/tests/CashReplaceSplitWindshield.ts diff --git a/playwright-tests/business-logic/types/Enums.ts b/playwright-tests/business-logic/types/Enums.ts index 58595528f..d01c7998b 100644 --- a/playwright-tests/business-logic/types/Enums.ts +++ b/playwright-tests/business-logic/types/Enums.ts @@ -101,6 +101,8 @@ export enum PartQuestionType { RearWindowColor = 'Rear-Stationary', RearSlidingWindowColor = 'Rear-Slider', DriverSideColor = 'Driver-SideDoor', + DriverWindshield = 'Windshield-Driver', + PassengerWindshield = 'Windshield-Passenger', // use generalized tag for other part questions GeneralQuestion1 = 'question-0-1', GeneralQuestion2 = 'question-0-2', diff --git a/playwright-tests/pages/ServicePackagesPage.ts b/playwright-tests/pages/ServicePackagesPage.ts index e670ff31b..779d5f6b8 100644 --- a/playwright-tests/pages/ServicePackagesPage.ts +++ b/playwright-tests/pages/ServicePackagesPage.ts @@ -156,10 +156,20 @@ export class ServicePackagesPage extends BasePage { // Validate the presence of specific parts in the glassParts array const glassParts = vuexState.order?.lineItems?.glassParts; - + + const WINDSHIELD_TYPES = [ +   "SINGLE WINDSHIELD", +   "DRIVER SPLIT WINDSHIELD", +   "PASSENGER SPLIT WINDSHIELD" + ]; + if (glassParts?.length > 0) { 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); } } else { diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index 022e23abb..65e7a6986 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -35,6 +35,7 @@ import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile"; import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp"; import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified"; import insuranceUnverifiedTests from "./InsuranceUnverified"; +import CashReplaceSplitWindshieldTests from "./CashReplaceSplitWindshield"; /** * Master Test Runner @@ -69,11 +70,12 @@ const allStandardTests = [ {name: "CashReplaceVinMobile", tests: cashReplaceVinMobileTests}, {name: "CashReplaceWiperDropoff", tests: cashReplaceWiperDropoffTests}, {name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests}, + {name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests}, + {name: "CashReplaceSplitWindshield", tests: CashReplaceSplitWindshieldTests}, {name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests}, {name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests}, {name: "InsuranceNoCompProgressive", tests: insuranceNoCompProgressiveTests}, - {name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests}, - {name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests}, + // {name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests}, {name: "InsuranceUnverified", tests: insuranceUnverifiedTests}, // {name: "InsuranceGeico", tests: insuranceGeicoTests}, // {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests} @@ -170,10 +172,13 @@ async function runWorkflow(page: Page, testCase: TestCase) { } = testCase.testData; // Check if the vehicle damage includes a windshield crack - const hasWindshieldCrack = vehicleDamage!.some(damage => - damage === VehicleDamage.WindshieldCrack + const hasWindshieldCrack = vehicleDamage!.some(damage => + damage === VehicleDamage.WindshieldCrack || + damage === VehicleDamage.DriverSplitWindshield || + damage === VehicleDamage.PassengerSplitWindshield ); + //============================= TEST WORKFLOW STEPS ============================= // 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 let serviceLocationPage = testCase.pages.serviceLocationPage; await serviceLocationPage.handleServiceLocationPage(testCase.testData); + // Schedule appointment let schedulePage = testCase.pages.schedulePage; diff --git a/playwright-tests/tests/CashReplaceSplitWindshield.ts b/playwright-tests/tests/CashReplaceSplitWindshield.ts new file mode 100644 index 000000000..6736af4dc --- /dev/null +++ b/playwright-tests/tests/CashReplaceSplitWindshield.ts @@ -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 = { + ...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; \ No newline at end of file