Skip to content

test: add musd conversion feature e2e#25183

Merged
racitores merged 11 commits intomainfrom
raci/musdc-conversion-e2e
Jan 30, 2026
Merged

test: add musd conversion feature e2e#25183
racitores merged 11 commits intomainfrom
raci/musdc-conversion-e2e

Conversation

@racitores
Copy link
Copy Markdown
Contributor

@racitores racitores commented Jan 26, 2026

Description

Adds E2E tests for the mUSD conversion happy path, covering the main user flows and aligning with project E2E guidelines.

Test scenarios

  • First-time user: Education screen → custom amount → transaction confirmation → back to wallet → Activity tab shows confirmed mUSD conversion.
  • Returning user (Token List): Direct conversion from token list item CTA (“Get X% mUSD bonus” on USDC row); education skipped; same confirmation and Activity verification.
  • Asset Overview: Tap USDC → Asset Overview → scroll to mUSD CTA → tap → confirmation → back to wallet → Activity verification.

Technical improvements

  • Fixture & mocks
    • createMusdFixture(node, options) moved to e2e/specs/wallet/helpers/musd-fixture.ts (Mainnet, ETH/USDC/mUSD, rates, balances, geo/ramp state).
    • API mocks (feature flags, geolocation, ramp tokens, price APIs, token API, Relay quote/status) moved to e2e/specs/wallet/helpers/musd-mocks.ts; feature flag key fixed to earnMusdConversionAssetOverviewCtaEnabled for Asset Overview CTA.
  • Page Object Model
    • WalletView: scrollDownToAssetOverviewMusdCta() (scroll in Asset Overview until CTA visible, then assert); tapAssetOverviewMusdCta() with checkStability and delay; token list item CTA getter/tap with stability.
    • TransactionPayConfirmation: enterAmountAndContinue(amount) for keyboard amount + continue.
    • ActivitiesView: verifyMusdConversionConfirmed(rowIndex) and generic verifyActivityItemWithStatus(title, status, rowIndex); uses ActivitiesView.testIds for mUSD conversion label.
  • Framework usage
    • Assertions, Gestures, Matchers from tests/framework; no direct Detox in specs; no TestHelpers.delay(); proper timeouts and descriptions.
  • Relay / transaction-pay
    • Mainnet USDC→mUSD quote mock and mockRelayQuoteMainnetMusd(mockServer) in tests/api-mocking/mock-responses/transaction-pay.ts so confirmation screen gets a valid quote (avoids “No quotes”).

All three tests use local Anvil (no mainnet fork), setupMusdMocks, and end with Activity tab verification of the confirmed mUSD conversion.

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

Medium Risk
Medium risk because it modifies shared E2E infrastructure (FixtureBuilder, Relay quote mocks, and scrolling helpers), which could introduce flakiness or break unrelated tests despite being non-production code.

Overview
Adds a new E2E suite that validates the mUSD conversion happy path across first-time, token-list, and asset-overview entry points, asserting the resulting Activity row is confirmed.

Introduces dedicated mUSD test infrastructure: a reusable createMusdFixture helper plus FixtureBuilder.withMusdConversion() to seed Mainnet balances/state, and a full set of API mocks (feature flags, geo/ramp, price/token APIs, Merkl rewards, Relay quote/status) backed by shared USDC_MAINNET/MUSD_MAINNET constants.

Extends page objects to support the flow (WalletView CTAs + scrolling, TransactionPayConfirmation.enterAmountAndContinue, ActivitiesView.verifyMusdConversionConfirmed) and tightens TrendingView feed scrolling to use scrollToElement with configurable timeouts. Also adds a Mainnet-specific Relay quote mock (mockRelayQuoteMainnetMusd) to keep Transaction Pay confirmations from failing with missing quotes.

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

@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-qa QA team label Jan 26, 2026
@racitores racitores added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Jan 26, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.03%. Comparing base (0f5817f) to head (6464e8f).
⚠️ Report is 115 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25183      +/-   ##
==========================================
+ Coverage   79.96%   80.03%   +0.06%     
==========================================
  Files        4257     4267      +10     
  Lines      109331   109884     +553     
  Branches    22889    23021     +132     
==========================================
+ Hits        87429    87945     +516     
- Misses      15835    15838       +3     
- Partials     6067     6101      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added size-L and removed size-M labels Jan 28, 2026
@racitores racitores requested a review from a team as a code owner January 29, 2026 12:32
statusCode: 200,
json: MAINNET_MUSD_RELAY_QUOTE_MOCK,
}));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicated mock functions with identical structure

Low Severity

The functions mockRelayQuote and mockRelayQuoteMainnetMusd are nearly identical, differing only in the mock data they return (RELAY_QUOTE_MOCK vs MAINNET_MUSD_RELAY_QUOTE_MOCK). Both share the same matching logic for /proxy POST requests that include api.relay.link/quote. This duplication could be refactored into a single parameterized function that accepts the mock response data as a parameter, reducing maintenance burden and ensuring consistent behavior.

Additional Locations (1)

Fix in Cursor Fix in Web

@racitores racitores enabled auto-merge January 29, 2026 17:45
*/
async scrollDownToAssetOverviewMusdCta(): Promise<void> {
const assetOverviewScrollContainer = Matchers.getIdentifier(
'transactions-container',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hardcoded string instead of existing constant

Low Severity

The code uses the hardcoded string 'transactions-container' instead of the existing constant ActivitiesViewSelectorsIDs.CONTAINER from ActivitiesView.testIds.ts. Using magic strings when constants exist reduces maintainability - if the test ID changes, this code would need to be updated separately from the source of truth.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Member

@cortisiko cortisiko left a comment

Choose a reason for hiding this comment

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

small feedback

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
This PR adds a new mUSD conversion E2E flow (spec + fixtures + API mocks) and supporting page-object helpers. It also updates WalletView and ActivitiesView page objects and adds a new ActivitiesView testId string. No Engine/controller or core app logic changed; the only app code change is a testIds addition. Running SmokeWalletPlatform will cover the new mUSD conversion flows, wallet navigation, activity verification, and Trending-related page-object updates. Other suites (Confirmations, Trade, Ramps, etc.) are unaffected by these changes and can be skipped for efficiency.

Performance Test Selection:
No performance-impacting app code changes. Only test code and a testIds constant were modified, which do not affect rendering, state management, or startup. Therefore, no performance tests are needed.

View GitHub Actions results

Copy link
Copy Markdown

@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.

@sonarqubecloud
Copy link
Copy Markdown

@racitores racitores added this pull request to the merge queue Jan 30, 2026
Merged via the queue into main with commit fb7cf08 Jan 30, 2026
88 checks passed
@racitores racitores deleted the raci/musdc-conversion-e2e branch January 30, 2026 15:33
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2026
@metamaskbot metamaskbot added the release-7.65.0 Issue or pull request that will be included in release 7.65.0 label Jan 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.65.0 Issue or pull request that will be included in release 7.65.0 size-L team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants