Skip to content

test: remove toMatchSnapshot and removed snapshot files in confirmations tests#29287

Merged
cortisiko merged 5 commits into
mainfrom
MMQA-1681
Apr 24, 2026
Merged

test: remove toMatchSnapshot and removed snapshot files in confirmations tests#29287
cortisiko merged 5 commits into
mainfrom
MMQA-1681

Conversation

@cortisiko

@cortisiko cortisiko commented Apr 23, 2026

Copy link
Copy Markdown
Member

Description

Refactors confirmations-related unit tests to stop using toMatchSnapshot and instead assert on specific UI elements via @testing-library/react-native (e.g., presence of buttons, text, and testIDs) across Tooltip, BottomModal, CopyButton, Network, BlockaidBanner, AddressElement/List, approval templates/results, and transaction header.

Deletes the associated Jest snapshot files and adds a testID (blockaid-banner-loader) to the BlockaidBanner ActivityIndicator so the loader state can be asserted without snapshots.

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 confined to test expectations and snapshot removals, with only a minor UI change adding a testID to the Blockaid loader for testability.

Overview
Refactors confirmations-related unit tests to stop using toMatchSnapshot and instead assert on specific UI elements via @testing-library/react-native (e.g., presence of buttons, text, and testIDs) across Tooltip, BottomModal, CopyButton, Network, BlockaidBanner, AddressElement/List, approval templates/results, and transaction header.

Deletes the associated Jest snapshot files and adds a testID (blockaid-banner-loader) to the BlockaidBanner ActivityIndicator so the loader state can be asserted without snapshots.

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

@cortisiko cortisiko requested a review from a team as a code owner April 23, 2026 18:31
@cortisiko cortisiko added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Apr 23, 2026
@metamaskbotv2 metamaskbotv2 Bot added the team-qa QA team label Apr 23, 2026

@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 25d9157. Configure here.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.45%. Comparing base (7f5ea83) to head (5d46cdb).
⚠️ Report is 138 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29287      +/-   ##
==========================================
- Coverage   82.26%   77.45%   -4.81%     
==========================================
  Files        5127     5128       +1     
  Lines      135863   135872       +9     
  Branches    30586    30589       +3     
==========================================
- Hits       111766   105246    -6520     
- Misses      16467    23113    +6646     
+ Partials     7630     7513     -117     

☔ 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

Copy link
Copy Markdown
Contributor

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

@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: 97%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 29 changed files are unit test files (.test.tsx) and their corresponding snapshot files (snapshots/*.snap), with the single exception of BlockaidBanner.tsx which only adds a testID="blockaid-banner-loader" prop to an ActivityIndicator component. This is a purely cosmetic/test-infrastructure change with zero functional impact.

The changes consist of:

  1. Replacing snapshot-based assertions (toMatchSnapshot()) with explicit, more robust assertions (toBeOnTheScreen(), getByTestId(), etc.)
  2. Removing unnecessary async/await patterns from synchronous tests
  3. Updating snapshot files to reflect the new test structure
  4. Removing unused imports

None of these changes affect production logic, user flows, state management, navigation, or any component behavior. The single production code change (adding testID to ActivityIndicator in BlockaidBanner.tsx) is a non-functional attribute addition that only enables test targeting.

No E2E tests need to run for these changes as they pose no risk to any user-facing functionality.

Performance Test Selection:
No performance-sensitive code was changed. The only production code change is adding a testID attribute to an ActivityIndicator, which has no performance impact. All other changes are unit test improvements.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@cortisiko cortisiko enabled auto-merge April 23, 2026 20:20
@cortisiko cortisiko added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit a99399c Apr 24, 2026
68 checks passed
@cortisiko cortisiko deleted the MMQA-1681 branch April 24, 2026 07:43
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.76.0 Issue or pull request that will be included in release 7.76.0 label Apr 24, 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.76.0 Issue or pull request that will be included in release 7.76.0 size-M team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants