diff --git a/playwright-tests/pages/BasePage.ts b/playwright-tests/pages/BasePage.ts index c241c45e..8b881b59 100644 --- a/playwright-tests/pages/BasePage.ts +++ b/playwright-tests/pages/BasePage.ts @@ -116,7 +116,21 @@ export class BasePage { } async validateURL(url: string) { - const currentUrl = this.page.url(); - expect(currentUrl).toEqual(url); + 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++; + } + } + expect(failCount).not.toEqual(10); } } \ No newline at end of file