Merge branch 'CASH-631' into CASH-642-latest

This commit is contained in:
maguire-arman 2025-06-19 12:58:28 -04:00 committed by GitHub
commit f3fe504caa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 108 additions and 7 deletions

View file

@ -35,4 +35,5 @@ export interface ITestData {
promoCode: string,
policyZip: string,
isPolicyUnverified: boolean
isCashInsuranceFlow: boolean
}

View file

@ -43,7 +43,7 @@ export class OrderConfirmationPage extends BasePage {
async validateOrderConfirmationPage(testData: Partial<ITestData>) {
// Destructure data we use
const { vehicleDetails, customerDetails, servicePackage, promoCode,
const { vehicleDetails, customerDetails, servicePackage, promoCode, 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);

View file

@ -32,6 +32,7 @@ import cashRepairInShopAfterPayTests from "./CashRepairInShopAfterPay";
import cashRepairInShopPayPalTests from "./CashRepairInShopPayPal";
import cashReplaceMultiSlidingGlassDropoffTests from "./CashReplaceMultiSlidingGlassDropoff";
import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile";
import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp";
import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified";
import insuranceUnverifiedTests from "./InsuranceUnverified";
@ -71,6 +72,7 @@ const allStandardTests = [
{name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests},
{name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests},
{name: "InsuranceNoCompProgressive", tests: insuranceNoCompProgressiveTests},
{name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests},
{name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests},
{name: "InsuranceUnverified", tests: insuranceUnverifiedTests},
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
@ -302,7 +304,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, isCashInsuranceFlow } = testCase.testData;
// Check if the insurance policy has endorsements
const hasEndorsements = endorsements && endorsements.length > 0;
@ -355,4 +357,22 @@ export async function handleInsuranceFlow(testCase: TestCase) {
//handle coveraage statement page
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();
//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();
}
}

View file

@ -0,0 +1,80 @@
//Imports here
import { ITestData } from "@business-logic/types/ITestData";
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";
// Set the seed for consistent data generation
setFakerSeedFromTestName("CashReplaceSwitchToInsuranceProgressiveNoComp");
// Define insurance test data for Progressive
const cashReplaceSwitchToInsuranceProgressiveNoCompData: Partial<ITestData> = {
...getDefaultTestData(),
isCashInsuranceFlow: true,
// 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: "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
},
// 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,
},
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,
},
};
// Create and register the test case
const cashReplaceSwitchToInsuranceProgressiveNoCompTests: TestCase[] = [];
const tc = new TestCase({
name: `CashReplaceSwitchToInsuranceProgressiveNoComp`,
tags: ["@E2E", "@CashReplaceSwitchToInsuranceProgressiveNoComp", "@test_report", "@CASH"],
testData: cashReplaceSwitchToInsuranceProgressiveNoCompData,
}, undefined, "CashReplaceSwitchToInsuranceProgressiveNoComp");
cashReplaceSwitchToInsuranceProgressiveNoCompTests.push(tc);
export default cashReplaceSwitchToInsuranceProgressiveNoCompTests;