Update flows to fix playwright tests

This commit is contained in:
JennyNou 2026-03-24 11:23:40 -04:00
parent 54c45fddb5
commit 8490a6a290

View file

@ -5,7 +5,7 @@ import { RuleEngine, ValidationOptions } from "@business-logic/types/RuleEngine"
import { ICustomerDetails } from "@business-logic/types/CustomerDetails"; import { ICustomerDetails } from "@business-logic/types/CustomerDetails";
import essentialHpTestCases from "./0016_EssentialRepairInShop"; import essentialHpTestCases from "./0016_EssentialRepairInShop";
import essentialReplaceTestCases from "./0013_EssentialReplace"; import essentialReplaceTestCases from "./0013_EssentialReplace";
import { BailoutCode, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums"; import { BailoutCode, ServiceLocation, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
import essentialTpaNotEnabledTestCases from "./0003_EssentialTpaNotEnabledBailout"; import essentialTpaNotEnabledTestCases from "./0003_EssentialTpaNotEnabledBailout";
import essentialDoNotSeeShopTestCases from "./0011_EssentialDoNotSeeShopBailout"; import essentialDoNotSeeShopTestCases from "./0011_EssentialDoNotSeeShopBailout";
import essentialVehicleNotFoundTestCases from "./0010_EssentialVehicleNotFoundBailout"; import essentialVehicleNotFoundTestCases from "./0010_EssentialVehicleNotFoundBailout";
@ -61,6 +61,7 @@ import advancedScenario0029aTestCases from "./advanced/0029a_HeavyVehicleBailout
import advancedScenario0030aTestCases from "./advanced/0030a_PartsServiceBailout"; import advancedScenario0030aTestCases from "./advanced/0030a_PartsServiceBailout";
import advancedScenario0031aTestCases from "./advanced/0031a_ReplaceServiceableBigTruck"; import advancedScenario0031aTestCases from "./advanced/0031a_ReplaceServiceableBigTruck";
import advancedScenario0032aTestCases from "./advanced/0032a_DeclineNonServiceableBigTruck"; import advancedScenario0032aTestCases from "./advanced/0032a_DeclineNonServiceableBigTruck";
import { getDefaultTestData } from "safelite-playwright-core";
@ -382,8 +383,8 @@ 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, vehicleDamage,
appointmentDetails, isSafelite, endorsements, appointmentDetails, isSafelite, endorsements,
partQuestions, paymentDetails, isNoComp, isItac, isRecalNotification, partQuestions, paymentDetails, isNoComp, isItac, isRecalNotification, isUnverifiedPolicyAfterVehicleLookup,
isRecalWarning, servicePackage, hasStateLawPopup, otherVehiclesOnPolicy, isRecalWarning, servicePackage, hasOemEndorsement, hasStateLawPopup, otherVehiclesOnPolicy,
isSeparateApptsWarning, vehiclePartQuestions, editVehicleDetails, isAddressLookupValidations, isSeparateApptsWarning, vehiclePartQuestions, editVehicleDetails, isAddressLookupValidations,
hasMilitaryWarning, capabilityQuestions, isUseVehicleOnPolicy, hasMilitaryWarning, capabilityQuestions, isUseVehicleOnPolicy,
isVehicleLookupValidations, isMoldingQuestion, isNonServiceable, isNonServiceableVin } = testCase.testData; isVehicleLookupValidations, isMoldingQuestion, isNonServiceable, isNonServiceableVin } = testCase.testData;
@ -401,7 +402,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
vehiclePartQuestionsPage, capabilityQuestionsPage, moldingQuestionsPage, addressLookupPage } = testCase.pages; vehiclePartQuestionsPage, capabilityQuestionsPage, moldingQuestionsPage, addressLookupPage } = testCase.pages;
// Destructure bailout flags // Destructure bailout flags
const { isVehicleSelectBailout, isDoNotSeeMyShopBailout, isTpaNotEnabledBailout, const { isVehicleSelectBailout, isTpaNotEnabledBailout,
isPartsServiceErrorBailout, isVehicleLookupBailout, isPriceServiceErrorBailout, isPartsServiceErrorBailout, isVehicleLookupBailout, isPriceServiceErrorBailout,
isRequestCallbackBailout } = testCase.testData.bailoutFlags || {}; isRequestCallbackBailout } = testCase.testData.bailoutFlags || {};
@ -420,7 +421,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await test.step('WelcomePage >> Populate Customer Details', async () => { await test.step('WelcomePage >> Populate Customer Details', async () => {
await welcomePage.populatePage(customerDetails!, claimDetails!, await welcomePage.hasCityInfo()); await welcomePage.populatePage(customerDetails!, claimDetails!, await welcomePage.hasCityInfo());
await welcomePage.nextPage(); await welcomePage.GetStartedButton.click();
}); });
if (testCase.testData.isDuplicateClaim) { if (testCase.testData.isDuplicateClaim) {
@ -445,26 +446,28 @@ async function runWorkflow(page: Page, testCase: TestCase) {
} }
} }
if (!(isUseVehicleOnPolicy ?? true)) { if (!(isUseVehicleOnPolicy ?? true)) {
await policyVehiclesPage.selectVehicleNotListed(); await policyVehiclesPage.addAnotherVehicle();
await policyVehiclesPage.nextPage(); await policyVehiclesPage.nextPage();
await vehicleSelectionPage.selectVehicle(vehicleDetails!); await vehicleSelectionPage.selectVehicle(vehicleDetails!);
await policyVehiclesPage.nextPage(); await policyVehiclesPage.nextPage();
await test.step('PolicyHolderDetailsPage >> Enter customer data', async () => {
await policyHolderDetailsPage.validateURL(policyHolderDetailsPage.issPageValue);
await policyHolderDetailsPage.fillCustomerDetails(customerDetails!);
await policyHolderDetailsPage.nextPage();
});
} else { } else {
// Select vehicle // Select vehicle
await policyVehiclesPage.selectVehicle(vehicleDetails!); await policyVehiclesPage.selectVehicle(vehicleDetails!);
if (isNonServiceable) { if (isNonServiceable) {
await policyVehiclesPage.assertNonServiceableAlertBehavior(); await policyVehiclesPage.assertNonServiceableAlertBehavior();
return; return;
} }
await policyVehiclesPage.nextPage(); await policyVehiclesPage.nextPage();
} await policyVehiclesPage.logReferralNumber();
});
if (isNonServiceable) { if (hasEndorsements) {
return;
}
if (hasEndorsements) {
await test.step('EndorsementsPage >> Select Endorsements', async () => { await test.step('EndorsementsPage >> Select Endorsements', async () => {
await endorsementsPage.validateURL(endorsementsPage.issPageValue); await endorsementsPage.validateURL(endorsementsPage.issPageValue);
await endorsementsPage.verifyEndorsements(endorsements); await endorsementsPage.verifyEndorsements(endorsements);
@ -472,20 +475,23 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await endorsementsPage.nextPage(); await endorsementsPage.nextPage();
}); });
} }
await test.step('PolicyHolderDetailsPage >> Enter customer data', async () => {
} else { await policyHolderDetailsPage.validateURL(policyHolderDetailsPage.issPageValue);
await policyVehiclesPage.logReferralNumber(); await policyHolderDetailsPage.fillCustomerDetails(customerDetails!);
await test.step('PolicyHolderDetailsPage >> Enter customer data', async () => { await policyHolderDetailsPage.nextPage();
await policyHolderDetailsPage.validateURL(policyHolderDetailsPage.issPageValue);
await policyHolderDetailsPage.fillCustomerDetails(customerDetails!);
await policyHolderDetailsPage.nextPage();
}); });
}
});
if (isNonServiceable) {
return;
}
if (isVehicleLookupBailout) { if (isVehicleLookupBailout) {
forceAPIError(page, '/vehicle/api/v1/vehicle/lookup') forceAPIError(page, '/vehicle/api/v1/vehicle/lookup')
} }
await test.step('VehicleDetailsPage >> Select Vehicle', async () => { /*await test.step('VehicleDetailsPage >> Select Vehicle', async () => {
await vehicleSelectionPage.validateURL(vehicleSelectionPage.issPageValue); await vehicleSelectionPage.validateURL(vehicleSelectionPage.issPageValue);
await vehicleSelectionPage.selectVehicle(vehicleDetails!); await vehicleSelectionPage.selectVehicle(vehicleDetails!);
if (isNonServiceable) { if (isNonServiceable) {
@ -493,7 +499,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
return; return;
} }
await vehicleSelectionPage.nextPage(); await vehicleSelectionPage.nextPage();
}); });*/
if (isNonServiceable) { if (isNonServiceable) {
return; return;
@ -508,20 +514,26 @@ async function runWorkflow(page: Page, testCase: TestCase) {
} }
} }
if (editVehicleDetails) { // Essential flow when policy is not found
isPolicyFound = false; // Flow proceeds as unverified if (isPolicyFound === false) {
testCase.testData.isPolicyFound = false; testCase.testData.isPolicyFound = false;
await test.step('VehicleDamagePage >> Click Edit Vehicle', async () => { /* await test.step('VehicleDamagePage >> Click Edit Vehicle', async () => {
await vehicleDamagePage.validateURL(vehicleDamagePage.issPageValue); await vehicleDamagePage.validateURL(vehicleDamagePage.issPageValue);
await vehicleDamagePage.editVehicleButton.click(); await vehicleDamagePage.editVehicleButton.click();
}); });
*/ // commented out for now because is there an edit vehicle flow?
await test.step('VehicleDetailsPage >> Select edited vehicle', async () => { await test.step('VehicleSelectionPage >> Select vehicle for essential flow', async () => {
await test.step('VehicleDetailsPage >> Select Vehicle', async () => {
await vehicleSelectionPage.validateURL(vehicleSelectionPage.issPageValue); await vehicleSelectionPage.validateURL(vehicleSelectionPage.issPageValue);
await vehicleSelectionPage.selectVehicle(editVehicleDetails); await vehicleSelectionPage.selectVehicle(vehicleDetails!);
await vehicleSelectionPage.nextPage(); await vehicleSelectionPage.nextPage();
}); });
await test.step('PolicyHolderDetailsPage >> Enter customer data', async () => {
await policyHolderDetailsPage.validateURL(policyHolderDetailsPage.issPageValue);
await policyHolderDetailsPage.fillCustomerDetails(customerDetails!);
await policyHolderDetailsPage.nextPage();
}); });
} }
@ -584,10 +596,14 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await test.step('Address Lookup validations >> Vehicle Lookup by address: ' + customerDetails!.address.street, async () => { await test.step('Address Lookup validations >> Vehicle Lookup by address: ' + customerDetails!.address.street, async () => {
if (Array.isArray(vehicleDetails?.address)) { if (Array.isArray(vehicleDetails?.address)) {
await addressLookupPage.validateURL(addressLookupPage.issPageValue); await addressLookupPage.validateURL(addressLookupPage.issPageValue);
await addressLookupPage.validateAddressLookupAlerts(vehicleDetails?.address); await addressLookupPage.validateAddressLookupAlerts(vehicleDetails?.address!);
await addressLookupPage.nextPage(); await addressLookupPage.nextPage();
} }
}); });
await test.step('Address Vehicles >> Next page', async () => {
await addressLookupPage.nextPage();
});
} else { } else {
await test.step('VehicleLookupAddressPage >> Lookup by address: ' + customerDetails!.address.street, async () => { await test.step('VehicleLookupAddressPage >> Lookup by address: ' + customerDetails!.address.street, async () => {
await vehicleLookupAddressPage.validateURL(vehicleLookupAddressPage.issPageValue); await vehicleLookupAddressPage.validateURL(vehicleLookupAddressPage.issPageValue);
@ -627,6 +643,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
break; break;
} }
} }
if (isMoldingQuestion) { if (isMoldingQuestion) {
await test.step('Molding Questions Page >> Select Yes', async () => { await test.step('Molding Questions Page >> Select Yes', async () => {
await moldingQuestionsPage.validateURL(moldingQuestionsPage.issPageValue); await moldingQuestionsPage.validateURL(moldingQuestionsPage.issPageValue);
@ -637,6 +654,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
await moldingQuestionsPage.nextPage(); await moldingQuestionsPage.nextPage();
}); });
} }
if (capabilityQuestions && capabilityQuestions.length > 0) { if (capabilityQuestions && capabilityQuestions.length > 0) {
await capabilityQuestionsPage.validateURL(capabilityQuestionsPage.issPageValue); await capabilityQuestionsPage.validateURL(capabilityQuestionsPage.issPageValue);
await capabilityQuestionsPage.validatePartQuestions(capabilityQuestions); await capabilityQuestionsPage.validatePartQuestions(capabilityQuestions);
@ -645,6 +663,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
} }
if (partQuestions && partQuestions.length > 0) { if (partQuestions && partQuestions.length > 0) {
let partQuestionsPage = testCase.pages.partQuestionsPage;
await partQuestionsPage.validateURL(partQuestionsPage.issPageValue); await partQuestionsPage.validateURL(partQuestionsPage.issPageValue);
await partQuestionsPage.validatePartQuestions(partQuestions); await partQuestionsPage.validatePartQuestions(partQuestions);
await partQuestionsPage.selectPartQuestionResponses(partQuestions); await partQuestionsPage.selectPartQuestionResponses(partQuestions);
@ -653,12 +672,13 @@ async function runWorkflow(page: Page, testCase: TestCase) {
if (vehiclePartQuestions && vehiclePartQuestions.length > 0) { if (vehiclePartQuestions && vehiclePartQuestions.length > 0) {
await vehiclePartQuestionsPage.validateURL(vehiclePartQuestionsPage.issPageValue); await vehiclePartQuestionsPage.validateURL(vehiclePartQuestionsPage.issPageValue);
await vehiclePartQuestionsPage.validatePartQuestions(vehiclePartQuestions); //await vehiclePartQuestionsPage.validatePartQuestions(vehiclePartQuestions);
await vehiclePartQuestionsPage.selectPartQuestionResponses(vehiclePartQuestions); await vehiclePartQuestionsPage.selectPartQuestionResponses(vehiclePartQuestions);
await vehiclePartQuestionsPage.nextPage(); await vehiclePartQuestionsPage.nextPage();
} }
if (isRequestCallbackBailout) { if (isRequestCallbackBailout) {
await test.step('CoverageStatementPage >> Cancel My claim', async () => { await test.step('CoverageStatementPage >> Cancel my claim', async () => {
await coverageStatementPage.validateURL(coverageStatementPage.issPageValue); await coverageStatementPage.validateURL(coverageStatementPage.issPageValue);
await coverageStatementPage.cancelMyClaim(); await coverageStatementPage.cancelMyClaim();
}); });
@ -669,44 +689,95 @@ async function runWorkflow(page: Page, testCase: TestCase) {
}); });
return; return;
} }
await test.step('CoverageStatementPage >> Next page', async () => { await test.step('CoverageStatementPage >> Next page', async () => {
await coverageStatementPage.validateURL(coverageStatementPage.issPageValue); await coverageStatementPage.validateURL(coverageStatementPage.issPageValue);
// Confirm no coverage
if (isPolicyFound && (isItac || isNoComp)) {
await coverageStatementPage.continueToScheduleButton.click();
}
await coverageStatementPage.nextPage(); if (hasOemEndorsement) {
await coverageStatementPage.validateOEMBullet();
}
// For essential/unverified flows
if (!isPolicyFound) {
await coverageStatementPage.handleUnverifiedFlow(claimDetails!);
}
// For No Comp flows
if (isPolicyFound && isNoComp === true) {
await coverageStatementPage.handleNoCompFlow();
}
// For ITAC flows
if (isPolicyFound && isItac === true) {
await coverageStatementPage.handleITACFlow();
}
// For replacements with deductible
if (isPolicyFound && claimDetails?.policyDeductible! > 0 && claimDetails?.policyDeductible !== 9999 && testCase.testData.isUnverifiedPolicyAfterVehicleLookup !== true) {
await coverageStatementPage.handleReplacementWithDeductibleFlow(claimDetails!);
}
// For replacements or repairs with 0 deductible
if (isPolicyFound && claimDetails?.policyDeductible === 0) {
await coverageStatementPage.handleReplacementOrRepairWithNoDeductibleFlow(claimDetails!, VehicleDamage!);
}
// For unverified policy after vehicle lookup
if (isPolicyFound && testCase.testData.isUnverifiedPolicyAfterVehicleLookup === true) {
await coverageStatementPage.handleUnverifiedPolicyAfterVehicleLookupFlow();
}
}); });
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);
await providerPreferencePage.validateStateLawModalIsVisible(); if (vehicleDamage!.includes(VehicleDamage.WindshieldCrack)) {
await providerPreferencePage.gotItButton.click(); //await providerPreferencePage.validateStateLawModalIsVisible();
}); await providerPreferencePage.stateLawModalOkayButton.click();
} else {
//await providerPreferencePage.validateStateLawRepairModalIsVisible();
await providerPreferencePage.stateLawModalOkayButton.click();
}
});
} }
if (!isPolicyFound || !(isItac || isNoComp)) { if (!isPolicyFound || !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup) {
await test.step('ProviderPreferencePage >> Select Provider ' + isSafelite ? "Safelite" : "Other shops(Non-Safelite)", async () => { await test.step('ProviderPreferencePage >> Select Provider ' + isSafelite ? "Safelite" : "Other shops(Non-Safelite)", async () => {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue); await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
await providerPreferencePage.selectProvider(isSafelite); await providerPreferencePage.selectProvider(isSafelite);
}); });
} }
// validations for Recal warning mesage if (isSafelite && isUnverifiedPolicyAfterVehicleLookup) {
if (isRecalWarning) { await test.step('ProviderPreferencePage >> Select Provider ' + isSafelite ? "Safelite" : "Other shops(Non-Safelite)", async () => {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
await providerPreferencePage.selectProvider(isSafelite);
});
}
// validations for Recal warning mesage on schedule page
// commented out for now will add back in to validate recal banner on schedule page
/*if (isRecalWarning) {
await serviceLocationPage.validateURL(serviceLocationPage.issPageValue); await serviceLocationPage.validateURL(serviceLocationPage.issPageValue);
await serviceLocationPage.validateRecalWarning(); await serviceLocationPage.validateRecalWarning();
} }*/
// if isRecalNotifidation flag true additional step to acknowledge Recal notification. // if isRecalNotifidation flag true additional step to acknowledge Recal notification.
if (isRecalNotification) { if (isRecalNotification) {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue); await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
await providerPreferencePage.acknowledgeRecalNotificaiton(); //await providerPreferencePage.acknowledgeRecalNotificaiton();
}
if (!isSafelite && isUnverifiedPolicyAfterVehicleLookup) {
await test.step('ProviderPreferencePage >> Schedule TPA without Adas', async () => {
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
await providerPreferencePage.scheduleTPAWithoutAdas();
});
} }
// If No-Comp or ITAC, ProviderPreferencePage does not appear // If No-Comp or ITAC, ProviderPreferencePage does not appear
if (!isPolicyFound || !(isItac || isNoComp)) { if (!isPolicyFound || !(isItac || isNoComp) || isUnverifiedPolicyAfterVehicleLookup) {
if (!isSafelite) { if (!isSafelite) {
@ -728,16 +799,6 @@ async function runWorkflow(page: Page, testCase: TestCase) {
return; return;
} }
if (isDoNotSeeMyShopBailout) {
await test.step('TpaSearchPage >> Select "Do Not See My Shop"', async () => {
await tpaSearchPage.validateURL(tpaSearchPage.issPageValue);
await tpaSearchPage.selectDoNotSeeMyShop();
});
await bailoutPage.validateURL(bailoutPage.issPageValue);
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.DoNotSeeMyShop);
return;
}
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();
@ -745,9 +806,13 @@ async function runWorkflow(page: Page, testCase: TestCase) {
}); });
await test.step('TpaSubmitPage >> TPA Submit', async () => { await test.step('TpaSubmitPage >> TPA Submit', async () => {
// TODO: Validations
await tpaSubmitPage.validateURL(tpaSubmitPage.issPageValue); await tpaSubmitPage.validateURL(tpaSubmitPage.issPageValue);
//await tpaSubmitPage.validateRecalAlert();
if (!isUnverifiedPolicyAfterVehicleLookup) {
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 () => {
@ -756,43 +821,42 @@ async function runWorkflow(page: Page, testCase: TestCase) {
return; return;
}); });
return; return;
} }}
}
await test.step('ServiceLocationPage >> Select service location', async () => {
await serviceLocationPage.validateURL(serviceLocationPage.issPageValue);
await serviceLocationPage.selectLocation(appointmentDetails!);
if (hasMilitaryWarning) {
await expect.soft(serviceLocationPage.militaryWarningMessage).toBeVisible();
}
await serviceLocationPage.nextPage();
});
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);
customerDetails!.apptDate = await schedulePage.scheduleFirstAppointment(appointmentDetails!.serviceLocation);
});
await test.step('ContactDetailsPage >> Validate contact details', async () => { if (appointmentDetails?.serviceLocation === ServiceLocation.Mobile) {
const expectedContactDetails: Partial<ICustomerDetails> = { await schedulePage.scheduleMobile(appointmentDetails);
firstName: customerDetails!.firstName,
lastName: customerDetails!.lastName,
email: customerDetails!.email,
phoneNumber: customerDetails!.phoneNumber
};
await contactDetailsPage.validateURL(contactDetailsPage.issPageValue);
const actualContactDetails = await contactDetailsPage.getContactDetails();
expect.soft(actualContactDetails).toEqual(expectedContactDetails);
await contactDetailsPage.fillNotes(customerDetails!.notes);
if (isPriceServiceErrorBailout) {
forceAPIError(page, '/price/api/v1/price/combined-quote');
} }
await contactDetailsPage.nextPage(); if (appointmentDetails?.serviceLocation === ServiceLocation.InShop || appointmentDetails?.serviceLocation === ServiceLocation.DropOff) {
await schedulePage.scheduleInShop(appointmentDetails);
}
}); });
await test.step('ServicePackagesPage >> Choose service package', async () => {
await servicePackagesPage.validateURL(servicePackagesPage.issPageValue);
await servicePackagesPage.selectServicePackage(servicePackage!);
});
if (appointmentDetails?.serviceLocation === ServiceLocation.Mobile) {
await test.step('ContactDetailsPage >> Validate contact details', async () => {
await contactDetailsPage.validateURL(contactDetailsPage.issPageValue);
await contactDetailsPage.fillContactDetails(customerDetails!);
//await contactDetailsPage.validateAlertsAreVisible();
//await contactDetailsPage.fillNotes(customerDetails!.notes!);
await contactDetailsPage.nextPage();
});
/* if (isPriceServiceErrorBailout) {
forceAPIError(page, '/price/api/v1/price/combined-quote');
}*/
}
if (isPriceServiceErrorBailout) { if (isPriceServiceErrorBailout) {
await test.step('BailoutPage >> Price Service Error Bailout', async () => { await test.step('BailoutPage >> Price Service Error Bailout', async () => {
await bailoutPage.validateURL(bailoutPage.issPageValue); await bailoutPage.validateURL(bailoutPage.issPageValue);
@ -801,22 +865,29 @@ async function runWorkflow(page: Page, testCase: TestCase) {
return; return;
} }
await test.step('ServicePackagesPage >> Choose service package', async () => {
await servicePackagesPage.validateURL(servicePackagesPage.issPageValue);
customerDetails!.packagePrice = await servicePackagesPage.selectServicePackage(servicePackage!);
await servicePackagesPage.nextPage();
});
if (isPolicyFound && (isUseVehicleOnPolicy ?? true) && claimDetails!.policyDeductible > 0) { if (isPolicyFound && (isUseVehicleOnPolicy ?? true) && claimDetails!.policyDeductible > 0) {
await test.step('PaymentMethodPage >> Execute Payment', async () => { await test.step('PaymentMethodPage >> Execute Payment', async () => {
await paymentMethodPage.validateURL(paymentMethodPage.issPageValue); await paymentMethodPage.validateURL(paymentMethodPage.issPageValue);
await paymentMethodPage.executePayment(paymentDetails!); await paymentMethodPage.executePayment(paymentDetails!, claimDetails!, servicePackage!);
await paymentMethodPage.nextPage(); await paymentMethodPage.nextPage();
}); });
} else { } else {
await test.step('PaymentMethodPage >> Skip to Order Confirmation', async () => { await test.step('PaymentMethodPage >> Skip to Order Confirmation', async () => {
await paymentMethodPage.validateURL(paymentMethodPage.issPageValue); await paymentMethodPage.validateURL(paymentMethodPage.issPageValue);
await paymentMethodPage.nextPage();
if (isPolicyFound && (isUseVehicleOnPolicy ?? true) && claimDetails!.policyDeductible === 0) {
await paymentMethodPage.submitOrderWithoutPIA();
}
if (!isPolicyFound) {
await paymentMethodPage.submitOrderWithoutPIA();
}
if (isPolicyFound && testCase.testData.isUnverifiedPolicyAfterVehicleLookup === true) {
await paymentMethodPage.submitOrderWithoutPIA();
}
}); });
} }