docs(perps/agentic): eval-ref vocabulary rename, HUD propagation, flow system#27775
Conversation
- Add testIDs to PerpsTPSLView inputs (tp/sl price fields) - Add testIDs to PerpsOrderTypeBottomSheet options (market/limit) - Add testIDs to PerpsAdjustMarginActionSheet options (add/reduce) - Add testIDs to PerpsOrderDetailsView cancel button - Add testIDs to PerpsCompactOrderRow (first-row stable ID) - Extend TabsList/TabsBar to support per-tab tabTestID prop - Add tabTestID to PerpsMarketTabs tab props Fix all 10 flow files to use correct testIDs and navigation params: - activity-view, market-discovery, market-watchlist - order-limit-cancel (via compact-row → order-details → cancel) - order-limit-place, position-add-margin - tpsl-create, tpsl-edit - trade-close-position, trade-open-market Remove trailing screenshot steps from all flows — screenshots are for PR artifacts, not repeated agentic calls (token waste).
Add testIDs to the 4 filter tabs in PerpsTransactionsView
(trades/orders/funding/deposits) and update the activity-view
agentic flow to accept a {{tab}} param so any sub-tab can be
targeted by recipe runners.
|
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. |
…chlist UI flow
- Add FAVORITE_BUTTON testID to PerpsMarketHeaderSelectorsIDs and apply
both FAVORITE_BUTTON and MORE_BUTTON testIDs to the TouchableOpacity
elements in PerpsMarketHeader.tsx (previously untestable via CDP)
- Rewrite market-watchlist.json flow to use perps-market-header-favorite-button,
navigate directly to market detail (remove redundant PerpsTrendingView nav),
and use {{symbol|BTC}} default syntax for consistency
- Add Recipes vs Flows concept section to flows/README.md
- Add testIDs to Keypad digit/dot buttons for type_keypad flow action support,
update snapshot accordingly
- Improve order-limit-place and trade-open-market flows with param defaults
and better step descriptions
- Expand validate-recipe.sh with dry-run support and flow_ref resolution
- Update perps-agentic-feedback-loop.md docs
… watchlist flow pre-condition PerpsMarketDetailsView was using MORE_BUTTON testID on the star/watchlist toggle button — a semantic mismatch that caused the market-watchlist flow press step to target the wrong element. Change to FAVORITE_BUTTON so the testID matches intent and the flow can locate it reliably. Add an assert-based pre-condition step to market-watchlist.json that fails fast when the symbol is already in the watchlist, preventing the toggle from silently removing instead of adding. Validated: 9/9 steps pass against live app.
…ewSelectorsIDs
- activity-view.json: change {{tab}} to {{tab|trades}} so the flow runs
correctly when invoked directly without params
- README + perps-agentic-feedback-loop.md: document tab param with default
- PerpsTransactionsView: import and use PerpsTransactionsViewSelectorsIDs
constants instead of inline template strings to eliminate drift risk
… directory
Move flows, recipes, and snippets into the per-team directory alongside
pre-conditions so CODEOWNERS can be set at teams/<team>/ with no
cross-team file edits required.
Changes:
- flows/perps/*.json → teams/perps/flows/
- recipes/perps/{core,setup}.json → teams/perps/recipes/
- recipes/perps.json → teams/perps/snippets.json
- Rename teams/wallet/ → teams/mobile-platform/ (matches CODEOWNERS)
- Delete now-empty flows/ and recipes/ root dirs
Validators updated:
- validate-flow-schema.js: auto-discovers from teams/*/flows/
- validate-recipe.sh: integrates pre-condition checks, adds --hud flag
- cdp-bridge.js recipe command: reads from teams/<team>/snippets.json
and teams/<team>/recipes/<file>.json (external API unchanged)
Infrastructure added:
- lib/assert.js, lib/registry.js: shared pre-condition evaluation
- validate-pre-conditions.js, validate-flow-schema.js: offline validators
- teams/README.md: updated contribution guide
CODEOWNERS: add explicit teams/perps/ entry for @MetaMask/perps
Add a dev-only HUD that renders the current recipe step name as an overlay during agentic recipe execution. Wired via a callback registry so the HUD component stays decoupled from AgenticService. - AgentStepHud.tsx: floating overlay showing step id + description - AgenticService.ts: showStep/hideStep bridge methods + callback registry - App.tsx: mount <AgentStepHud /> in DEV builds only
Renames the `tabTestID` prop to `testID` across TabsBar, TabsList types and components, and PerpsMarketTabs consumer. Also adds missing `tab.testID` fallback in the non-scrollable TabsBar branch.
a568618
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: The PR introduces the agentic testing framework infrastructure with the following key changes:
Tag selection rationale:
Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
|
georgewrmarshall
left a comment
There was a problem hiding this comment.
LGTM! We should definitely have testID props for all of our components.
|
✅ E2E Fixture Validation — Schema is up to date |




