Skip to content

feat: Add A/B test for bridge token selector balance layout#27690

Merged
bfullam merged 7 commits into
mainfrom
swaps-bridge-token-row-abtest
Mar 19, 2026
Merged

feat: Add A/B test for bridge token selector balance layout#27690
bfullam merged 7 commits into
mainfrom
swaps-bridge-token-row-abtest

Conversation

@bfullam

@bfullam bfullam commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds an A/B test for the bridge token selector balance layout.

Control keeps the current presentation by showing fiat balance on the top row and keeping the ticker in the token balance text. Treatment moves the token balance to the top row, removes the duplicate ticker from the token balance text, and keeps the top and bottom rows aligned with the intended size and color hierarchy.

The PR also passes the active experiment through the bridge page-view and submit analytics paths using active_ab_tests so the treatment can be evaluated against downstream conversion metrics.

Changelog

CHANGELOG entry: Added an experiment for the bridge token selector balance layout.

Related issues

Fixes:

Manual testing steps

Feature: Bridge token selector balance layout experiment

  Scenario: User sees the control layout in the bridge token selector
    Given the token selector balance layout experiment is in the control variant
    And the user opens the Bridge flow
    When the token selector list is shown
    Then the fiat balance is shown on the top row
    And the token balance is shown on the bottom row with the ticker included

  Scenario: User sees the treatment layout in the bridge token selector
    Given the token selector balance layout experiment is in the treatment variant
    And the user opens the Bridge flow
    When the token selector list is shown
    Then the token balance is shown on the top row without the duplicate ticker
    And the fiat balance is shown on the bottom row

  Scenario: Analytics include the active experiment
    Given the token selector balance layout experiment is active
    When the user opens the Bridge flow
    And submits a bridge quote
    Then the relevant page-view and submit analytics payloads include active_ab_tests for the active experiment

Screenshots/Recordings

Before

Control variant:
Screenshot 2026-03-18 at 19 11 16

After

Treatment variant:
Screenshot 2026-03-19 at 18 24 35

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Moderate risk: changes token list balance rendering logic and adds new activeAbTests payloads to bridge submit/page-view analytics paths, which could affect UI presentation and event schemas if mismatched.

Overview
Adds a new A/B experiment (swapsSWAPS4242AbtestTokenSelectorBalanceLayout) to vary the Bridge token selector balance layout: control keeps fiat on the top row with the token ticker included, while treatment moves token balance to the top row and optionally removes the ticker.

Updates bridge analytics plumbing to include a consolidated active_ab_tests array on swap page-view events and to forward activeAbTests through useSubmitBridgeTx into BridgeStatusController.submitTx/submitIntent, with expanded unit tests covering both control/treatment behavior and payload propagation.

Written by Cursor Bugbot for commit 2508c8c. This will update automatically on new commits. Configure here.

@bfullam bfullam requested a review from a team as a code owner March 19, 2026 14:05
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Mar 19, 2026
@github-actions github-actions Bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 19, 2026
@bfullam bfullam changed the title Add A/B test for bridge token selector balance layout feat: Add A/B test for bridge token selector balance layout Mar 19, 2026
Comment thread app/components/UI/Bridge/components/TokenSelectorItem.test.tsx
Comment thread app/util/bridge/hooks/useSubmitBridgeTx.test.tsx
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are entirely within the Bridge/Swap feature area:

  1. TokenSelectorItem.abTestConfig.ts (new): Defines a new A/B test (swapsSWAPS4242AbtestTokenSelectorBalanceLayout) with control/treatment variants that control whether token balance or fiat balance is shown first in the token selector, and whether to remove the ticker symbol.

  2. TokenSelectorItem.tsx: Integrates the A/B test into the token selector UI component - the balance display order and format changes based on the variant. This is a UI change in the Bridge token selector used during swap/bridge flows.

  3. useTrackSwapPageViewed/index.ts: Updates analytics to track both the numpad A/B test and the new token selector A/B test in active_ab_tests when the swap page is viewed.

  4. useSubmitBridgeTx.ts: Forwards activeAbTests (including the new token selector A/B test) to both submitTx and submitIntent bridge controller calls for analytics/experiment tracking.

  5. Test files: Unit test coverage for the above changes.

Tag selection rationale:

  • SmokeTrade: Directly impacted - the token selector is used in swap/bridge flows. The A/B test changes how token balances are displayed in the token selector, which is a core part of the swap/bridge UI. Analytics tracking for swap page views is also modified.
  • SmokeConfirmations: Required per SmokeTrade tag description - "When selecting SmokeTrade for swap or bridge flows, also select SmokeConfirmations (transaction confirmations are part of the flow)."

No other tags are needed - these changes are isolated to the Bridge/Swap feature area with no impact on accounts, networks, identity, snaps, ramps, or other features.

Performance Test Selection:
The changes are A/B test configuration and UI layout changes within the Bridge token selector component. While there is a UI change (balance display order), it's a minor layout change that doesn't introduce new rendering complexity, additional API calls, or significant state management changes. The changes don't affect app startup, account/network list rendering, login flows, or other performance-sensitive areas. No performance tests are warranted.

View GitHub Actions results

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx
@bfullam bfullam enabled auto-merge March 19, 2026 16:39
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@bfullam bfullam added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit d3b6348 Mar 19, 2026
252 of 256 checks passed
@bfullam bfullam deleted the swaps-bridge-token-row-abtest branch March 19, 2026 19:04
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 19, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.72.0 Issue or pull request that will be included in release 7.72.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants