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);