diff --git a/playwright-tests/pages/AfterpayPage.ts b/playwright-tests/pages/AfterpayPage.ts index 2896741a..2eb7e690 100644 --- a/playwright-tests/pages/AfterpayPage.ts +++ b/playwright-tests/pages/AfterpayPage.ts @@ -37,9 +37,11 @@ export class AfterpayPage extends BasePage { async executeAfterpayPayment(paymentDetails: IPaymentDetails, claimDetails: IClaimDetails, servicePackage: ServicePackage) { await this.login(paymentDetails.password!); - if (await this.confirmButton.isVisible()) { - await this.confirmButton.click(); - } else { + try { + await this.confirmButton.waitFor({ state: 'visible', timeout: 5000 }); + await this.confirmButton.isVisible() + await this.confirmButton.click(); + } catch { // For some orders, user will have 2 options to choose from: monthly with interest or biweekly without interest await this.selectAfterpayWithoutInterestButton.waitFor({ state: 'visible' });