Skip to content

test: add component view test coverage for network related bugs#26101

Open
cortisiko wants to merge 3 commits intomainfrom
MMQA-1399
Open

test: add component view test coverage for network related bugs#26101
cortisiko wants to merge 3 commits intomainfrom
MMQA-1399

Conversation

@cortisiko
Copy link
Member

@cortisiko cortisiko commented Feb 14, 2026

Description

This PR adds component view tests covering two previously untested network-related regressions (#25100, #24972)

What changed

AssetDetails CVT (#25100) — A production regression was found in 7.61.6, where the token details page was pulling the network name from the globally selected network instead of the token's own chainId from route params. The existing unit tests never set up a cross-chain mismatch (e.g., viewing a Polygon token while Mainnet is selected), so this was not tested. The new CVT renders a Polygon WETH token against a Mainnet-selected state and asserts that "Polygon" appears in both the header and body, while "Ethereum Main Network" doesn't appear at all.

WalletActions CVT (#24972) — Was a regression caught during RC testing for 7.62.0, where the Perps button was gated behind isEvmSelected, so it disappeared when the user had a non-EVM network (Solana, Bitcoin, etc.) selected. The existing unit tests mock selectIsEvmNetworkSelected directly and never exercise the false case for Perps. The new CVT sets up real state with isEvmSelected: false and a Solana chain ID, then asserts the Perps button is still in the tree.

Both tests were red-green validated: they pass on the current codebase and fail when the respective fixes are reverted.

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
Test-only additions plus new test fixtures/render helpers; no production logic changes, with minimal risk beyond potential test flakiness from fixture assumptions.

Overview
Adds component-view regression tests for two network-selection issues: AssetDetails now has coverage ensuring the displayed network name is derived from the token chainId in route params (e.g., Polygon token while Mainnet is selected), and WalletActions has coverage ensuring the Perps button remains visible when a non-EVM network is selected.

Introduces reusable component-view test helpers: new state presets (initialStateAssetDetails, initialStateWalletActions) and renderers (renderAssetDetailsView, renderWalletActionsView) that build minimal fixtures (including Polygon network config, deterministic fiat rate overrides, and feature-flag enablement for Perps) to make these scenarios easy to reproduce in tests.

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

@cortisiko cortisiko self-assigned this Feb 14, 2026
@cortisiko cortisiko added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Feb 14, 2026
@cortisiko cortisiko requested a review from a team as a code owner February 14, 2026 00:28
@metamaskbot metamaskbot added the team-qa QA team label Feb 14, 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 2 potential issues.

salimtb
salimtb previously approved these changes Feb 14, 2026
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
All 6 changed files are new additions to the unit test infrastructure (Jest tests), not E2E tests or production code:

  1. AssetDetails.view.test.tsx - New Jest unit test for AssetDetails view (regression test for [Bug]: Token Details page occasionally shows the wrong network #25100)
  2. WalletActions.view.test.tsx - New Jest unit test for WalletActions view (regression test for [Bug]: Perps option is missing from 'Trade' menu when Network Manager selection is a non EVM network #24972)
  3. presets/assetDetails.ts - New test state fixture for AssetDetails unit tests
  4. presets/walletActions.ts - New test state fixture for WalletActions unit tests
  5. renderers/assetDetails.ts - New test renderer utility for AssetDetails unit tests
  6. renderers/walletActions.ts - New test renderer utility for WalletActions unit tests

These changes:

  • Are entirely self-contained within the app/util/test/component-view/ directory (unit test infrastructure)
  • Do not modify any production application code
  • Do not affect E2E test infrastructure (Detox tests)
  • Do not change any shared components that E2E tests depend on
  • Only add new unit tests and their supporting utilities

The new test utilities are only imported by the new unit test files themselves, with no impact on the broader codebase. No E2E tests are needed to validate these changes as they are purely additive unit test infrastructure.

Performance Test Selection:
These changes are purely unit test infrastructure additions (Jest tests, test fixtures, and test renderers). They do not modify any production code, UI components, data loading logic, or any code paths that would affect app performance. No performance tests are needed.

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 no-changelog Indicates no external facing user changes, therefore no changelog documentation needed size-M team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants