feat(bridge): add data-asset-id for bridge asset rows and chips#41369
Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨🧪 @MetaMask/qa (2 files, +2 -2)
🔄 @MetaMask/swaps-engineers (6 files, +25 -22)
|
Builds ready [b257b54]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 1 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
b257b54 to
a4a3a49
Compare
Builds ready [a4a3a49]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 1 warn · 🔴 0 fail)
Dapp page load benchmarks: data not available. Bundle size diffs
|
a4a3a49 to
504492b
Compare
Builds ready [504492b]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 0 warn · 🔴 1 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
504492b to
a1e6ed8
Compare
Builds ready [a1e6ed8]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 0 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
a1e6ed8 to
02163d3
Compare
Builds ready [02163d3]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 0 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
02163d3 to
cccffe5
Compare
Builds ready [cccffe5]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 1 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
cccffe5 to
f56ac0e
Compare
Builds ready [f56ac0e]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 0 warn · 🔴 0 fail)
Dapp page load benchmarks: data not available. Bundle size diffs
|
Expose CAIP asset IDs on picker rows and selected token buttons so external E2E tests can target tokens unambiguously (e.g. vs similar symbols). Unit snapshots updated.
f56ac0e to
3bf2707
Compare
Builds ready [3bf2707]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 0 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
|
Builds ready [516134a]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 1 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
There was a problem hiding this comment.
Pull request overview
This PR updates Bridge/Swap UI test instrumentation for asset selection, aiming to make automation able to target specific assets more reliably than using symbol text alone.
Changes:
- Updates Bridge asset picker row selectors to be asset-specific by incorporating the CAIP
assetIdinto the rowdata-testid. - Adjusts unit/snapshot tests to query asset rows by a
bridge-asset--prefix instead of an exactbridge-assettest id. - Updates E2E page objects to locate asset rows via a
data-testidprefix selector.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui/pages/bridge/prepare/components/bridge-asset-picker/asset.tsx | Changes asset row data-testid to include asset.assetId. |
| ui/pages/bridge/prepare/components/bridge-asset-picker/asset.test.tsx | Updates tests to find the row by regex test id prefix. |
| ui/pages/bridge/prepare/components/bridge-asset-picker/snapshots/asset.test.tsx.snap | Snapshot updates reflecting new data-testid values. |
| ui/pages/bridge/prepare/bridge-input-group.test.tsx | Updates queries for asset rows to use a regex constant. |
| ui/pages/bridge/prepare/snapshots/bridge-input-group.test.tsx.snap | Snapshot updates reflecting new data-testid values. |
| test/e2e/page-objects/pages/swap/swap-page.ts | Updates selector to match new bridge-asset-- prefix. |
| test/e2e/page-objects/pages/bridge/quote-page.ts | Updates selector to match new bridge-asset-- prefix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Description
Bridge swap UI already exposes
data-testidon asset rows and token chips. This augments it with the assetIdThis lets external regression / Playwright suites select and assert the intended token by stable id instead of symbol text alone (e.g. avoiding ambiguity between similarly named assets).
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
data-asset-idmatching the token’s CAIP id.data-asset-idfor the current token.Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk UI instrumentation change that mainly affects automation selectors; primary risk is breaking existing E2E/tests or external suites relying on the old
data-testid="bridge-asset"value.Overview
Updates Bridge asset picker rows to expose a stable, asset-specific identifier by changing
BridgeAssetrowdata-testidfrom a constantbridge-assettobridge-asset--${asset.assetId}.Aligns unit snapshots and tests to query asset rows via a regex (
/^bridge-asset--/) and updates E2E page objects (swap-pageandquote-page) to select asset rows using the newdata-testidprefix selector.Written by Cursor Bugbot for commit 516134a. This will update automatically on new commits. Configure here.