Skip to content

test: Added missing component test scenarios for perps area#25889

Merged
javiergarciavera merged 29 commits intomainfrom
MMQA-1397-component-tests-perps
Feb 13, 2026
Merged

test: Added missing component test scenarios for perps area#25889
javiergarciavera merged 29 commits intomainfrom
MMQA-1397-component-tests-perps

Conversation

@javiergarciavera
Copy link
Copy Markdown
Contributor

@javiergarciavera javiergarciavera commented Feb 10, 2026

Description

Perps tab: regression tests, geo-restriction, and test/lint fixes
Bug regression (7.64 EXP):
PerpsTabView: “See all perps” navigates to market list (not perps home); Explore includes all categories (crypto, stocks, forex, commodities) and commodities are not filtered; clear separation between discoverable markets and positions/orders.
PerpsMarketListView: Market list shows all categories, including commodities when present.
Geo-restriction (compliance):
PerpsClosePositionView: Uses selectPerpsEligibility; confirm disabled and geo-block tooltip when not eligible; handleConfirm does not close position when ineligible.
PerpsSelectModifyActionView: Same eligibility check for reduce/add/flip actions; ineligible users see geo-block tooltip and do not navigate.
Tests only (no component/UI changes):
PerpsTabView: Connection state tests (connected / disconnected / loading) for control bar and scroll behavior; strengthened “explore when no positions/orders” test with copy checks.
Other:
perpsStateMock: PerpsController.isEligible: true by default for tests.
ESLint: Patch applied for deprecated @typescript-eslint/no-parameter-properties; fixed no-shadow in PerpsMarketListView.test.tsx mock (use ReactActual).

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 changes plus additional Engine mocking used in view tests; low product risk but could affect test reliability if the new Perps stubs diverge from real controller behavior.

Overview
Adds Perps component view-test coverage and supporting test infrastructure.

Introduces new view tests for PerpsTabView, PerpsMarketListView, PerpsMarketDetailsView, and PerpsSelectModifyActionView to lock in regressions around “See all perps” navigation, market category filtering/badges, and geo-restriction behavior (show geo-block bottom sheet on Close/Modify). To make these tests state-driven, it adds an initialStatePerps preset, a perpsViewRenderer that wires Perps connection/stream providers with controllable stream overrides and optional extra routes, plus PerpsController Engine stubs and small typing/docs updates to the component-view test framework.

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

@javiergarciavera javiergarciavera requested a review from a team as a code owner February 10, 2026 09:48
@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 Feb 10, 2026
@javiergarciavera javiergarciavera added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Feb 10, 2026
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.

@github-actions
Copy link
Copy Markdown
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:
This PR adds unit/component view tests for Perps views and their supporting test infrastructure. All changes are confined to test files:

  1. New test files (4): Unit tests for PerpsMarketDetailsView, PerpsMarketListView, PerpsSelectModifyActionView, and PerpsTabView
  2. New test utilities (3): perpsViewTestHelpers.ts, perpsStatePreset.ts, perpsViewRenderer.tsx
  3. Modified test infrastructure (2): mocks.ts (added PerpsController stubs), render.tsx (minor type imports)
  4. Documentation (1): COMPONENT_VIEW_TEST_RULES.md update

Key observations:

  • NO production app code is modified
  • All changes are in app/util/test/component-view/ (unit test infrastructure) or *.view.test.tsx files
  • The mocks.ts changes add PerpsController stubs that are only used by component view tests, not E2E tests
  • The render.tsx changes are just type import improvements

Since no production code is changed and these are purely unit test additions, E2E tests are not needed to validate these changes. The unit tests themselves will verify the test infrastructure works correctly when they run.

Performance Test Selection:
No performance tests needed. This PR only adds unit/component view tests and test infrastructure for Perps views. No production code is modified that could impact app performance - no UI rendering changes, no data loading changes, no state management changes. The changes are purely test utilities (mocks, presets, renderers) and test files that run in Jest, not in the app.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@javiergarciavera javiergarciavera added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 5690adb Feb 13, 2026
59 checks passed
@javiergarciavera javiergarciavera deleted the MMQA-1397-component-tests-perps branch February 13, 2026 12:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2026
@metamaskbot metamaskbot added the release-7.67.0 Issue or pull request that will be included in release 7.67.0 label Feb 13, 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.67.0 Issue or pull request that will be included in release 7.67.0 size-L team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants