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, HeavyTruckVehicle,
NoPartsAvailable, NoPartsAvailable,
PartsServiceError, PartsServiceError,
SafeliteNotTheProvider SafeliteNotTheProvider,
VehicleYMMSLookupError
} }
export enum SignatureAlgorithm { export enum SignatureAlgorithm {

View file

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

View file

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

View file

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