Add special validation for order confirmation
This commit is contained in:
parent
f417b331f6
commit
4059bd4a88
3 changed files with 27 additions and 6 deletions
|
|
@ -127,9 +127,8 @@ export class BasePage {
|
||||||
await this.waitForURLToChange(currentUrl);
|
await this.waitForURLToChange(currentUrl);
|
||||||
currentUrl = this.page.url();
|
currentUrl = this.page.url();
|
||||||
console.log(`New URL: ${currentUrl}`);
|
console.log(`New URL: ${currentUrl}`);
|
||||||
pass = currentUrl.includes(issPageValue);
|
|
||||||
}
|
}
|
||||||
expect(pass).toBeTruthy();
|
expect(currentUrl).toContain(issPageValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForURLToChange(startingUrl: string) {
|
async waitForURLToChange(startingUrl: string) {
|
||||||
|
|
|
||||||
|
|
@ -112,4 +112,26 @@ export class OrderConfirmationPage extends BasePage {
|
||||||
console.log(`SessionStorage Work Order Number:${workOrderNumber}`);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -735,7 +735,7 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
await test.step('OrderConfirmationPage >> Validate order', async () => {
|
await test.step('OrderConfirmationPage >> Validate order', async () => {
|
||||||
await orderConfirmationPage.validateURL(orderConfirmationPage.issPageValue);
|
await orderConfirmationPage.validateURL();
|
||||||
await orderConfirmationPage.validateOrderConfirmationPage(testCase.testData);
|
await orderConfirmationPage.validateOrderConfirmationPage(testCase.testData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue