diff --git a/playwright-tests/framework/TestData.ts b/playwright-tests/framework/TestData.ts index 332e3dc26..0fe04a1f9 100644 --- a/playwright-tests/framework/TestData.ts +++ b/playwright-tests/framework/TestData.ts @@ -15,6 +15,7 @@ export interface ITestData extends base { isMSRZip?: boolean, isPIAEnabled?: boolean, isDualRecal?: boolean, + isPolicyInfoPage?: boolean, } diff --git a/playwright-tests/pages/PolicyInfoPage.ts b/playwright-tests/pages/PolicyInfoPage.ts index 22b6c07e7..7974e3099 100644 --- a/playwright-tests/pages/PolicyInfoPage.ts +++ b/playwright-tests/pages/PolicyInfoPage.ts @@ -1,4 +1,4 @@ -import { type Page } from '@playwright/test'; +import { expect, type Page } from '@playwright/test'; import { BasePage } from './BasePage'; import { step } from 'framework/localTypes/Step'; import { ITestData } from 'framework/TestData'; @@ -12,6 +12,7 @@ export class PolicyInfoPage extends BasePage { @step("PolicyInfoPage >> Continue") async handlePolicyInfoPage(testData: Partial): Promise { - await this.nextPage(); + + await expect(this.page).toHaveURL(/\/fmg\/policy-info/); } } diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index 79cfc89f8..9eed669b4 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -44,6 +44,7 @@ import insuranceBigTruckVerifiedTests from "./InsuranceBigTruckVerified"; import insuranceUnverifiedTests from "./InsuranceUnverified"; import CashReplaceSplitWindshieldTests from "./CashReplaceSplitWindshield"; import insuranceMeemicNearSchoolVerifiedTests from "./InsuranceMeemicNearSchoolVerified"; +import insuranceLibertyMutualTests from "./InsuranceLibertyMutual"; import cashReplaceDualMobileMSRTests from "./CashReplaceDualMobileMSR"; import cashReplaceDualNonMSRInshopTests from "./CashReplaceDualNonMSRInshop"; @@ -101,6 +102,7 @@ const allStandardTests = [ // {name: "InsuranceGeico", tests: insuranceGeicoTests}, // {name: "InsuranceITACOptimizedPriceValidationAllState", tests: insuranceITACOptimizedPriceValidationAllStateTests} { name: "InsuranceMeemicNearSchoolVerified", tests: insuranceMeemicNearSchoolVerifiedTests }, + { name: "InsuranceLibertyMutual", tests: insuranceLibertyMutualTests }, ]; @@ -308,6 +310,7 @@ async function runWorkflow(page: Page, testCase: TestCase) { // Insurance flow - if user selected Insurance as Payment Method if (paymentMethod == PaymentMethod.Insurance) { await handleInsuranceFlow(testCase); + if (testCase.testData.isPolicyInfoPage) return; // If Liberty Mutual and on PolicyInfoPage, skip the rest of the flow until the page is built out } //============================= SERVICE SCHEDULING ============================= @@ -364,6 +367,13 @@ async function handleInsuranceFlow(testCase: TestCase) { await HeritageProblemGlassQuestionsPage.handleHeritageProblemGlassQuestionsPage(testCase.testData); } + // Liberty Mutual route directly to PolicyInfoPage instead of CCPolicyInfoPage + if (testCase.testData.isPolicyInfoPage) { + let policyInfoPage = testCase.pages.policyInfoPage; + await policyInfoPage.handlePolicyInfoPage(testCase.testData); + return; + } + // Handle ccPolicyInfoPage let ccPolicyInfoPage = testCase.pages.ccPolicyInfoPage; await ccPolicyInfoPage.handleCCPolicyInfoPage(testCase.testData); diff --git a/playwright-tests/tests/InsuranceLibertyMutual.ts b/playwright-tests/tests/InsuranceLibertyMutual.ts new file mode 100644 index 000000000..0c89d6084 --- /dev/null +++ b/playwright-tests/tests/InsuranceLibertyMutual.ts @@ -0,0 +1,54 @@ +import { ITestData, getDefaultExperimentsData } from 'framework/TestData' +import { DamageType, VehicleLookupType, VehicleDamage } from 'safelite-playwright-core'; +import { PaymentMethod } from "framework/localTypes/Enums"; +import { ITestCase } from '../framework/Typedefs' +import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core'; + +setFakerSeedFromTestName("InsuranceLibertyMutual"); + +const insuranceLibertyMutualData: Partial = { + ...getDefaultTestData(), + + paymentMethod: PaymentMethod.Insurance, + isPolicyInfoPage: true, + + claimDetails: { + client: 'Liberty Mutual Insurance', + policyNumber: 'Mock123456LM', + 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.Hail + }, + + // Vehicle details for truck with ZIP lookup + vehicleDetails: { + ...getDefaultTestData().vehicleDetails!, + year: '2015', + make: 'Toyota', + model: 'Tacoma Pickup', + style: '4 door crew cab', + vehicleLookupType: VehicleLookupType.Zip, + }, + + // Driver door damage instead of windshield + vehicleDamage: [ + VehicleDamage.DriverFrontDoor, + ], + + paymentDetails: {}, + + experiments: { + ...getDefaultExperimentsData() + } +}; + +const insuranceLibertyMutualTests: ITestCase[] = []; + +const tc = { + name: `InsuranceLibertyMutual`, + tags: ['@E2E', '@InsuranceLibertyMutual', '@test_report', '@Insurance'], + testData: insuranceLibertyMutualData +}; +insuranceLibertyMutualTests.push(tc); + +export default insuranceLibertyMutualTests;