Skip to content

test: migrate card e2e to component view test#30557

Merged
cortisiko merged 4 commits into
mainfrom
MMQA-1770
May 21, 2026
Merged

test: migrate card e2e to component view test#30557
cortisiko merged 4 commits into
mainfrom
MMQA-1770

Conversation

@cortisiko

@cortisiko cortisiko commented May 21, 2026

Copy link
Copy Markdown
Member

Description

Adds a new component-view test suite for CardHome that validates key rendering states, navigation targets (e.g., add funds, asset selection, spending limit, cashback, metal card), and logout behavior using a minimal navigation stack and real Redux fixtures.

Refactors card-related test infrastructure by introducing a seeded cardStatePreset, a renderCardHomeView helper, expanded component-view Engine mocks, and selector-based testID constants for CardAuthentication (plus new SpendingLimit selectors). Removes the old card navbar smoke/e2e test and its associated analytics expectations.

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

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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 test infrastructure, selectors (testID) wiring, and removal of an e2e smoke test, with no production logic changes beyond swapping hardcoded testID strings for constants.

Overview
Adds a new component-view test suite for CardHome that asserts key navigation targets (Add Funds, asset selection, spending limit, cashback, metal card), teaser-mode auth redirect, retry behavior, and logout confirmation.

Refactors card test scaffolding by introducing a seeded cardStatePreset, a renderCardHomeView helper with lightweight navigation route probes, and expanding component-view Engine mocks for card flows.

Standardizes testID usage by replacing inline IDs in CardAuthentication and SpendingLimit with selector constants, and removes the old card navbar smoke/e2e spec plus its analytics expectations.

Reviewed by Cursor Bugbot for commit 63588a6. Bugbot is set up for automated code reviews on this repo. Configure here.

@cortisiko cortisiko requested review from a team as code owners May 21, 2026 21:34
@metamaskbotv2 metamaskbotv2 Bot added the team-qa QA team label May 21, 2026
@cortisiko cortisiko 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 May 21, 2026
Comment thread app/components/UI/Card/Views/CardHome/CardHome.view.test.tsx Outdated

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

Reviewed by Cursor Bugbot for commit c3cf7d9. Configure here.

Comment thread app/components/UI/Card/Views/SpendingLimit/SpendingLimit.testIds.ts
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes in this PR are focused on the MetaMask Card feature and are primarily test infrastructure improvements:

  1. Deleted E2E test (tests/smoke/card/card-button.spec.ts + card-button.analytics.ts): The Card NavBar Button smoke test (tagged SmokeMoney) was removed. This means we should still run SmokeMoney to validate the remaining Card E2E tests still pass.

  2. TestID refactoring (CardAuthentication.tsx, SpendingLimit.tsx): Hardcoded string testIDs replaced with constants from new/updated .testIds.ts files. The actual string values are identical (e.g., 'email-field'CardAuthenticationSelectors.EMAIL_FIELD = 'email-field'), so no functional change. However, if any E2E tests reference these testIDs, they would still work since the values are unchanged.

  3. New component-view test infrastructure (cardStatePreset.ts, cardViewRenderer.tsx, CardHome.view.test.tsx): These are Jest unit tests, not Detox E2E tests. They test CardHome navigation and actions at the component level.

  4. Engine mock updates (tests/component-view/mocks.ts): Added CardController mock and setSelectedAddress to support the new component-view tests.

  5. Minor TypeScript fix (render.tsx): React.ComponentType<unknown>React.ComponentType<object> — cosmetic type improvement.

Risk assessment: Low risk. No functional app code changed (only testID string references moved to constants with identical values). The main concern is ensuring the remaining SmokeMoney Card tests still pass after the deletion of the card-button test and the testID refactoring. No other feature areas are affected.

No performance tests needed: No UI rendering performance changes, no state management changes, no critical flow changes — only test infrastructure and testID constant refactoring.

Performance Test Selection:
No performance-sensitive changes were made. The PR only refactors testID strings to constants (identical values), deletes one E2E test, and adds component-view unit test infrastructure. No UI rendering, state management, data loading, or critical flow changes that would impact app performance.

View GitHub Actions results

@cortisiko cortisiko enabled auto-merge May 21, 2026 22:15
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@cortisiko cortisiko added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label May 21, 2026
@cortisiko cortisiko added this pull request to the merge queue May 21, 2026
Merged via the queue into main with commit dc0ab42 May 21, 2026
265 of 270 checks passed
@cortisiko cortisiko deleted the MMQA-1770 branch May 21, 2026 22:56
@github-actions github-actions Bot locked and limited conversation to collaborators May 21, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.80.0 Issue or pull request that will be included in release 7.80.0 label May 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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 release-7.80.0 Issue or pull request that will be included in release 7.80.0 size-L skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants