Fixed some failing tests, some tweaks to url validation

Extending URL validation timeout and adding some more logging/stepping
to better see what is happening during tests
This commit is contained in:
Alex Humphries 2025-03-07 11:01:59 -05:00
parent 16ce5ad0e4
commit b935cf0efa
4 changed files with 23 additions and 18 deletions

View file

@ -141,7 +141,8 @@ export enum BailoutCode {
HeavyTruckVehicle,
NoPartsAvailable,
PartsServiceError,
SafeliteNotTheProvider
SafeliteNotTheProvider,
VehicleYMMSLookupError
}
export enum SignatureAlgorithm {

View file

@ -116,21 +116,25 @@ export class BasePage {
}
async validateURL(url: string) {
let failCount = 0;
/*
We can't assume that the URL has already changed when we get here, but the point of this
is to help speed up tests, so we want to move on as soon as we can if this passes, but
without waiting too long if it fails
*/
while(failCount < 10) {
await this.page.waitForTimeout(1000);
const currentUrl = this.page.url();
if(currentUrl == url)
break;
else {
failCount++;
await test.step(`Validating URL:${url}`, async () => {
let failCount = 0;
/*
We can't assume that the URL has already changed when we get here, but the point of this
is to help speed up tests, so we want to move on as soon as we can if this passes, but
without waiting too long if it fails
*/
while(failCount < 15) {
await this.page.waitForTimeout(1000);
const currentUrl = this.page.url();
console.log(`Current URL: ${currentUrl}`)
if(currentUrl == url)
break;
else {
failCount++;
}
}
}
expect(failCount).not.toEqual(10);
expect(failCount).not.toEqual(15);
});
}
}

View file

@ -8,7 +8,7 @@ export class VehicleLookupAddressPage extends BasePage {
readonly page: Page;
readonly addressForm: AddressForm;
readonly vehicleSelectionForm: VehicleSelectionForm;
url = process.env['BASE_URL']! + '/?issPage=address-vehicles';
url = process.env['BASE_URL']! + '/?issPage=address-lookup';
constructor(page: Page) {
super(page);

View file

@ -436,7 +436,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
if (isVehicleLookupBailout) {
await test.step('BailoutPage >> Vehicle Lookup Bailout', async () => {
await bailoutPage.validateURL(bailoutPage.url);
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.VehicleLookupError);
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.VehicleYMMSLookupError);
});
return;
}