Add test to cover OEM scenario
This commit is contained in:
parent
cc09011504
commit
a6506db318
6 changed files with 164 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ import { CCPolicyInfoPage } from "../pages/CCPolicyInfoPage"
|
|||
import { DuplicateCheckPage } from "../pages/DuplicateCheckPage"
|
||||
import { PolicyVehiclesPage } from "../pages/PolicyVehiclesPage"
|
||||
import { PolicyInfoSubmittedPage } from "../pages/PolicyInfoSubmittedPage"
|
||||
import { ProblemGlassQuestionsPage } from "../pages/ProblemGlassQuestionsPage"
|
||||
import RecalibrationInfoPage from "../pages/RecalibrationInfoPage"
|
||||
import { CoverageStatementPage } from "../pages/CoverageStatementPage"
|
||||
import { VerifyDetailsPage } from "../pages/VerifyDetailsPage"
|
||||
|
|
@ -48,6 +49,7 @@ export interface ITestPages {
|
|||
paymentMethodPage: PaymentMethodPage,
|
||||
policyInfoSubmittedPage: PolicyInfoSubmittedPage,
|
||||
policyVehiclesPage: PolicyVehiclesPage,
|
||||
problemGlassQuestionsPage: ProblemGlassQuestionsPage,
|
||||
recalibrationInfoPage: RecalibrationInfoPage,
|
||||
schedulePage: SchedulePage,
|
||||
mobileDetailsPage: MobileDetailsPage,
|
||||
|
|
@ -83,6 +85,7 @@ export const createTestPages: TestPagesFactory<ITestPages> = (page: Page) => {
|
|||
paymentMethodPage: new PaymentMethodPage(page),
|
||||
policyInfoSubmittedPage: new PolicyInfoSubmittedPage(page),
|
||||
policyVehiclesPage: new PolicyVehiclesPage(page),
|
||||
problemGlassQuestionsPage: new ProblemGlassQuestionsPage(page),
|
||||
recalibrationInfoPage: new RecalibrationInfoPage(page),
|
||||
schedulePage: new SchedulePage(page),
|
||||
mobileDetailsPage: new MobileDetailsPage(page),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export class OrderConfirmationPage extends BasePage {
|
|||
async validateOrderConfirmationPage(testData: Partial<ITestData>) {
|
||||
// Destructure data we use
|
||||
const { vehicleDetails, customerDetails, servicePackage, isCashInsuranceFlow,
|
||||
isPolicyFound, claimDetails, paymentDetails, isUseVehicleOnPolicy, paymentMethod, isPolicyUnverified } = testData;
|
||||
isPolicyFound, claimDetails, paymentDetails, isUseVehicleOnPolicy, paymentMethod, isPolicyUnverified, isOEM } = testData;
|
||||
await this.serviceText.waitFor({ state: "visible" });
|
||||
|
||||
Soft.expect((await this.getActualAppointmentSummary()).map(item => item.toLowerCase())).toEqual((await this.getExpectedAppointmentSummary(testData)).map(item => item.toLowerCase()));
|
||||
|
|
|
|||
|
|
@ -496,6 +496,22 @@ export class PaymentMethodPage extends BasePage {
|
|||
let updatedAppointmentDate = parsedAppointmentDate.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
|
||||
return updatedAppointmentDate;
|
||||
}
|
||||
|
||||
async validateOEMPart( isOEM: boolean): Promise<void> {
|
||||
if (isOEM == true) {
|
||||
// Get Vuex state from localStorage
|
||||
const vuexState = JSON.parse(await this.page.evaluate('localStorage.getItem(\'vuex\')'));
|
||||
|
||||
// Validate the presence of an OEM part
|
||||
if (vuexState.order?.lineItems?.glassParts?.length > 0) {
|
||||
const firstGlassPartNumber = vuexState.order.lineItems.glassParts[0].partNumber;
|
||||
|
||||
await expect(firstGlassPartNumber.includes("OEM")).toBe(true);
|
||||
} else {
|
||||
throw new Error("No glass parts found in the order");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@step("PaymentMethodPage >> Select Payment Method: ")
|
||||
async handlePaymentMethodPage(testData: Partial<ITestData>) {
|
||||
|
|
@ -504,6 +520,7 @@ export class PaymentMethodPage extends BasePage {
|
|||
await this.validateProgressBar(ProgressBarPercentages.PaymentMethodPage);
|
||||
await this.validatePaymentDetailsPage(testData);
|
||||
await this.ValidateAfterPayBreakOutSection();
|
||||
await this.validateOEMPart(testData.isOEM!);
|
||||
|
||||
// Verify VAPS wipers on backend for standard and premium packages
|
||||
if (servicePackage === ServicePackage.Standard || servicePackage === ServicePackage.Premium) {
|
||||
|
|
|
|||
43
playwright-tests/pages/ProblemGlassQuestionsPage.ts
Normal file
43
playwright-tests/pages/ProblemGlassQuestionsPage.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { expect, type Locator, type Page } from '@playwright/test';
|
||||
import { IClaimDetails, ICustomerDetails } from 'safelite-playwright-core';
|
||||
import { InsuranceBasePage } from './InsuranceBasePage';
|
||||
import { ITestData } from 'framework/TestData';
|
||||
import { step } from 'framework/localTypes/Step';
|
||||
|
||||
export class ProblemGlassQuestionsPage extends InsuranceBasePage {
|
||||
readonly provideVinManuallyButton: Locator;
|
||||
readonly provideLicensePlateButton: Locator;
|
||||
readonly provideHomeAddressButton: Locator;
|
||||
readonly continueOnVinPopUpButton: Locator;
|
||||
readonly dontShareVinButton: Locator;
|
||||
|
||||
readonly yestoGlassQuestionButton: Locator;
|
||||
readonly notoGlassQuestionButton: Locator;
|
||||
readonly continueButton: Locator;
|
||||
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page);
|
||||
|
||||
this.provideVinManuallyButton = page.locator('label[for="VINManually"]');
|
||||
this.provideLicensePlateButton = page.locator('label[for="licensePlate"]');
|
||||
this.provideHomeAddressButton = page.locator('label[for="HomeAddress"]');
|
||||
this.continueOnVinPopUpButton = page.locator('button:has-text("Continue")');
|
||||
this.dontShareVinButton = page.getByRole('button', { name: "I would rather not share my VIN" });
|
||||
|
||||
this.yestoGlassQuestionButton = page.locator('label:has-text("Yes")');
|
||||
this.notoGlassQuestionButton = page.locator('label:has-text("No")');
|
||||
this.continueButton = page.locator('button[type="submit"].btn-success.nav-continue');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@step("ProblemGlassQuestionsPage >> Click continue button and select yes or no for problem glass question")
|
||||
|
||||
async handleproblemGlassQuestionsPage(testData: Partial<ITestData>){
|
||||
|
||||
await this.dontShareVinButton.click();
|
||||
await this.yestoGlassQuestionButton.click();
|
||||
await this.continueButton.click();
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ import insuranceITAC21stCenturyTests from "./InsuranceITAC21stCentury";
|
|||
import insuranceGeicoTests from "./InsuranceGeico";
|
||||
import insuranceITACOptimizedPriceValidationAllStateTests from "./InsuranceITACOptimizedPriceValidationAllState";
|
||||
import insuranceNoCompProgressiveTests from "./InsuranceNoCompProgressive";
|
||||
import insuranceOEMAllstateTests from "./InsuranceOEMAllState";
|
||||
import cashRepairInShopAfterPayTests from "./CashRepairInShopAfterPay";
|
||||
import cashRepairInShopPayPalTests from "./CashRepairInShopPayPal";
|
||||
import cashReplaceMultiSlidingGlassDropoffTests from "./CashReplaceMultiSlidingGlassDropoff";
|
||||
|
|
@ -82,6 +83,7 @@ const allStandardTests = [
|
|||
{name: "InsuranceITAC21stCentury", tests: insuranceITAC21stCenturyTests},
|
||||
{name: "InsuranceNoCompProgressive", tests: insuranceNoCompProgressiveTests},
|
||||
// {name: "InsuranceBigTruckVerified", tests: insuranceBigTruckVerifiedTests},
|
||||
{name: "InsuranceOEMAllstate", tests: insuranceOEMAllstateTests},
|
||||
{name: "InsuranceUnverified", tests: insuranceUnverifiedTests},
|
||||
// {name: "InsuranceGeico", tests: insuranceGeicoTests},
|
||||
// {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests}
|
||||
|
|
@ -323,7 +325,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
}
|
||||
|
||||
export async function handleInsuranceFlow(testCase: TestCase) {
|
||||
const { isPolicyFound, isPolicyDriver, endorsements, isRecalVehicle, isCashInsuranceFlow, flow } = testCase.testData;
|
||||
const { isPolicyFound, isPolicyDriver, endorsements, isRecalVehicle, isCashInsuranceFlow, isOEM, flow } = testCase.testData;
|
||||
|
||||
// Check if the insurance policy has endorsements
|
||||
const hasEndorsements = endorsements && endorsements.length > 0;
|
||||
|
|
@ -332,6 +334,15 @@ export async function handleInsuranceFlow(testCase: TestCase) {
|
|||
let insuranceCompanyPage = testCase.pages.insuranceCompanyPage;
|
||||
await insuranceCompanyPage.handleInsuranceCompanyPage(testCase.testData);
|
||||
|
||||
// Handle OEM scenario
|
||||
if (isOEM) {
|
||||
// User should be on heritage problem glass questions page after selecting Allstate on insurance company page
|
||||
if (testCase.testData.isOEM === true) {
|
||||
let problemGlassQuestionsPage = testCase.pages.problemGlassQuestionsPage;
|
||||
await problemGlassQuestionsPage.handleproblemGlassQuestionsPage(testCase.testData);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle ccPolicyInfoPage
|
||||
let ccPolicyInfoPage = testCase.pages.ccPolicyInfoPage;
|
||||
await ccPolicyInfoPage.handleCCPolicyInfoPage(testCase.testData);
|
||||
|
|
|
|||
88
playwright-tests/tests/InsuranceOEMAllState.ts
Normal file
88
playwright-tests/tests/InsuranceOEMAllState.ts
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
//Imports here
|
||||
import { ITestData } from 'framework/TestData'
|
||||
import { ServiceLocation, DamageType, PaymentType, PartQuestionType } from 'safelite-playwright-core';
|
||||
import { ITestCase } from '../framework/Typedefs'
|
||||
import { PaymentMethod } from "framework/localTypes/Enums";
|
||||
import { VehicleLookupType } from 'safelite-playwright-core';
|
||||
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
|
||||
|
||||
// Set the seed based on test name for consistent but unique data
|
||||
setFakerSeedFromTestName("InsuranceOEMAllstate");
|
||||
|
||||
// Now get the test data with the seeded faker
|
||||
const insuranceOEMAllstateData: Partial<ITestData> = {
|
||||
...getDefaultTestData(), // Get default data with current seed
|
||||
|
||||
// Key feature: Insurance flow with GEICO
|
||||
paymentMethod: PaymentMethod.Insurance,
|
||||
|
||||
// Insurance claim flags
|
||||
isPolicyFound: false,
|
||||
isPolicyUnverified: true,
|
||||
isRecalVehicle: true,
|
||||
isOEM: true,
|
||||
|
||||
// Override customer details with specific name and California location
|
||||
customerDetails: {
|
||||
...getDefaultTestData().customerDetails!,
|
||||
firstName: 'Jane',
|
||||
lastName: 'OEMTest',
|
||||
address: {
|
||||
...getDefaultTestData().customerDetails!.address,
|
||||
city: 'Richmond',
|
||||
state: 'Virginia',
|
||||
postalCode: '23219'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// Insurance claim details
|
||||
claimDetails: {
|
||||
client: 'Allstate',
|
||||
policyNumber: 'MockOEMTest',
|
||||
policyDeductible: "Unverified",
|
||||
policyZip: '43085',
|
||||
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: '2024',
|
||||
make: 'Jeep',
|
||||
model: 'Wrangler',
|
||||
style: '4 door utility',
|
||||
vehicleLookupType: VehicleLookupType.Zip,
|
||||
},
|
||||
|
||||
// Part questions related to recalibration
|
||||
partQuestions: [
|
||||
{
|
||||
partQuestionType: PartQuestionType.GeneralQuestion1,
|
||||
isOnPage: true,
|
||||
optionToSelect: 'Yes'
|
||||
},
|
||||
],
|
||||
|
||||
// Override for in-shop appointment
|
||||
appointmentDetails: {
|
||||
serviceLocation: ServiceLocation.InShop,
|
||||
shopAddress: '5719 Brandt Pike, Dayton, OH 45424',
|
||||
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
|
||||
},
|
||||
|
||||
// Override payment details (empty because we skip payment method page in insurance flow)
|
||||
paymentDetails: {}
|
||||
}
|
||||
|
||||
const insuranceOEMAllstateTests: ITestCase[] = [];
|
||||
|
||||
const tc = {
|
||||
name: `InsuranceOEMAllstate`,
|
||||
tags: ['@E2E','@InsuranceOEMAllstate', '@test_report', '@Insurance'],
|
||||
testData: insuranceOEMAllstateData
|
||||
};
|
||||
insuranceOEMAllstateTests.push(tc);
|
||||
|
||||
export default insuranceOEMAllstateTests;
|
||||
Loading…
Reference in a new issue