Update flows for bailout scenarios

This commit is contained in:
JennyNou 2026-03-30 20:53:20 -04:00
parent 0f363d8262
commit fd98a3b29a

View file

@ -381,13 +381,13 @@ async function runWorkflow(page: Page, testCase: TestCase) {
}
// Destructure data for easy access
const { customerDetails, claimDetails, vehicleDetails, vehicleDamage,
const { customerDetails, claimDetails, vehicleDetails, addressVehicleDetails, vehicleDamage,
appointmentDetails, isSafelite, endorsements,
partQuestions, paymentDetails, isNoComp, isItac, isRecalNotification, isUnverifiedPolicyAfterVehicleLookup,
isRecalWarning, servicePackage, hasOemEndorsement, hasStateLawPopup, otherVehiclesOnPolicy,
isRecalWarning, servicePackage, hasOemEndorsement, hasStateLawPopup, otherVehiclesOnPolicy, isUseVehicleFromAddressLookup,
isSeparateApptsWarning, vehiclePartQuestions, editVehicleDetails, isAddressLookupValidations,
hasMilitaryWarning, capabilityQuestions, isUseVehicleOnPolicy,
isVehicleLookupValidations, isMoldingQuestion, isNonServiceable, isNonServiceableVin } = testCase.testData;
isVehicleLookupValidations, isMoldingQuestion, isNonServiceable, isNonServiceableVin, isRecalVehicle } = testCase.testData;
let { isPolicyFound } = testCase.testData; // Allow isPolicyFound to be re-assigned
@ -399,12 +399,12 @@ async function runWorkflow(page: Page, testCase: TestCase) {
endorsementsPage, vehicleLookupPage, partQuestionsPage, paymentMethodPage,
vehicleLookupAddressPage, vehicleLookupLicensePage, vinLookupPage,
bailoutPage, tpaSearchPage, tpaSubmitPage, tpaConfirmationPage,
vehiclePartQuestionsPage, capabilityQuestionsPage, moldingQuestionsPage, addressLookupPage } = testCase.pages;
vehiclePartQuestionsPage, capabilityQuestionsPage, moldingQuestionsPage, addressLookupPage, addressVehiclesPage } = testCase.pages;
// Destructure bailout flags
const { isVehicleSelectBailout, isTpaNotEnabledBailout,
isAPIErrorBailout, isVehicleLookupBailout, isPriceServiceErrorBailout,
isRequestCallbackBailout, isHeavyTruckVehicleBailout, isCoverageCancelledByUser } = testCase.testData.bailoutFlags || {};
isRequestCallbackBailout, isHeavyTruckVehicleBailout, isCoverageCancelledByUser, isBailoutAfterVinLookup } = testCase.testData.bailoutFlags || {};
const repairTypes: VehicleDamage[] = [
VehicleDamage.WindshieldOneChip,
@ -521,6 +521,12 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await vehicleSelectionPage.nextPage();
});
if (isNonServiceable && isHeavyTruckVehicleBailout && !isBailoutAfterVinLookup) {
await bailoutPage.validateURL(bailoutPage.issPageValue);
await bailoutPage.validateBailoutCode(BailoutCode.HeavyTruckVehicle);
return;
}
await test.step('PolicyHolderDetailsPage >> Enter customer data', async () => {
await policyHolderDetailsPage.validateURL(policyHolderDetailsPage.issPageValue);
await policyHolderDetailsPage.fillCustomerDetails(customerDetails!);
@ -594,14 +600,12 @@ async function runWorkflow(page: Page, testCase: TestCase) {
});
await test.step('Address Vehicles >> Next page', async () => {
await addressLookupPage.nextPage();
await addressVehiclesPage.validateURL(addressVehiclesPage.issPageValue);
await addressVehiclesPage.selectVehicle(addressVehicleDetails!);
await addressVehiclesPage.nextPage();
});
} else {
await test.step('VehicleLookupAddressPage >> Lookup by address: ' + customerDetails!.address.street, async () => {
await vehicleLookupAddressPage.validateURL(vehicleLookupAddressPage.issPageValue);
await vehicleLookupAddressPage.lookupVehicleByAddress(customerDetails!, vehicleDetails!);
await vehicleLookupAddressPage.nextPage();
});
break;
}
break;
case VehicleLookupType.LicensePlateNumber:
@ -623,6 +627,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await test.step('VinLookupPage >> Lookup by VIN: ' + vehicleDetails!.vin!, async () => {
await vinLookupPage.validateURL(vinLookupPage.issPageValue);
await vinLookupPage.enterVin(vehicleDetails!.vin!, isVehicleLookupValidations);
if (isNonServiceableVin) {
await vinLookupPage.handleNonServiceableVin();
return;
@ -662,6 +667,12 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await partQuestionsPage.nextPage();
}
if (isHeavyTruckVehicleBailout && isBailoutAfterVinLookup) {
await bailoutPage.validateURL(bailoutPage.issPageValue);
await bailoutPage.validateBailoutCode(BailoutCode.HeavyTruckVehicle);
return;
}
if (vehiclePartQuestions && vehiclePartQuestions.length > 0) {
await vehiclePartQuestionsPage.validateURL(vehiclePartQuestionsPage.issPageValue);
await vehiclePartQuestionsPage.selectPartQuestionResponses(vehiclePartQuestions);
@ -675,8 +686,8 @@ async function runWorkflow(page: Page, testCase: TestCase) {
});
await test.step('BailoutPage >> User canceled claim on ITAC/No Comp coverage statement', async () => {
await bailoutPage.validateURL(bailoutPage.issPageValue);
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.CoverageCancelledByUser);
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.CoverageCancelledByUser);
await bailoutPage.validateURL(bailoutPage.issPageValue);
});
return;
}
@ -717,8 +728,16 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await coverageStatementPage.handleUnverifiedPolicyAfterVehicleLookupFlow();
}
if (isUseVehicleFromAddressLookup) {
await coverageStatementPage.handleUnverifiedPolicyAfterVehicleLookupFlow();
}
});
// If No-Comp or ITAC, ProviderPreferencePage does not appear
if (!isNoComp && !isItac) {
if (hasStateLawPopup) {
await test.step('ProviderPreferencePage >> Dismiss state law popup', async () => {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
@ -730,12 +749,42 @@ async function runWorkflow(page: Page, testCase: TestCase) {
});
}
if (!isPolicyFound || !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup) {
await test.step('ProviderPreferencePage >> Select Provider ' + isSafelite ? "Safelite" : "Other shops(Non-Safelite)", async () => {
if (isPolicyFound && isSafelite) {
await test.step('ProviderPreferencePage >> Select Safelite provider', async () => {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
await providerPreferencePage.selectProvider(isSafelite);
});
}
if (isPolicyFound && !isSafelite && isRecalVehicle) {
await test.step('ProviderPreferencePage >> Select Safelite provider', async () => {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
await providerPreferencePage.scheduleTPAWithAdas();
});
}
if (!isPolicyFound && !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup && !isTpaNotEnabledBailout) {
if (isSafelite) {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
await providerPreferencePage.selectProvider(isSafelite);
});
}
if (!isSafelite && isTpaNotEnabledBailout) {
await providerPreferencePage.scheduleTPAWithoutAdas();
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
await bailoutPage.validateURL(bailoutPage.issPageValue);
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
return;
});
return;
}
if (!isSafelite && !isTpaNotEnabledBailout) {
await providerPreferencePage.scheduleTPAWithoutAdas();
}
}
if (isSafelite && isUnverifiedPolicyAfterVehicleLookup) {
@ -752,7 +801,8 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await providerPreferencePage.scheduleTPAWithoutAdas();
});
}
// If No-Comp or ITAC, ProviderPreferencePage does not appear
}
if (!isPolicyFound || !(isItac || isNoComp) || isUnverifiedPolicyAfterVehicleLookup) {
@ -766,6 +816,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
});
return;
}
if (isTpaNotEnabledBailout) {
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
await bailoutPage.validateURL(bailoutPage.issPageValue);
@ -775,6 +826,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
return;
}
if (!isSafelite && !isTpaNotEnabledBailout) {
await test.step('TpaSearchPage >> TPA Search', async () => {
await tpaSearchPage.validateURL(tpaSearchPage.issPageValue);
await tpaSearchPage.selectFirstLocation();
@ -783,11 +835,8 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await test.step('TpaSubmitPage >> TPA Submit', async () => {
await tpaSubmitPage.validateURL(tpaSubmitPage.issPageValue);
if (!isUnverifiedPolicyAfterVehicleLookup) {
await tpaSubmitPage.validateDeductible(claimDetails!);
} else {
await tpaSubmitPage.validateDeductible(claimDetails!, isUnverifiedPolicyAfterVehicleLookup!, isPolicyFound!);
await tpaSubmitPage.nextPage();
}
});
await test.step('TpaConfirmationPage >> TPA Confirmation', async () => {
@ -797,6 +846,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
});
return;
}}
}
await test.step('SchedulePage >> Select day and time', async () => {
await schedulePage.validateURL(schedulePage.issPageValue);