Merge remote-tracking branch 'origin/feature/INSR-2126' into sshaik/develop

This commit is contained in:
Siraj Shaik 2025-03-11 12:01:26 -04:00
commit 34b7897e03
3 changed files with 41 additions and 6 deletions

View file

@ -116,12 +116,25 @@ export class BasePage {
}
async validateURL(issPageValue: string) {
console.log(`Checking for page value: ${issPageValue}`);
let pass = false;
let currentUrl = this.page.url();
console.log(`Current URL: ${currentUrl}`);
pass = currentUrl.includes(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(issPageValue);
}
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 });
}
}

View file

@ -111,4 +111,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);
}
}

View file

@ -757,7 +757,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);
});
}