Added url validation
Changed existing validateURL function on BasePage to WaitForURL, and added a new function for checking the url of the page. Added calls to this function throughout the workflow, on each page change
This commit is contained in:
parent
f324ca1eb1
commit
cf4c4d8585
3 changed files with 51 additions and 4 deletions
|
|
@ -37,7 +37,7 @@ export class BasePage {
|
|||
}).toPass({ timeout: 180_000 });
|
||||
}
|
||||
|
||||
async validateURL(url: string) {
|
||||
async waitForURL(url: string) {
|
||||
await expect(this.pageSpinner).toHaveCount(0, { timeout: 60000 });
|
||||
await this.page.waitForURL(url);
|
||||
}
|
||||
|
|
@ -115,4 +115,8 @@ export class BasePage {
|
|||
|
||||
}
|
||||
|
||||
async validateURL(url: string) {
|
||||
const currentUrl = this.page.url();
|
||||
expect(currentUrl).toEqual(url);
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ export class WelcomePage extends BasePage {
|
|||
|
||||
async goto(clientTag: string) {
|
||||
await this.page.goto(process.env['BASE_URL']! + `/?issPage=entry-page&ClientTag=${clientTag}`);
|
||||
await this.validateURL(this.url);
|
||||
await this.waitForURL(this.url);
|
||||
await this.cookieCloseButton.click();
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ export class WelcomePage extends BasePage {
|
|||
}
|
||||
const result = await getClientSignature(request);
|
||||
await this.page.goto(process.env['BASE_URL']! + `/?issPage=entry-page&ClientTag=${clientTag}&token=${request.token}&signature=${result.signature}`);
|
||||
await this.validateURL(this.url);
|
||||
await this.waitForURL(this.url);
|
||||
await this.logReferralNumber();
|
||||
await this.cookieCloseButton.click();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
// TODO: Dynamic for when we don't care if duplicate page appears
|
||||
|
||||
await test.step('DuplicateCheckPage >> Start New Claim', async () => {
|
||||
await duplicateCheckPage.validateURL(duplicateCheckPage.url);
|
||||
await duplicateCheckPage.startNewClaim();
|
||||
await duplicateCheckPage.nextPage();
|
||||
});
|
||||
|
|
@ -377,6 +378,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (isPolicyFound) {
|
||||
await test.step('PolicyVehiclesPage >> Select vehicle', async () => {
|
||||
await policyVehiclesPage.validateURL(policyVehiclesPage.url);
|
||||
await policyVehiclesPage.logReferralNumber();
|
||||
// Validate other vehicles on policy
|
||||
if (otherVehiclesOnPolicy && otherVehiclesOnPolicy.length > 0) {
|
||||
|
|
@ -398,6 +400,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (isHeavyTruckVehicleBailout) {
|
||||
await test.step('BailoutPage >> Heavy Vehicle Bailout', async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.url);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.HeavyTruckVehicle);
|
||||
});
|
||||
return;
|
||||
|
|
@ -405,6 +408,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (hasEndorsements) {
|
||||
await test.step('EndorsementsPage >> Select Endorsements', async () => {
|
||||
await endorsementsPage.validateURL(endorsementsPage.url);
|
||||
await endorsementsPage.verifyEndorsements(endorsements);
|
||||
await endorsementsPage.selectEndorsements(endorsements);
|
||||
await endorsementsPage.nextPage();
|
||||
|
|
@ -414,6 +418,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
} else {
|
||||
await policyVehiclesPage.logReferralNumber();
|
||||
await test.step('PolicyHolderDetailsPage >> Enter customer data', async () => {
|
||||
await policyHolderDetailsPage.validateURL(policyHolderDetailsPage.url);
|
||||
await policyHolderDetailsPage.fillCustomerDetails(customerDetails!);
|
||||
await policyHolderDetailsPage.nextPage();
|
||||
});
|
||||
|
|
@ -423,12 +428,14 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
}
|
||||
|
||||
await test.step('VehicleDetailsPage >> Select Vehicle', async () => {
|
||||
await vehicleSelectionPage.validateURL(vehicleSelectionPage.url);
|
||||
await vehicleSelectionPage.selectVehicle(vehicleDetails!);
|
||||
await vehicleSelectionPage.nextPage();
|
||||
});
|
||||
|
||||
if (isVehicleLookupBailout) {
|
||||
await test.step('BailoutPage >> Vehicle Lookup Bailout', async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.url);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.VehicleLookupError);
|
||||
});
|
||||
return;
|
||||
|
|
@ -436,6 +443,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (isHeavyTruckVehicleBailout) {
|
||||
await test.step('BailoutPage >> Heavy Vehicle Bailout', async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.url);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.HeavyTruckVehicle);
|
||||
});
|
||||
return;
|
||||
|
|
@ -446,11 +454,13 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
isPolicyFound = false; // Flow proceeds as unverified
|
||||
testCase.testData.isPolicyFound = false;
|
||||
await test.step('VehicleDamagePage >> Click Edit Vehicle', async () => {
|
||||
await vehicleDamagePage.validateURL(vehicleDamagePage.url);
|
||||
await vehicleDamagePage.editVehicleButton.click();
|
||||
});
|
||||
|
||||
await test.step('VehicleDetailsPage >> Select edited vehicle', async () => {
|
||||
await test.step('VehicleDetailsPage >> Select Vehicle', async () => {
|
||||
await vehicleSelectionPage.validateURL(vehicleSelectionPage.url);
|
||||
await vehicleSelectionPage.selectVehicle(editVehicleDetails);
|
||||
await vehicleSelectionPage.nextPage();
|
||||
});
|
||||
|
|
@ -458,6 +468,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
}
|
||||
|
||||
await test.step('VehicleDamagePage >> Select Damage', async () => {
|
||||
await vehicleDamagePage.validateURL(vehicleDamagePage.url);
|
||||
if (isSeparateApptsWarning) {
|
||||
await vehicleDamagePage.checkSeparateApptsWarning();
|
||||
}
|
||||
|
|
@ -467,14 +478,17 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (isPartsServiceErrorBailout) {
|
||||
await test.step('VehicleLookupPage >> Select Lookup Type', async () => {
|
||||
await vehicleLookupPage.validateURL(vehicleLookupPage.url);
|
||||
await vehicleLookupPage.vehicleLookup(vehicleDetails!);
|
||||
});
|
||||
await test.step('VinLookupPage >> Lookup by VIN', async () => {
|
||||
await vinLookupPage.validateURL(vinLookupPage.url);
|
||||
await vinLookupPage.enterVin(vehicleDetails!.vin!);
|
||||
forceAPIError(page, '/parts/api/v1/parts')
|
||||
await vinLookupPage.nextPage();
|
||||
});
|
||||
await test.step('BailoutPage >> Parts Service Error Bailout', async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.url);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.PartsServiceError);
|
||||
return;
|
||||
});
|
||||
|
|
@ -485,11 +499,13 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
|
||||
await test.step('VehicleLookupPage >> Select Lookup Type' + vehicleDetails?.vehicleLookupType, async () => {
|
||||
await vehicleLookupPage.validateURL(vehicleLookupPage.url);
|
||||
await vehicleLookupPage.vehicleLookup(vehicleDetails!);
|
||||
});
|
||||
|
||||
|
||||
if (testCase.testData.isVehicleSelectBailout) {
|
||||
if (isVehicleSelectBailout) {
|
||||
await vinLookupPage.validateURL(vinLookupPage.url);
|
||||
await test.step('Lookup vehicle >> By VIN-' + vehicleDetails!.vin!, async () => {
|
||||
await vinLookupPage.enterVin(vehicleDetails!.vin!);
|
||||
});
|
||||
|
|
@ -507,11 +523,13 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
switch (vehicleDetails!.vehicleLookupType!) {
|
||||
case VehicleLookupType.Address:
|
||||
await test.step('VehicleLookupAddressPage >> Lookup by address: ' + customerDetails!.address.street, async () => {
|
||||
await vehicleLookupAddressPage.validateURL(vehicleLookupAddressPage.url);
|
||||
await vehicleLookupAddressPage.lookupVehicleByAddress(customerDetails!, vehicleDetails!);
|
||||
await vehicleLookupAddressPage.nextPage();
|
||||
});
|
||||
break;
|
||||
case VehicleLookupType.LicensePlateNumber:
|
||||
await vehicleLookupLicensePage.validateURL(vehicleLookupLicensePage.url);
|
||||
if (isVehicleLookupValidations) {
|
||||
await test.step('VehicleLookupLicensePage >> Lookup by license plate: ' + vehicleDetails!.licensePlateNumber, async () => {
|
||||
await vehicleLookupLicensePage.enterPlateDetails(vehicleDetails!, isVehicleLookupValidations);
|
||||
|
|
@ -527,6 +545,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
break;
|
||||
case VehicleLookupType.Vin:
|
||||
await test.step('VinLookupPage >> Lookup by VIN: ' + vehicleDetails!.vin!, async () => {
|
||||
await vinLookupPage.validateURL(vinLookupPage.url);
|
||||
await vinLookupPage.enterVin(vehicleDetails!.vin!, isVehicleLookupValidations);
|
||||
await vinLookupPage.nextPage();
|
||||
});
|
||||
|
|
@ -535,6 +554,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
}
|
||||
if (isMoldingQuestion) {
|
||||
await test.step('Molding Questions Page >> Select Yes', async () => {
|
||||
await moldingQuestionsPage.validateURL(moldingQuestionsPage.url);
|
||||
if (!moldingQuestionsPage) {
|
||||
console.error("moldingQuestionsPage is not initialized");
|
||||
}
|
||||
|
|
@ -543,24 +563,28 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
});
|
||||
}
|
||||
if (capabilityQuestions && capabilityQuestions.length > 0) {
|
||||
await capabilityQuestionsPage.validateURL(capabilityQuestionsPage.url);
|
||||
await capabilityQuestionsPage.validatePartQuestions(capabilityQuestions);
|
||||
await capabilityQuestionsPage.selectPartQuestionResponses(capabilityQuestions);
|
||||
await capabilityQuestionsPage.nextPage();
|
||||
}
|
||||
|
||||
if (partQuestions && partQuestions.length > 0) {
|
||||
await partQuestionsPage.validateURL(partQuestionsPage.url);
|
||||
await partQuestionsPage.validatePartQuestions(partQuestions);
|
||||
await partQuestionsPage.selectPartQuestionResponses(partQuestions);
|
||||
await partQuestionsPage.nextPage();
|
||||
}
|
||||
|
||||
if (vehiclePartQuestions && vehiclePartQuestions.length > 0) {
|
||||
await vehiclePartQuestionsPage.validateURL(vehiclePartQuestionsPage.url);
|
||||
await vehiclePartQuestionsPage.validatePartQuestions(vehiclePartQuestions);
|
||||
await vehiclePartQuestionsPage.selectPartQuestionResponses(vehiclePartQuestions);
|
||||
await vehiclePartQuestionsPage.nextPage();
|
||||
}
|
||||
|
||||
await test.step('CoverageStatementPage >> Next page', async () => {
|
||||
await coverageStatementPage.validateURL(coverageStatementPage.url);
|
||||
// Confirm no coverage
|
||||
if (isPolicyFound && (isItac || isNoComp)) {
|
||||
await coverageStatementPage.continueToScheduleButton.click();
|
||||
|
|
@ -571,6 +595,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (hasStateLawPopup) {
|
||||
await test.step('ProviderPreferencePage >> Dismiss state law popup', async () => {
|
||||
await providerPreferencePage.validateURL(providerPreferencePage.url);
|
||||
await providerPreferencePage.validateStateLawModalIsVisible();
|
||||
await providerPreferencePage.gotItButton.click();
|
||||
});
|
||||
|
|
@ -578,17 +603,20 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (!isPolicyFound || !(isItac || isNoComp)) {
|
||||
await test.step('ProviderPreferencePage >> Select Provider ' + isSafelite ? "Safelite" : "Other shops(Non-Safelite)", async () => {
|
||||
await providerPreferencePage.validateURL(providerPreferencePage.url);
|
||||
await providerPreferencePage.selectProvider(isSafelite);
|
||||
});
|
||||
}
|
||||
|
||||
// validations for Recal warning mesage
|
||||
if (isRecalWarning) {
|
||||
await serviceLocationPage.validateURL(serviceLocationPage.url);
|
||||
await serviceLocationPage.validateRecalWarning();
|
||||
}
|
||||
|
||||
// if isRecalNotifidation flag true additional step to acknowledge Recal notification.
|
||||
if (isRecalNotification) {
|
||||
await providerPreferencePage.validateURL(providerPreferencePage.url);
|
||||
await providerPreferencePage.acknowledgeRecalNotificaiton();
|
||||
}
|
||||
// If No-Comp or ITAC, ProviderPreferencePage does not appear
|
||||
|
|
@ -599,6 +627,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
if (testCase.testData!.clientTag == '05CC1609-3631-4044-B45A-E78E13343B9A') { // Avoiding TPA flow for Federated Insureance due to Defect# SSR-1984 //Temporary fix until Defect# SSR-1984 is addressed.
|
||||
await test.step('***** Performing Safelite flow for Federal Insurance due to defec# SSR-1984 *****', async () => { });
|
||||
await test.step('TpaSearchPage >> TPA Search', async () => {
|
||||
await tpaSearchPage.validateURL(tpaSearchPage.url);
|
||||
await tpaSearchPage.selectFirstLocation();
|
||||
// await tpaSearchPage.nextPage();
|
||||
});
|
||||
|
|
@ -606,6 +635,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
}
|
||||
if (isTpaNotEnabledBailout) {
|
||||
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.url);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
||||
return;
|
||||
});
|
||||
|
|
@ -614,23 +644,28 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (isDoNotSeeMyShopBailout) {
|
||||
await test.step('TpaSearchPage >> Select "Do Not See My Shop"', async () => {
|
||||
await tpaSearchPage.validateURL(tpaSearchPage.url);
|
||||
await tpaSearchPage.selectDoNotSeeMyShop();
|
||||
});
|
||||
await bailoutPage.validateURL(bailoutPage.url);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.DoNotSeeMyShop);
|
||||
return;
|
||||
}
|
||||
|
||||
await test.step('TpaSearchPage >> TPA Search', async () => {
|
||||
await tpaSearchPage.validateURL(tpaSearchPage.url);
|
||||
await tpaSearchPage.selectFirstLocation();
|
||||
await tpaSearchPage.nextPage();
|
||||
});
|
||||
|
||||
await test.step('TpaSubmitPage >> TPA Submit', async () => {
|
||||
// TODO: Validations
|
||||
await tpaSubmitPage.validateURL(tpaSubmitPage.url);
|
||||
await tpaSubmitPage.nextPage();
|
||||
});
|
||||
|
||||
await test.step('TpaConfirmationPage >> TPA Confirmation', async () => {
|
||||
await tpaConfirmationPage.validateURL(tpaConfirmationPage.url);
|
||||
await tpaConfirmationPage.validateSuccessMessage();
|
||||
return;
|
||||
});
|
||||
|
|
@ -639,6 +674,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
}
|
||||
|
||||
await test.step('ServiceLocationPage >> Select service location', async () => {
|
||||
await serviceLocationPage.validateURL(serviceLocationPage.url);
|
||||
await serviceLocationPage.selectLocation(appointmentDetails!);
|
||||
if (hasMilitaryWarning) {
|
||||
await expect.soft(serviceLocationPage.militaryWarningMessage).toBeVisible();
|
||||
|
|
@ -647,6 +683,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
});
|
||||
|
||||
await test.step('SchedulePage >> Select day and time', async () => {
|
||||
await schedulePage.validateURL(schedulePage.url);
|
||||
customerDetails!.apptDate = await schedulePage.scheduleFirstAppointment(appointmentDetails!.serviceLocation);
|
||||
});
|
||||
|
||||
|
|
@ -657,6 +694,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
email: customerDetails!.email,
|
||||
phoneNumber: customerDetails!.phoneNumber
|
||||
};
|
||||
await contactDetailsPage.validateURL(contactDetailsPage.url);
|
||||
const actualContactDetails = await contactDetailsPage.getContactDetails();
|
||||
expect.soft(actualContactDetails).toEqual(expectedContactDetails);
|
||||
|
||||
|
|
@ -671,28 +709,33 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
|||
|
||||
if (isPriceServiceErrorBailout) {
|
||||
await test.step('BailoutPage >> Price Service Error Bailout', async () => {
|
||||
await bailoutPage.validateURL(bailoutPage.url);
|
||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.PricingResponseError);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await test.step('ServicePackagesPage >> Choose service package', async () => {
|
||||
await servicePackagesPage.validateURL(servicePackagesPage.url);
|
||||
customerDetails!.packagePrice = await servicePackagesPage.selectServicePackage(servicePackage!);
|
||||
await servicePackagesPage.nextPage();
|
||||
});
|
||||
|
||||
if (isPolicyFound && (isUseVehicleOnPolicy ?? true) && claimDetails!.policyDeductible > 0) {
|
||||
await test.step('PaymentMethodPage >> Execute Payment', async () => {
|
||||
await paymentMethodPage.validateURL(paymentMethodPage.url);
|
||||
await paymentMethodPage.executePayment(paymentDetails!);
|
||||
await paymentMethodPage.nextPage();
|
||||
});
|
||||
} else {
|
||||
await test.step('PaymentMethodPage >> Skip to Order Confirmation', async () => {
|
||||
await paymentMethodPage.validateURL(paymentMethodPage.url);
|
||||
await paymentMethodPage.nextPage();
|
||||
});
|
||||
}
|
||||
|
||||
await test.step('OrderConfirmationPage >> Validate order', async () => {
|
||||
await orderConfirmationPage.validateURL(orderConfirmationPage.url);
|
||||
await orderConfirmationPage.validateOrderConfirmationPage(testCase.testData);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue