Skip to content

fix(tests): add priority parameter to setupRemoteFeatureFlagsMock for…#27445

Open
cmd-ob wants to merge 9 commits intomainfrom
fix/ramps-test
Open

fix(tests): add priority parameter to setupRemoteFeatureFlagsMock for…#27445
cmd-ob wants to merge 9 commits intomainfrom
fix/ramps-test

Conversation

@cmd-ob
Copy link
Contributor

@cmd-ob cmd-ob commented Mar 12, 2026

… proper flag handling

Description

SmokeRamps: Onramp Unified Buy tests were failing at BuildQuoteView.tapContinueButton() after the feature flag registry was
introduced in b01640b.

Root cause: RemoteFeatureFlagController polls the feature flags endpoint every 1 second in DEV mode (fetchInterval: DEV ? 1000
: ...). Combined with how mockttp matches rules at the same priority:

After b01640b changed rampsUnifiedBuyV1 production default to active: true, the failure shifted from the FundActionMenu (hidden
button) to the BuildQuote screen — because the app now navigated into the V2 ramp flow successfully on the first poll, then fell
back to the old V1 aggregator flow on the second poll 1 second later, breaking the test's expected interactions.

Fix

  • Added an optional priority parameter to setupRemoteFeatureFlagsMock
  • The FixtureHelper's global default call now uses priority 2 instead of 999

With this separation, mockttp evaluates priority 999 first on every subsequent poll. When a test has registered its own flag
overrides at 999, those always win. When no test-specific mock exists, the request falls through to priority 1 and gets the
production-accurate defaults.

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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

Low Risk
Low risk: changes are limited to E2E mocking behavior and a testID prop on a UI button; main app logic is unaffected aside from improved test selectors.

Overview
Stabilizes E2E flows that depend on remote feature flags by letting setupRemoteFeatureFlagsMock register rules at a caller-specified mockttp priority, and by registering the global default feature-flag mock at priority 2 so test-specific overrides at 999 remain effective across repeated polls.

Re-enables the Onramp Unified Buy smoke suite and adds a testID (BuildQuoteSelectors.CONTINUE_BUTTON) to the Deposit BuildQuote Continue button to make the flow reliably tappable in tests.

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

@cmd-ob cmd-ob requested a review from a team as a code owner March 12, 2026 17:16
@github-actions
Copy link
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-qa QA team label Mar 12, 2026
Copy link

@cursor cursor bot left a comment

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.

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

@cmd-ob cmd-ob added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed no changelog required No changelog entry is required for this change labels Mar 12, 2026
@cmd-ob cmd-ob requested a review from a team as a code owner March 12, 2026 23:06
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The primary functional change in the app code is the addition of a testID (BuildQuoteSelectors.CONTINUE_BUTTON) to the BuildQuote component used in the Ramp (on-ramp buy) flow. This directly affects the unified buy flow UI interaction. Additionally, the previously skipped SmokeRamps test (onramp-unified-buy.spec.ts) has been re-enabled, indicating this PR’s intent is to stabilize and validate the on-ramp unified buy flow.

Changes to tests/api-mocking/helpers/remoteFeatureFlagsHelper.ts and tests/framework/fixtures/FixtureHelper.ts adjust mock priority handling for remote feature flags. This impacts E2E test infrastructure globally, particularly flows gated by feature flags (like Ramps). However, these are test-only infrastructure changes and do not affect production app logic. The priority fix ensures that test-specific feature flag overrides are not overwritten by the polling RemoteFeatureFlagController in DEV mode.

Given the app code impact is isolated to the Ramp BuildQuote screen and the test changes focus on the on-ramp flow and feature-flag stability, the relevant E2E coverage is SmokeRamps. No wallet core, confirmations, network, identity, trade, perps, predictions, snaps, or multichain logic was modified.

SmokeWalletPlatform is not required because there are no changes to wallet home, wallet actions entry points, or shared platform components—only the Ramp deposit quote screen. No dependency tags (e.g., SmokeConfirmations) are required since on-ramp flows do not use on-chain confirmations in the same way as swaps.

Therefore, running SmokeRamps is sufficient and risk-balanced.

Performance Test Selection:
The only app code change is adding a testID prop to a Button component, which has negligible runtime or rendering impact. The remaining changes are confined to E2E test infrastructure and mock priority handling. There are no changes to rendering logic, data fetching, controllers, navigation, or performance-sensitive flows. Therefore, no performance tests are required.

View GitHub Actions results

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog required No changelog entry is required for this change no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed size-S team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants