From 2dfdbb6d1d6f4bd0aaf83a2ee17a173deabcafa5 Mon Sep 17 00:00:00 2001 From: JennyNou Date: Sun, 22 Mar 2026 22:48:41 -0400 Subject: [PATCH] Fix flakiness for Afterpay sandbox flow --- playwright-tests/pages/AfterpayPage.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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' });