fix(e2e): globalize non-EVM snap discovery mocks#43818
Conversation
✨ Files requiring CODEOWNER review ✨🧪 @MetaMask/qa (1 files, +118 -0)
|
Builds ready [15075a9] [reused from c4b43e9]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 8 warn · 🔴 3 fail)
Bundle size diffs
|
|
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. |
|
Builds ready [99f989a]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 10 warn · 🔴 1 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Pull request overview
This PR improves the shared E2E mocking layer so non‑EVM snap discovery network calls (Bitcoin esplora + Solana getSignaturesForAddress) no longer fall through the generic empty-200 catch-all, avoiding deterministic provider retry delays that made non‑EVM account icon rendering borderline-flaky in multichain flows.
Changes:
- Added persistent default mocks in
test/e2e/mock-e2e.jsfor key Bitcoin esplora discovery endpoints and SolanagetSignaturesForAddress. - Wired the new default non‑EVM discovery mocks into the shared
setupMockingflow. - Added a Jest unit test that validates the new handlers are registered as persistent defaults and return the expected “empty scan” shapes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/e2e/mock-e2e.js | Adds and registers persistent default Bitcoin/Solana discovery mocks to prevent slow retries in shared E2E runs. |
| test/e2e/helpers/mock-e2e.test.js | Adds unit coverage asserting the new discovery mock rules exist, are persistent (.always()), and return expected payload shapes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
seaona
left a comment
There was a problem hiding this comment.
very nice finding! I've noticed we only add Bitcoin and Solana. Do we also need to add Tron?



Description
Non-EVM (Solana/Bitcoin) snap account icons render at the edge of the default 10s E2E wait because the snaps' discovery requests were not part of the shared mock set. Those requests fell through the global empty-200 catch-all in
mock-e2e.js, so the Bitcoin BDK esplorafull_scanand SolanagetSignaturesForAddresscalls failed and the providers retried — a deterministic~9sstorm (2s timeout × 3 attempts with doubling backoff) that lands right at the 10s wait and makes multichain/login specs borderline-flaky on constrained CI.Why: the discovery network calls had no shared default mocks — only test-local ones (
test/e2e/tests/btc/mocks/esplora.ts) — so any spec that rendered non-EVM accounts without wiring them hit the catch-all and stretched icon render into the retry budget.What changed:
test/e2e/mock-e2e.js(returning valid empty-scan responses):esplora/blocks,esplora/blocks/tip/height,esplora/blocks/tip/hash,esplora/scripthash/*/txs,esplora/scripthash/*/utxo,esplora/fee-estimates.getSignaturesForAddress(returns an empty signature list).test/e2e/helpers/mock-e2e.test.jsasserts both the handler shape and that the rules register as persistent defaults.Scope: addresses the primary mock-coverage gap in the shared E2E environment. It does not change provider timeout policy or snap-executor cold-start behavior (tracked as the secondary follow-up in #43817).
Related issues
Fixes #43817
Related:
@sentry/browserfrom8.33.1to10.38.0#42867 — Sentry v8→v10 upgrade, where this flake surfaced (a 20s stopgap there reverts once this lands).Manual testing steps
yarn jest test/e2e/helpers/mock-e2e.test.js— the shared mock registrations pass.test/e2e/tests/multichain-accounts/*) and confirmwaitForNonEvmAccountsLoadedpasses reliably at the default 10s wait, with no[Solana]/[Bitcoin] Timed out after: 3000msprovider-retry lines in the logs.Screenshots/Recordings
N/A — E2E test infrastructure only; no user-facing change.
Before
Bitcoin/Solana discovery requests fall through to the empty-200 catch-all → provider retries → icon render ≈10s (borderline-flaky at the default wait).
After
Discovery resolves from shared default mocks in milliseconds → icons render well within the default 10s wait.
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
E2E mock infrastructure only; no production runtime, auth, or user-facing behavior changes.
Overview
Adds shared default network mocks in
mock-e2e.jsso Bitcoin and Solana snap discovery calls no longer hit the generic empty-200 catch-all (which triggered ~9s provider retries and flaky multichain icon waits).setupDefaultNonEvmDiscoveryMocksregisters persistent.always()handlers for Bitcoin Infura esplora paths (blocks, tip height/hash, scripthashtxs/utxo,fee-estimates) with realistic empty-scan payloads, and for SolanagetSignaturesForAddress(emptyresult). It runs fromsetupMockingafter snap registry mocks so all E2E specs get coverage without per-test wiring.New
mock-e2e.test.jsuses a Mockttp-style stub to assert rule registration,.always(), and response shapes for the main Bitcoin and Solana discovery endpoints.Reviewed by Cursor Bugbot for commit 99f989a. Bugbot is set up for automated code reviews on this repo. Configure here.