From ef1efe0fe0a5fd783c508f36e1192613f575206c Mon Sep 17 00:00:00 2001 From: gc-carlin Date: Thu, 29 May 2025 16:59:17 -0400 Subject: [PATCH 1/4] Cash switch to insurance - needs fixing --- ...placeSwitchToInsuranceProgressiveNoComp.ts | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts diff --git a/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts b/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts new file mode 100644 index 000000000..8b7f2a2e3 --- /dev/null +++ b/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts @@ -0,0 +1,67 @@ +//Imports here +import { ITestData } from "@business-logic/types/ITestData"; +import { PaymentMethod, AppointmentType, DamageType, VehicleLookupType, PaymentType } from "@business-logic/types/Enums"; +import TestCase from "@business-logic/types/TestCase"; +import { getDefaultTestData, setFakerSeedFromTestName } from "@business-logic/constants/DefaultTestData"; + +// Set the seed for consistent data generation +setFakerSeedFromTestName("CashReplaceSwitchToInsuranceProgressiveNoComp"); + +// Define insurance test data for Progressive +const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial = { + ...getDefaultTestData(), + + // Override customer details based on provided ZIP code + customerDetails: { + ...getDefaultTestData().customerDetails!, + address: { + ...getDefaultTestData().customerDetails!.address, + postalCode: "70458", + }, + }, + + // Vehicle details for a 2012 Chrysler 300 + vehicleDetails: { + ...getDefaultTestData().vehicleDetails!, + year: "2015", + make: "Acura", + model: "MDX", + style: "4 door utility", + vehicleLookupType: VehicleLookupType.Vin, + }, + + // Override payment details + paymentDetails: { + paymentType: PaymentType.PayWithInsurance, // Ensures insurance payment method is selected + }, + + // Insurance claim details + claimDetails: { + client: "Progressive", + policyNumber: "Mock495646B", + policyDeductible: 0, + damageDate: new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }), + damageCause: DamageType.Rock, + }, + + // Override appointment details for in-shop service + appointmentDetails: { + serviceLocation: AppointmentType.InShop, + shopAddress: "8985 Yellow Brick Rd, Rosedale, MD 21237", + appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate, + }, + + +}; + +// Create and register the test case +const cashReplaceSwitchToInsuranceProgressiveNoCompTests: TestCase[] = []; + +const tc = new TestCase({ + name: `CashReplaceSwitchToInsuranceProgressiveNoComp`, + tags: ["@E2E", "@CashReplaceSwitchToInsuranceProgressiveNoComp", "@test_report", "@Insurance"], + testData: cashReplaceSwitchToInsuranceProgressiveNoCompData, +}, undefined, "CashReplaceSwitchToInsuranceProgressiveNoComp"); +cashReplaceSwitchToInsuranceProgressiveNoCompTests.push(tc); + +export default cashReplaceSwitchToInsuranceProgressiveNoCompTests; From cf4b9539ef3e4abb97335e01ee2fe85a2b3b7e1a Mon Sep 17 00:00:00 2001 From: gc-carlin Date: Wed, 18 Jun 2025 13:48:02 -0400 Subject: [PATCH 2/4] adding test to master --- playwright-tests/tests/0000__M.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index b51c8dd5e..0076f61bd 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -31,7 +31,7 @@ import cashRepairInShopAfterPayTests from "./CashRepairInShopAfterPay"; import cashRepairInShopPayPalTests from "./CashRepairInShopPayPal"; import cashReplaceMultiSlidingGlassDropoffTests from "./CashReplaceMultiSlidingGlassDropoff"; import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile"; - +import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp" /** * Master Test Runner * @@ -67,6 +67,7 @@ const allStandardTests = [ {name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests}, {name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests}, {name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests}, + {name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests}, // {name: "InsuranceGeico", tests: insuranceGeicoTests}, // {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests} From 26e3f9c61f8ce40c1002a79e4071e2b2758d7b8c Mon Sep 17 00:00:00 2001 From: gc-carlin Date: Wed, 18 Jun 2025 16:05:54 -0400 Subject: [PATCH 3/4] cashToInsurance final logic for after ins flow --- .../business-logic/types/ITestData.ts | 1 + .../pages/OrderConfirmationPage.ts | 12 +++---- playwright-tests/tests/0000__M.test.ts | 18 ++++++++++- ...placeSwitchToInsuranceProgressiveNoComp.ts | 31 +++++++++++++------ 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/playwright-tests/business-logic/types/ITestData.ts b/playwright-tests/business-logic/types/ITestData.ts index 61ed18128..72c6758fd 100644 --- a/playwright-tests/business-logic/types/ITestData.ts +++ b/playwright-tests/business-logic/types/ITestData.ts @@ -35,4 +35,5 @@ export interface ITestData { promoCode: string, policyZip: string, isPolicyUnverified: boolean + isCashToInsurance: boolean } \ No newline at end of file diff --git a/playwright-tests/pages/OrderConfirmationPage.ts b/playwright-tests/pages/OrderConfirmationPage.ts index 489ed1678..64348fea4 100644 --- a/playwright-tests/pages/OrderConfirmationPage.ts +++ b/playwright-tests/pages/OrderConfirmationPage.ts @@ -43,7 +43,7 @@ export class OrderConfirmationPage extends BasePage { async validateOrderConfirmationPage(testData: Partial) { // Destructure data we use - const { vehicleDetails, customerDetails, servicePackage, promoCode, + const { vehicleDetails, customerDetails, servicePackage, promoCode, isCashToInsurance: isCashInsuranceFlow, isPolicyFound, claimDetails, paymentDetails, isUseVehicleOnPolicy, paymentMethod, isPolicyUnverified } = testData; await this.serviceText.waitFor({ state: "visible" }); @@ -61,7 +61,7 @@ export class OrderConfirmationPage extends BasePage { const servicePackageAmt = Number.parseFloat(servicePackageValue!.split('$')[1].replaceAll(',', '')); // General Validations - expect.soft(emailTextValue).toContain(customerDetails!.email); + expect.soft(emailTextValue?.toLowerCase()).toContain(customerDetails!.email); // Service package validations await expect.soft(this.cartServicePackageText).toContainText(`${servicePackage}`) @@ -91,14 +91,14 @@ export class OrderConfirmationPage extends BasePage { expect.soft(subtotalAmt).toBeGreaterThan(0); // expect.soft(deductibleAmt).toEqual(0); - if (paymentDetails!.paymentType === PaymentType.PayAtService && (servicePackageAmt > 0)) { + if ((paymentDetails!.paymentType === PaymentType.PayAtService || isCashInsuranceFlow) && (servicePackageAmt > 0)) { // Verify amount due > 0 expect.soft(amountDueAmt).toBeGreaterThan(0); expect.soft(finalAmountDueAmt).toBeGreaterThan(0); - if (isPolicyUnverified && PaymentType.PayWithInsurance){ - expect.soft(finalAmountDueAmt).toContain('Verifying coverage') - } + if (isPolicyUnverified && PaymentType.PayWithInsurance){ + expect.soft(finalAmountDueAmt).toContain('Verifying coverage') + } } else { // Verify amount due 0 expect.soft(amountDueAmt).toEqual(0); diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index 8deb2535b..e62fdeeb4 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -302,7 +302,7 @@ async function runWorkflow(page: Page, testCase: TestCase) { } export async function handleInsuranceFlow(testCase: TestCase) { - const { isPolicyFound, isPolicyDriver, endorsements, isRecalVehicle } = testCase.testData; + const { isPolicyFound, isPolicyDriver, endorsements, isRecalVehicle, isCashToInsurance: isCashInsuranceFlow } = testCase.testData; // Check if the insurance policy has endorsements const hasEndorsements = endorsements && endorsements.length > 0; @@ -355,4 +355,20 @@ export async function handleInsuranceFlow(testCase: TestCase) { //handle coveraage statement page let coverageStatementPage = testCase.pages.coverageStatementPage; await coverageStatementPage.handleCoverageStatementPage(testCase.testData); + + if (isCashInsuranceFlow) { + let serviceLocationPage = testCase.pages.serviceLocationPage; + await serviceLocationPage.nextPage(); + + //schedule + let schedulePage = testCase.pages.schedulePage; + await schedulePage.nextPage(); + //customer dertails + let contactDetailsPage = testCase.pages.contactDetailsPage; + await contactDetailsPage.nextPage(); + + //paymentmethods + let paymentMethodPage = testCase.pages.paymentMethodPage; + await paymentMethodPage.nextPage(); + } } \ No newline at end of file diff --git a/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts b/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts index 8b7f2a2e3..542f7e601 100644 --- a/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts +++ b/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts @@ -1,6 +1,6 @@ //Imports here import { ITestData } from "@business-logic/types/ITestData"; -import { PaymentMethod, AppointmentType, DamageType, VehicleLookupType, PaymentType } from "@business-logic/types/Enums"; +import { PaymentMethod, AppointmentType, DamageType, PartQuestionType, PaymentType } from "@business-logic/types/Enums"; import TestCase from "@business-logic/types/TestCase"; import { getDefaultTestData, setFakerSeedFromTestName } from "@business-logic/constants/DefaultTestData"; @@ -11,6 +11,8 @@ setFakerSeedFromTestName("CashReplaceSwitchToInsuranceProgressiveNoComp"); const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial = { ...getDefaultTestData(), + isCashToInsurance: true, + // Override customer details based on provided ZIP code customerDetails: { ...getDefaultTestData().customerDetails!, @@ -23,13 +25,20 @@ const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial = { // Vehicle details for a 2012 Chrysler 300 vehicleDetails: { ...getDefaultTestData().vehicleDetails!, - year: "2015", - make: "Acura", - model: "MDX", - style: "4 door utility", - vehicleLookupType: VehicleLookupType.Vin, + year: "2012", + make: "Chrysler", + model: "300", + style: "4 door sedan" }, + partQuestions: [ + { + partQuestionType: PartQuestionType.GeneralQuestion1, + isOnPage: true, + optionToSelect: 'Yes' + }, + ], + // Override payment details paymentDetails: { paymentType: PaymentType.PayWithInsurance, // Ensures insurance payment method is selected @@ -44,13 +53,17 @@ const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial = { damageCause: DamageType.Rock, }, - // Override appointment details for in-shop service + isPolicyFound: true, + isUseVehicleOnPolicy: true, + isPolicyDriver: true, + + // Appointment details for in-shop service appointmentDetails: { serviceLocation: AppointmentType.InShop, shopAddress: "8985 Yellow Brick Rd, Rosedale, MD 21237", appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate, }, - + }; @@ -59,7 +72,7 @@ const cashReplaceSwitchToInsuranceProgressiveNoCompTests: TestCase[] = []; const tc = new TestCase({ name: `CashReplaceSwitchToInsuranceProgressiveNoComp`, - tags: ["@E2E", "@CashReplaceSwitchToInsuranceProgressiveNoComp", "@test_report", "@Insurance"], + tags: ["@E2E", "@CashReplaceSwitchToInsuranceProgressiveNoComp", "@test_report", "@CASH"], testData: cashReplaceSwitchToInsuranceProgressiveNoCompData, }, undefined, "CashReplaceSwitchToInsuranceProgressiveNoComp"); cashReplaceSwitchToInsuranceProgressiveNoCompTests.push(tc); From d7566e5d60699fdafcb1c52726ad3ba75a6bc479 Mon Sep 17 00:00:00 2001 From: maguire-arman Date: Thu, 19 Jun 2025 09:20:09 -0400 Subject: [PATCH 4/4] Renames `isCashToInsurance` to `isCashInsuranceFlow` Updates the `isCashToInsurance` property to `isCashInsuranceFlow` for improved clarity and consistency in naming conventions. This change affects test data interfaces and related logic to accurately reflect the cash-to-insurance flow. --- playwright-tests/business-logic/types/ITestData.ts | 2 +- playwright-tests/pages/OrderConfirmationPage.ts | 2 +- playwright-tests/tests/0000__M.test.ts | 4 +++- .../tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/playwright-tests/business-logic/types/ITestData.ts b/playwright-tests/business-logic/types/ITestData.ts index 72c6758fd..945196539 100644 --- a/playwright-tests/business-logic/types/ITestData.ts +++ b/playwright-tests/business-logic/types/ITestData.ts @@ -35,5 +35,5 @@ export interface ITestData { promoCode: string, policyZip: string, isPolicyUnverified: boolean - isCashToInsurance: boolean + isCashInsuranceFlow: boolean } \ No newline at end of file diff --git a/playwright-tests/pages/OrderConfirmationPage.ts b/playwright-tests/pages/OrderConfirmationPage.ts index 64348fea4..ce54d767c 100644 --- a/playwright-tests/pages/OrderConfirmationPage.ts +++ b/playwright-tests/pages/OrderConfirmationPage.ts @@ -43,7 +43,7 @@ export class OrderConfirmationPage extends BasePage { async validateOrderConfirmationPage(testData: Partial) { // Destructure data we use - const { vehicleDetails, customerDetails, servicePackage, promoCode, isCashToInsurance: isCashInsuranceFlow, + const { vehicleDetails, customerDetails, servicePackage, promoCode, isCashInsuranceFlow, isPolicyFound, claimDetails, paymentDetails, isUseVehicleOnPolicy, paymentMethod, isPolicyUnverified } = testData; await this.serviceText.waitFor({ state: "visible" }); diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index e62fdeeb4..419bd227a 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -302,7 +302,7 @@ async function runWorkflow(page: Page, testCase: TestCase) { } export async function handleInsuranceFlow(testCase: TestCase) { - const { isPolicyFound, isPolicyDriver, endorsements, isRecalVehicle, isCashToInsurance: isCashInsuranceFlow } = testCase.testData; + const { isPolicyFound, isPolicyDriver, endorsements, isRecalVehicle, isCashInsuranceFlow } = testCase.testData; // Check if the insurance policy has endorsements const hasEndorsements = endorsements && endorsements.length > 0; @@ -356,6 +356,8 @@ export async function handleInsuranceFlow(testCase: TestCase) { let coverageStatementPage = testCase.pages.coverageStatementPage; await coverageStatementPage.handleCoverageStatementPage(testCase.testData); + // Handle scenario where user selected Cash to Insurance and needs to go back through the flow + // right now we are choosing pay at appointment as payment method for this scenario if (isCashInsuranceFlow) { let serviceLocationPage = testCase.pages.serviceLocationPage; await serviceLocationPage.nextPage(); diff --git a/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts b/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts index 542f7e601..702c09fce 100644 --- a/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts +++ b/playwright-tests/tests/CashReplaceSwitchToInsuranceProgressiveNoComp.ts @@ -11,7 +11,7 @@ setFakerSeedFromTestName("CashReplaceSwitchToInsuranceProgressiveNoComp"); const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial = { ...getDefaultTestData(), - isCashToInsurance: true, + isCashInsuranceFlow: true, // Override customer details based on provided ZIP code customerDetails: {