diff --git a/playwright-tests/pages/BasePage.ts b/playwright-tests/pages/BasePage.ts index 2a910b45..e538ee34 100644 --- a/playwright-tests/pages/BasePage.ts +++ b/playwright-tests/pages/BasePage.ts @@ -116,25 +116,12 @@ export class BasePage { } async validateURL(issPageValue: string) { - - await test.step(`Validating page value:${issPageValue}`, 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) { - const currentUrl = this.page.url(); - console.log(`Current URL: ${currentUrl}`) - if(currentUrl.includes(issPageValue)) - break; - else { - failCount++; - } - await this.page.waitForTimeout(1000); - } - expect(failCount).not.toEqual(15); + await expect(async () => { + const currentUrl = this.page.url(); + expect(currentUrl).toContain(issPageValue); + }).toPass({ + intervals: [1_000], + timeout: 15_000 }); } } \ No newline at end of file