Skip to content

Stabilize US bank account Lite tests - #13808

Merged
jaynewstrom-stripe merged 1 commit into
masterfrom
jaynewstrom/stabilize-us-bank-account-lite-test
Aug 7, 2026
Merged

Stabilize US bank account Lite tests#13808
jaynewstrom-stripe merged 1 commit into
masterfrom
jaynewstrom/stabilize-us-bank-account-lite-test

Conversation

@jaynewstrom-stripe

@jaynewstrom-stripe jaynewstrom-stripe commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Make the Financial Connections Lite test driver support either server-controlled initial pane order.
  • Poll all valid WebView test IDs together and return the selector that matched.
  • Include the attempted selectors and final Espresso exception when WebView polling times out.

Motivation

TestUSBankAccount#testUSBankAccountLiteSuccess intermittently failed after 30 seconds while waiting for institution-default.

The Financial Connections frontend flag bank_connections_enable_select_institution_first controls whether institution-default or agree-button is rendered first. The Android test driver hard-coded institution-default followed by agree-button, so runs assigned the opposite flow variant waited for an element that was not expected to exist on that pane.

This fix works by polling both valid initial selectors during the same timeout. Once one appears, the driver records which selector matched, clicks it, and waits for the other pane. The cancellation flow similarly waits until either valid initial pane is ready before pressing Back. This follows the actual server-selected ordering instead of trying to hide the mismatch with a longer timeout.

Testing

  • Added tests

  • Modified tests

  • Manually verified

  • Temporarily wrapped TestRules with ShampooRule(20) and ran testUSBankAccountLiteSuccess on pixel2api33chrome: 20/20 iterations passed.

  • Removed the temporary Shampoo rule and reran testUSBankAccountLiteSuccess plus testUSBankAccountLiteCancelAllowsUserToContinue: 2/2 tests passed.

  • git diff --check

Screenshots

Before After
Not applicable; test infrastructure only. Not applicable; test infrastructure only.

Changelog

Not applicable; this only changes Android test infrastructure.

Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@jaynewstrom-stripe
jaynewstrom-stripe marked this pull request as ready for review August 6, 2026 20:27
@jaynewstrom-stripe
jaynewstrom-stripe requested review from a team as code owners August 6, 2026 20:27
@jaynewstrom-stripe
jaynewstrom-stripe enabled auto-merge (squash) August 6, 2026 20:33
Comment on lines +1536 to +1546
val firstPane = onWebView().withElementByAnyTestId(
testIds = FINANCIAL_CONNECTIONS_LITE_INITIAL_PANE_TEST_IDS,
timeout = WEBVIEW_ELEMENT_TIMEOUT,
)
firstPane.interaction.perform(webClick())

onWebView()
.withElementByTestId("agree-button")
.withElementByTestId(
testId = FINANCIAL_CONNECTIONS_LITE_INITIAL_PANE_TEST_IDS.first { it != firstPane.testId },
timeout = WEBVIEW_ELEMENT_TIMEOUT,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

From motivation:

The Financial Connections frontend flag bank_connections_enable_select_institution_first controls whether institution-default or agree-button is rendered first.

Instead of having special logic to handle either coming first, should the test itself specify which to wait for first based on that front end flag? Or maybe we should just make the tests deterministic rather than handling this flag being non-deterministic

@jaynewstrom-stripe jaynewstrom-stripe Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

According to codex:

Server-owned bank_connections_enable_select_institution_first routing can place either pane first.

So I think this is right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah I see, I was misled by it being called a "frontend flag", I thought it was on the client. Seems ok then, though still unfortunate that we can't just have a deterministic environment for our tests to run in

@amk-stripe amk-stripe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving because the webview timeouts seem good to have but I'm worried we're just obscuring a real issue in the tests rather than fixing it, regarding the non-determinism of which button appears first in the webview

auto-merge was automatically disabled August 7, 2026 00:34

Pull request was closed

@jaynewstrom-stripe
jaynewstrom-stripe enabled auto-merge (squash) August 7, 2026 00:35
@jaynewstrom-stripe
jaynewstrom-stripe merged commit 33db3bd into master Aug 7, 2026
54 checks passed
@jaynewstrom-stripe
jaynewstrom-stripe deleted the jaynewstrom/stabilize-us-bank-account-lite-test branch August 7, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants