From c49228220dc049dc789a1edaadcf3248999f74e9 Mon Sep 17 00:00:00 2001 From: maguire-arman Date: Tue, 20 May 2025 10:42:49 -0400 Subject: [PATCH] Adds support for heavy truck insurance flow Adds a new test case for a big truck insurance flow. This includes updating the test data to include a flag for heavy trucks and the zip code. Renames `isHeavyTruckVehicle` to `isHeavyTruckVehicleAlert` for clarity. --- .../business-logic/types/IAlertFlags.ts | 2 +- .../business-logic/types/ITestData.ts | 1 + .../pages/VehicleSelectionPage.ts | 12 ++- playwright-tests/tests/0000__M.test.ts | 2 + .../tests/BigTruckInsuranceVerifiedFlow.ts | 80 +++++++++++++++++++ .../alert-validation/alert0001_HeavyTruck.ts | 2 +- 6 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 playwright-tests/tests/BigTruckInsuranceVerifiedFlow.ts diff --git a/playwright-tests/business-logic/types/IAlertFlags.ts b/playwright-tests/business-logic/types/IAlertFlags.ts index b13f30bbc..7943ed6be 100644 --- a/playwright-tests/business-logic/types/IAlertFlags.ts +++ b/playwright-tests/business-logic/types/IAlertFlags.ts @@ -1,5 +1,5 @@ export default interface IAlertFlags { - isHeavyTruckVehicle?: boolean, + isHeavyTruckVehicleAlert?: boolean, isRepairReplace?: boolean, isSplitWindshield?: boolean, isRepairOnly?: boolean, diff --git a/playwright-tests/business-logic/types/ITestData.ts b/playwright-tests/business-logic/types/ITestData.ts index 76d0e4534..dab74efcf 100644 --- a/playwright-tests/business-logic/types/ITestData.ts +++ b/playwright-tests/business-logic/types/ITestData.ts @@ -29,6 +29,7 @@ export interface ITestData { endorsements: IEndorsementDetails[], hasOemEndorsement: boolean, // OEM Endorsement does not appear on endorsements page, so it has a separate flag.s skipEstimatePage: boolean, + isHeavyTruck: boolean, isRecalVehicle: boolean, canNotRecal: boolean, dynamicRecal: boolean, diff --git a/playwright-tests/pages/VehicleSelectionPage.ts b/playwright-tests/pages/VehicleSelectionPage.ts index f554639a5..6e78cfe6d 100644 --- a/playwright-tests/pages/VehicleSelectionPage.ts +++ b/playwright-tests/pages/VehicleSelectionPage.ts @@ -11,6 +11,7 @@ export class VehicleSelectionPage extends BasePage { readonly makeDropdown: Locator; readonly modelDropdown: Locator; readonly styleDropdown: Locator; + readonly zipCodeTextBox: Locator; readonly discontinuedServiceAlert: Locator; url = process.env['BASE_URL']! + '/fmg/?fmgPage=vehicle'; @@ -22,6 +23,7 @@ export class VehicleSelectionPage extends BasePage { this.makeDropdown = this.page.locator('#makeQuestionField'); this.modelDropdown = this.page.locator('#modelQuestionField'); this.styleDropdown = this.page.locator('#styleQuestionField'); + this.zipCodeTextBox = this.page.getByRole('textbox', { name: 'Zip code' }); this.discontinuedServiceAlert = this.page.locator('.alert-danger.widget-name-AlertNoServiceWidget'); // this.validateURL(this.url); } @@ -48,13 +50,17 @@ export class VehicleSelectionPage extends BasePage { @step("VehicleSelectionPage >> Select Vehicle: ") async handleVehicleSelectionPage(testData: Partial) { await this.validateProgressBar("4"); - const { vehicleDetails } = testData; - const { isHeavyTruckVehicle, isSplitWindshield } = testData.alertFlags || {}; + const { vehicleDetails, isHeavyTruck, customerDetails } = testData; + const { isHeavyTruckVehicleAlert, isSplitWindshield } = testData.alertFlags || {}; await this.selectVehicle(vehicleDetails!); + + if (isHeavyTruck) { + await this.zipCodeTextBox.fill(customerDetails?.address.postalCode!); + } // Handle alert conditions for vehicle selection - if (isHeavyTruckVehicle || isSplitWindshield) { + if (isHeavyTruckVehicleAlert || isSplitWindshield) { await this.checkForAlertMessages(); throw new TestSuccessAlert('Both assertions are met successfully.'); } diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index b51c8dd5e..d504bf24e 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -31,6 +31,7 @@ import cashRepairInShopAfterPayTests from "./CashRepairInShopAfterPay"; import cashRepairInShopPayPalTests from "./CashRepairInShopPayPal"; import cashReplaceMultiSlidingGlassDropoffTests from "./CashReplaceMultiSlidingGlassDropoff"; import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile"; +import insuranceBigTruckVerifiedTests from "./BigTruckInsuranceVerifiedFlow"; /** * Master Test Runner @@ -67,6 +68,7 @@ const allStandardTests = [ {name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests}, {name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests}, {name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests}, + {name: "BigTruckInsuranceVerifiedFlow", tests: insuranceBigTruckVerifiedTests}, // {name: "InsuranceGeico", tests: insuranceGeicoTests}, // {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests} diff --git a/playwright-tests/tests/BigTruckInsuranceVerifiedFlow.ts b/playwright-tests/tests/BigTruckInsuranceVerifiedFlow.ts new file mode 100644 index 000000000..a97e64912 --- /dev/null +++ b/playwright-tests/tests/BigTruckInsuranceVerifiedFlow.ts @@ -0,0 +1,80 @@ +//Imports here +import { ITestData } from "@business-logic/types/ITestData" +import { PaymentMethod, AppointmentType, DamageType, PaymentType } 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 based on test name for consistent but unique data +setFakerSeedFromTestName("InsuranceBigTruckVerified"); + +// Now get the test data with the seeded faker +const insuranceBigTruckVerifiedData: Partial = { + ...getDefaultTestData(), // Get default data with current seed + + // Key feature: Insurance flow with GEICO + paymentMethod: PaymentMethod.Insurance, + + // Insurance claim flags + isDuplicateClaim: true, + isPolicyFound: true, + isUseVehicleOnPolicy: true, + isHeavyTruck: true, + + // Override customer details with specific name and California location + customerDetails: { + ...getDefaultTestData().customerDetails!, + firstName: 'Big', + lastName: 'Truck', + address: { + ...getDefaultTestData().customerDetails!.address, + city: 'Ontario', + state: 'California', + postalCode: '55414' + } + }, + + + // Insurance claim details + claimDetails: { + client: 'USAA', + policyNumber: 'Mock900040BigTruck', + policyDeductible: 2000.00, + damageDate: new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-US', {month: '2-digit', day: '2-digit', year: 'numeric'}), + damageCause: DamageType.Rock + }, + + // Hyundai vehicle details with VIN lookup + vehicleDetails: { + ...getDefaultTestData().vehicleDetails!, + year: '2025', + make: 'Peterbilt', + model: '579', + style: 'conventional cab', + vin: '1XPBDP9X6SD693446', + vehicleLookupType: VehicleLookupType.Vin, + }, + + // No need to override vehicleDamage as it already defaults to WindshieldCrack + + // Override for in-shop appointment + appointmentDetails: { + serviceLocation: AppointmentType.InShop, + shopAddress: '504 Malcolm Ave SE, Minneapolis, MN 55414', + appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate + }, + + // Override payment details (empty because we skip payment method page in insurance flow) + paymentDetails: {} +} + +const insuranceBigTruckVerifiedTests: TestCase[] = []; + +const tc = new TestCase({ + name: `InsuranceBigTruckVerified`, + tags: ['@E2E','@InsuranceBigTruckVerified', '@test_report', '@Insurance'], + testData: insuranceBigTruckVerifiedData +}, undefined, 'InsuranceBigTruckVerified'); +insuranceBigTruckVerifiedTests.push(tc); + +export default insuranceBigTruckVerifiedTests; \ No newline at end of file diff --git a/playwright-tests/tests/alert-validation/alert0001_HeavyTruck.ts b/playwright-tests/tests/alert-validation/alert0001_HeavyTruck.ts index dad46ecd5..9a881d4e5 100644 --- a/playwright-tests/tests/alert-validation/alert0001_HeavyTruck.ts +++ b/playwright-tests/tests/alert-validation/alert0001_HeavyTruck.ts @@ -18,7 +18,7 @@ const heavyTruckData: Partial = { style: 'conventional cab' }, alertFlags: { - isHeavyTruckVehicle: true + isHeavyTruckVehicleAlert: true }, vehicleDamage: [ VehicleDamage.WindshieldOneChip,