diff --git a/playwright-tests/pages/BasePage.ts b/playwright-tests/pages/BasePage.ts index a40bad06..0b853baa 100644 --- a/playwright-tests/pages/BasePage.ts +++ b/playwright-tests/pages/BasePage.ts @@ -126,16 +126,15 @@ export class BasePage { console.log('Waiting for URL to change'); await this.waitForURLToChange(currentUrl); currentUrl = this.page.url(); - console.log(`New URL: ${currentUrl}`); - pass = currentUrl.includes(issPageValue); + console.log(`New URL: ${currentUrl}`); } - expect(pass).toBeTruthy(); + expect(currentUrl).toContain(issPageValue); } async waitForURLToChange(startingUrl: string) { await expect(async () => { const currentUrl = this.page.url(); - expect(currentUrl).not.toEqual(startingUrl); - }).toPass({ timeout: 180_000 }); + expect(currentUrl).not.toEqual(startingUrl); + }).toPass({ timeout: 180_000 }); } } \ No newline at end of file diff --git a/playwright-tests/pages/OrderConfirmationPage.ts b/playwright-tests/pages/OrderConfirmationPage.ts index 2a4d6104..c0005cdb 100644 --- a/playwright-tests/pages/OrderConfirmationPage.ts +++ b/playwright-tests/pages/OrderConfirmationPage.ts @@ -112,4 +112,26 @@ export class OrderConfirmationPage extends BasePage { console.log(`SessionStorage Work Order Number:${workOrderNumber}`); }); } + + async validateURL() { + console.log("Order confirmation validation override") + console.log(`Checking for page value: ${this.issPageValue}`); + let pass = false; + let currentUrl = this.page.url(); + console.log(`Current URL: ${currentUrl}`); + pass = currentUrl.includes(this.issPageValue); + while(!pass && currentUrl.includes('payment')) { + await this.waitForURLToChange(currentUrl); + currentUrl = this.page.url(); + pass = currentUrl.includes(this.issPageValue); + } + const isBailout = currentUrl.includes('bailout-page'); + if(!pass && !isBailout) { + console.log('Waiting for URL to change'); + await this.waitForURLToChange(currentUrl); + currentUrl = this.page.url(); + console.log(`New URL: ${currentUrl}`); + } + expect(currentUrl).toContain(this.issPageValue); + } } \ No newline at end of file diff --git a/playwright-tests/tests/0000__M.test.ts b/playwright-tests/tests/0000__M.test.ts index 5499792d..c1f76764 100644 --- a/playwright-tests/tests/0000__M.test.ts +++ b/playwright-tests/tests/0000__M.test.ts @@ -735,7 +735,7 @@ async function runWorkflow(page: Page, testCase: TestCase) { } await test.step('OrderConfirmationPage >> Validate order', async () => { - await orderConfirmationPage.validateURL(orderConfirmationPage.issPageValue); + await orderConfirmationPage.validateURL(); await orderConfirmationPage.validateOrderConfirmationPage(testCase.testData); }); }