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