Repository navigation
Commit feb5d41
authored
test(e2e): add bitcoin assets network filter cases (#47587)
## **Description**
**Context**
Bitcoin is a Snap-backed network in the extension: its account
readiness, asset metadata, and balances flow through the Bitcoin Snap,
the unified asset state, and the network-filter modal before anything
renders in the homepage asset list.
This PR closes a coverage gap in the Bitcoin E2E assets suite by
mirroring what the Tron assets suite already does in
`test/e2e/tests/assets/tron.spec.ts`.
**Problem**
`test/e2e/tests/btc/assets.spec.ts` verified the asset list for an empty
account and the asset list plus native BTC details for a funded account,
but it never exercised the network filter. Nothing asserted that:
- selecting **All networks** surfaces other chains' assets alongside
Bitcoin, or
- the **Bitcoin-only** current-network filter renders *only* Bitcoin
assets and hides assets from other chains.
A regression in network-scoped filtering of unified asset state would
therefore reach users unnoticed, because the existing cases only ever
ran with Bitcoin selected.
**Solution**
Add a `Networks filter` describe block to
`test/e2e/tests/btc/assets.spec.ts`
with one isolated browser fixture per case:
- `All networks filter shows other chains alongside Bitcoin` — logs in,
switches to Bitcoin, waits for the Bitcoin row, selects All networks,
then asserts both `Bitcoin` and `Ethereum` are in the list.
- `Current network filter shows only Bitcoin assets` — logs in, switches
to Bitcoin, then asserts the exact list is `['Bitcoin']` and that
`Ethereum` is absent.
Implementation notes for reviewers:
- Reuses the existing `mockBtcAssetsFunded` static mocks and the
existing `FixtureBuilderV2` setup; only
`selectAllNetworksFromNetworkSelect` and
`HOMEPAGE_BALANCE_ASSERTION_TIMEOUT_MS` are newly imported. No new
fixture wrapper, flow, page-object API, mock, or page-object selector
was added.
- No Bitcoin local node/seeder is started for these cases. Network
filtering is read-only and fully deterministic from the existing
Esplora, token metadata, price, and default Ethereum fixture data — this
matches the Tron filter tests, which run with `localNode: false`.
`withFixtures` defaults to an Anvil node, so the default Ethereum
account is funded and its row appears under All networks.
- Spec stays POM-clean: existing flows and page-object `check*` methods
only, no selectors or direct driver UI calls in the spec, no local UI
helper, no hardcoded delay, and no `try`/`catch`.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: expand send E2E coverage
## **Manual testing steps**
1. Run the extension and get to an unlocked wallet that has a Bitcoin
(Snap) account.
2. Go to the homepage asset list.
3. Open the network filter in the header and select **All networks**.
4. Verify Bitcoin is listed alongside assets from other chains (e.g.
Ethereum).
5. Open the network filter again and select **Bitcoin** (current network
only).
6. Verify only the Bitcoin asset is listed.
7. Verify Ethereum is not visible anywhere in the asset list while
Bitcoin is the current network.
<!--
## **Screenshots/Recordings**
### **Before**
### **After**
-->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Test-only changes with no production code, security, or data-handling
impact.
>
> **Overview**
> Adds **network filter** coverage to the Bitcoin assets E2E suite,
aligned with the existing Tron assets pattern in `tron.spec.ts`.
>
> A new **`Networks filter`** block in
`test/e2e/tests/btc/assets.spec.ts` introduces two cases on top of the
existing `mockBtcAssetsFunded` setup: one selects **All networks** and
expects **Bitcoin** and **Ethereum** in the token list; the other keeps
**Bitcoin** as the current network and asserts the list is Bitcoin-only
with **Ethereum** absent. Both reuse
`selectAllNetworksFromNetworkSelect`,
`HOMEPAGE_BALANCE_ASSERTION_TIMEOUT_MS`, and existing `TokensTab`
checks—no new mocks, fixtures, or page-object APIs.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
884ae15. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 6eab056 commit feb5d41
1 file changed
Lines changed: 57 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
7 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
| |||
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
119 | 174 | | |
0 commit comments