Description
Adds a deterministic recipe system for agentic validation of the perps feature. Recipes are JSON files that describe step-by-step app interactions (navigate, press, type, assert) — executed against a running app via CDP. They replace manual testing with reproducible, token-efficient automation.
Why recipes?
For agents doing PR review or bug fixing: An agent can generate a recipe that opens a position, sets TP/SL, closes it — and record the execution as video evidence. One JSON file replaces dozens of CDP tool calls, saving inference tokens and producing consistent results.
For developers working with agents on features (recipe-driven development): Write the recipe first — define expected navigation, interactions, and assertions — then implement the feature until the recipe passes. Like TDD but for agent workflows: define the expected output, iterate until green, get a fully reproducible validation artifact. Existing Gherkin scenarios from PRs can be directly migrated to recipes with 1:1 step mapping.
Composability via
flow_ref: Common operations (open position, create TP/SL, close position) are packaged as reusable flows. A recipe composes flows instead of repeating raw steps — 4 lines offlow_refreplace 40 lines of navigate/press/wait.What's in this PR
trade-open-market,trade-close-position,tpsl-create,tpsl-edit,order-limit-place,order-limit-cancel,position-add-margin,market-discovery,market-watchlist,activity-view,select-account,setup-testnetvalidate-recipe.sh— recipe runner withflow_refcomposition,wait_forcondition polling, HUD overlay, pre-condition checks,{{param}}templatingwait_foraction — condition-based polling replacing all blindwaitsteps (route, testID visibility, or arbitrary expression)AgentStepHud—__DEV__-only overlay showing current step ID during recipe executionteams/<team>/flows/,evals/,recipes/,pre-conditions.js)Lifecycle recipe (used for validation video)
This recipe composes 4 flows to validate a complete trade lifecycle — the exact JSON that
validate-recipe.shexecutes (teams/perps/recipes/full-trade-lifecycle.json):{ "title": "Full BTC trade lifecycle — mainnet start, testnet switch, open, TP/SL, close", "validate": { "runtime": { "steps": [ { "id": "nav-wallet-home", "action": "navigate", "target": "WalletView" }, { "id": "switch-mainnet", "action": "toggle_testnet", "enabled": false }, { "id": "wait-mainnet", "action": "wait_for", "expression": "JSON.stringify({isTestnet:Engine.context.PerpsController.state.isTestnet})", "assert": { "operator": "eq", "field": "isTestnet", "value": false } }, { "id": "nav-perps-home", "action": "navigate", "target": "PerpsHomeView" }, { "id": "wait-perps-home", "action": "wait_for", "route": "PerpsMarketListView" }, { "id": "ensure-testnet", "action": "flow_ref", "ref": "setup-testnet" }, { "id": "verify-provider", "action": "eval_ref", "ref": "providers", "assert": { "operator": "contains", "value": "hyperliquid" } }, { "id": "open-long-btc", "action": "flow_ref", "ref": "trade-open-market", "params": { "symbol": "BTC", "side": "long", "usdAmount": "10", "leverage": "2" } }, { "id": "wait-position", "action": "wait_for", "timeout_ms": 10000, "expression": "...", "assert": { "operator": "eq", "field": "found", "value": true } }, { "id": "create-tpsl", "action": "flow_ref", "ref": "tpsl-create", "params": { "symbol": "BTC" } }, { "id": "close-position", "action": "flow_ref", "ref": "trade-close-position", "params": { "symbol": "BTC" } }, { "id": "wait-closed", "action": "wait_for", "timeout_ms": 10000, "expression": "...", "assert": { "operator": "eq", "field": "found", "value": false } } ] } } }Result: 14/14 steps pass, composing 4 nested flows (34 total steps across flows).
Risk profile
Shell scripts + JSON schemas — dev-only tooling, not shipped in production builds. React component changes limited to adding
testIDprops (no logic changes).AgentStepHud.tsxgated behind__DEV__.Changelog
CHANGELOG entry: null
Related issues
Internal perps agentic tooling — no external ticket.
Manual testing steps
Screenshots/Recordings
Before
N/A — new tooling, no prior state.
After
full-trade-lifecycle.mp4
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Mostly adds/renames
testIDprops across Keypad, Tabs, and Perps UI plus a__DEV__-only HUD overlay; behavior changes are minimal and largely test/automation-facing.Overview
Improves agentic/E2E automation hooks by adding stable
testIDs across shared UI (Keypad,Tabs) and many Perps surfaces (order rows, TP/SL inputs, limit price sheet, adjust margin actions, transactions tabs, and various touchable rows/buttons), including fixing a mislabeledTAKE_PROFIT_BUTTONselector.Adds a dev-only
AgentStepHudoverlay toApp(rendered only in__DEV__) to display the currently executing agent step, and updates Perps tests/snapshots to match the new identifiers. Also updates CODEOWNERS forscripts/perps/agentic/teams/perps/and ignores local.task/working directories.Written by Cursor Bugbot for commit a568618. This will update automatically on new commits. Configure here.