Skip to content

Conversation

@diegocurbelo
Copy link
Member

@diegocurbelo diegocurbelo commented Oct 30, 2025

Fixes STRIPE-<linear_issue_id>
Fixes #<github_issue_id>

Changes proposed in this Pull Request:

This PR fixes the flakiness of the ACH E2E tests.

It updates the selectors for the ACH Stripe iframe modal and it adds two new helpers:

  • waitForStripeReady
    Wait for Stripe iframe to be fully loaded and ready for interaction (to address race conditions with Stripe Elements rendering).
  • retryWithBackoff
    Retry an async function with exponential backoff (for iframe interactions).

Testing instructions

Verify that all PR checks pass, particularly the two E2E suites:
Screenshot 2025-10-30 at 16 54 43


  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

This PR only fixes E2E tests, it has no customer facing changes.

Post merge

@diegocurbelo diegocurbelo requested a review from Copilot October 30, 2025 19:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors ACH checkout tests to improve reliability by addressing timing issues with Stripe iframe interactions. The changes introduce helper functions for handling asynchronous operations and update test flows to be more explicit and robust.

Key Changes:

  • Added waitForStripeReady() helper to handle iframe loading race conditions
  • Added retryWithBackoff() helper for retry logic with exponential backoff
  • Refactored fillACHBankDetails() to use a more explicit step-by-step approach
  • Increased timeout values in Playwright config to accommodate slower Stripe API interactions

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
tests/e2e/utils/payments.js Added retry and iframe-ready helpers; refactored ACH setup and bank detail filling with explicit visibility checks and retry logic
tests/e2e/tests/checkout/shortcode/lpms/ach.spec.js Inlined fillACHBankDetails in one test with modified step order; added blank lines for readability
tests/e2e/tests/checkout/blocks/lpms/ach.spec.js Added blank lines for improved readability
tests/e2e/config/playwright.config.js Increased test timeout to 120s, expect timeout to 30s, and added 15s action timeout

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@diegocurbelo diegocurbelo requested a review from Copilot October 30, 2025 20:16
@diegocurbelo diegocurbelo marked this pull request as ready for review October 30, 2025 20:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@diegocurbelo diegocurbelo requested review from a team, daledupreez and malithsen and removed request for a team November 3, 2025 15:32
Copy link
Contributor

@daledupreez daledupreez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is looking good to me, with one minor area where I am not clear on what we're doing.

for ( const indicator of loadingIndicators ) {
const loader = stripeFrame.locator( indicator );
if ( await loader.isVisible().catch( () => false ) ) {
await expect( loader ).toBeHidden( { timeout: 10000 } );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two thoughts:

  • It's not clear to me whether we need to check the selectors in sequence, or whether we can shift to something like Promise.all() that allows us to perform these checks in parallel. We should either add a comment about why we're doing this sequentially, or we should look at handling this in parallel.
  • Not blocking: should this timeout be configurable in some way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to check the selector in parallel in f04f9bc

await emptyCart( page );
await setupCart( page );

let iframeSelector = 'iframe[src*="elements-inner-payment"]';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: rather than overwriting the iframeSelector variable, it may be clearer to use a separate variable name for this initial/inner selector, and then use a separate variable for the full iframe selector.

Suggested change
let iframeSelector = 'iframe[src*="elements-inner-payment"]';
const rawIframeSelector = 'iframe[src*="elements-inner-payment"]';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f04f9bc

Copy link
Contributor

@malithsen malithsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making these improvements. This looks good to me.

Copy link
Contributor

@daledupreez daledupreez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me! :shipit: 🙏

@diegocurbelo diegocurbelo merged commit 07bfe39 into develop Nov 5, 2025
40 checks passed
@diegocurbelo diegocurbelo deleted the dev/fix-flaky-e2e-tests branch November 5, 2025 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants