commit
bb6f2b3cdc
4 changed files with 106 additions and 7 deletions
|
|
@ -35,4 +35,5 @@ export interface ITestData {
|
||||||
promoCode: string,
|
promoCode: string,
|
||||||
policyZip: string,
|
policyZip: string,
|
||||||
isPolicyUnverified: boolean
|
isPolicyUnverified: boolean
|
||||||
|
isCashToInsurance: boolean
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ export class OrderConfirmationPage extends BasePage {
|
||||||
|
|
||||||
async validateOrderConfirmationPage(testData: Partial<ITestData>) {
|
async validateOrderConfirmationPage(testData: Partial<ITestData>) {
|
||||||
// Destructure data we use
|
// Destructure data we use
|
||||||
const { vehicleDetails, customerDetails, servicePackage, promoCode,
|
const { vehicleDetails, customerDetails, servicePackage, promoCode, isCashToInsurance: isCashInsuranceFlow,
|
||||||
isPolicyFound, claimDetails, paymentDetails, isUseVehicleOnPolicy, paymentMethod, isPolicyUnverified } = testData;
|
isPolicyFound, claimDetails, paymentDetails, isUseVehicleOnPolicy, paymentMethod, isPolicyUnverified } = testData;
|
||||||
await this.serviceText.waitFor({ state: "visible" });
|
await this.serviceText.waitFor({ state: "visible" });
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ export class OrderConfirmationPage extends BasePage {
|
||||||
const servicePackageAmt = Number.parseFloat(servicePackageValue!.split('$')[1].replaceAll(',', ''));
|
const servicePackageAmt = Number.parseFloat(servicePackageValue!.split('$')[1].replaceAll(',', ''));
|
||||||
|
|
||||||
// General Validations
|
// General Validations
|
||||||
expect.soft(emailTextValue).toContain(customerDetails!.email);
|
expect.soft(emailTextValue?.toLowerCase()).toContain(customerDetails!.email);
|
||||||
|
|
||||||
// Service package validations
|
// Service package validations
|
||||||
await expect.soft(this.cartServicePackageText).toContainText(`${servicePackage}`)
|
await expect.soft(this.cartServicePackageText).toContainText(`${servicePackage}`)
|
||||||
|
|
@ -91,14 +91,14 @@ export class OrderConfirmationPage extends BasePage {
|
||||||
expect.soft(subtotalAmt).toBeGreaterThan(0);
|
expect.soft(subtotalAmt).toBeGreaterThan(0);
|
||||||
// expect.soft(deductibleAmt).toEqual(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
|
// Verify amount due > 0
|
||||||
expect.soft(amountDueAmt).toBeGreaterThan(0);
|
expect.soft(amountDueAmt).toBeGreaterThan(0);
|
||||||
expect.soft(finalAmountDueAmt).toBeGreaterThan(0);
|
expect.soft(finalAmountDueAmt).toBeGreaterThan(0);
|
||||||
|
|
||||||
if (isPolicyUnverified && PaymentType.PayWithInsurance){
|
if (isPolicyUnverified && PaymentType.PayWithInsurance){
|
||||||
expect.soft(finalAmountDueAmt).toContain('Verifying coverage')
|
expect.soft(finalAmountDueAmt).toContain('Verifying coverage')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Verify amount due 0
|
// Verify amount due 0
|
||||||
expect.soft(amountDueAmt).toEqual(0);
|
expect.soft(amountDueAmt).toEqual(0);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import cashRepairInShopAfterPayTests from "./CashRepairInShopAfterPay";
|
||||||
import cashRepairInShopPayPalTests from "./CashRepairInShopPayPal";
|
import cashRepairInShopPayPalTests from "./CashRepairInShopPayPal";
|
||||||
import cashReplaceMultiSlidingGlassDropoffTests from "./CashReplaceMultiSlidingGlassDropoff";
|
import cashReplaceMultiSlidingGlassDropoffTests from "./CashReplaceMultiSlidingGlassDropoff";
|
||||||
import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile";
|
import cashReplaceMultiGlassMobileTests from "./CashReplaceMultiGlassMobile";
|
||||||
|
import cashReplaceSwitchToInsuranceProgressiveNoCompTests from "./CashReplaceSwitchToInsuranceProgressiveNoComp";
|
||||||
import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified";
|
import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified";
|
||||||
import insuranceUnverifiedTests from "./InsuranceUnverified";
|
import insuranceUnverifiedTests from "./InsuranceUnverified";
|
||||||
|
|
||||||
|
|
@ -69,6 +70,7 @@ const allStandardTests = [
|
||||||
{name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests},
|
{name: "CashReplaceWiperPromoInshop", tests: cashReplaceWiperPromoInShopTests},
|
||||||
{name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests},
|
{name: "InsuranceAcuityPaypal", tests: insuranceAcuityPaypalTests},
|
||||||
{name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests},
|
{name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests},
|
||||||
|
{name: "CashReplaceSwitchToInsuranceProgressiveNoComp", tests: cashReplaceSwitchToInsuranceProgressiveNoCompTests},
|
||||||
{name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests},
|
{name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests},
|
||||||
{name: "InsuranceUnverified", tests: insuranceUnverifiedTests},
|
{name: "InsuranceUnverified", tests: insuranceUnverifiedTests},
|
||||||
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
||||||
|
|
@ -300,7 +302,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function handleInsuranceFlow(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
|
// Check if the insurance policy has endorsements
|
||||||
const hasEndorsements = endorsements && endorsements.length > 0;
|
const hasEndorsements = endorsements && endorsements.length > 0;
|
||||||
|
|
@ -353,4 +355,20 @@ export async function handleInsuranceFlow(testCase: TestCase) {
|
||||||
//handle coveraage statement page
|
//handle coveraage statement page
|
||||||
let coverageStatementPage = testCase.pages.coverageStatementPage;
|
let coverageStatementPage = testCase.pages.coverageStatementPage;
|
||||||
await coverageStatementPage.handleCoverageStatementPage(testCase.testData);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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(),
|
||||||
|
|
||||||
|
isCashToInsurance: 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;
|
||||||
Loading…
Reference in a new issue