Overhaul validation logic

Now, rather than retrying until we get a correct URL or a timeout, we
check once, then, if the URL is wrong, we wait for a URL change and
check again. (Unless, the current page is a bailout, in which case we
know that the page isn't going to change)
This commit is contained in:
Alex Humphries 2025-03-10 15:43:21 -04:00
parent a974e53bc8
commit 7b017cc218

View file

@ -116,12 +116,22 @@ export class BasePage {
}
async validateURL(issPageValue: string) {
let pass = false;
let currentUrl = this.page.url();
pass = currentUrl.includes(issPageValue);
const isBailout = currentUrl.includes('bailout-page');
if(!pass && !isBailout) {
await this.waitForURLToChange(currentUrl);
currentUrl = this.page.url();
pass = currentUrl.includes(issPageValue);
}
expect(pass).toBeTruthy();
}
async waitForURLToChange(startingUrl: string) {
await expect(async () => {
const currentUrl = this.page.url();
expect(currentUrl).toContain(issPageValue);
}).toPass({
intervals: [1_000],
timeout: 15_000
});
expect(currentUrl).not.toEqual(startingUrl);
}).toPass({ timeout: 180_000 });
}
}