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