Skip to content

Conversation

@racitores
Copy link
Contributor

@racitores racitores commented Oct 8, 2025

Description

perps-add-funds.mp4
limit-long-fill.mp4
limit-long-fill.mp4
perps-position-liquidation.mp4
perps-activity-transactions.mp4

This one goes to regression pipeline:
https://github.com/user-attachments/assets/8fc94d92-8e6c-4208-a3e6-eb6fcb80946d

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

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

Adds robust Perps E2E flows (add funds, activity, limit orders, liquidation) backed by a new HTTP command queue/polling bridge, expanded mocks, minor UI testID hooks, and splits SmokeTrade in CI.

  • E2E Infra/Bridge:
    • Introduces HTTP command queue server (/queue.json, /debug.json) with app-side polling (e2eBridgePerps.ts) and deeplink handling cleanup; ports wired via utils.js and shim.js (XHR proxy bypass for localhost).
    • Maps E2E deep links to metamask:// uniformly.
    • Metro resolver aliases Sentry to no-op mocks for stable tests.
  • Mocks/Controller:
    • Expands Arbitrum mocks (ETH/USDC balances, Token/Accounts APIs, Tx Sentinel).
    • Enhances Perps controller mixin/service: cancel orders, TP/SL updates, funding/orders/fills history, deposits, realistic liq price, position close fills.
  • App/UI hooks:
    • Adds testIDs: Perps onboarding button in empty state, market tabs list, refined tab selectors; minor Perps tab balance/actions IDs.
  • E2E Pages/Specs:
    • New pages and helpers for deposits, transactions, market list/details, tab bar.
    • New specs: add-funds, activity transactions, limit long fill, position open/close, liquidation; modifiers support command-queue commands.
  • CI:
    • Splits SmokeTrade jobs (Android/iOS) into 2 shards.
  • Tooling:
    • Sonar exclusions updated; various selectors/utilities hardened.

Written by Cursor Bugbot for commit 820d3aa. This will update automatically on new commits. Configure here.

@racitores racitores requested review from a team as code owners October 8, 2025 12:18
@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

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.

cursor[bot]

This comment was marked as outdated.

@racitores racitores force-pushed the e2e-perps-add-funds branch from b104891 to b0745fc Compare October 8, 2025 12:25
@racitores racitores added the team-qa QA team label Oct 8, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@racitores racitores added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Oct 8, 2025
cursor[bot]

This comment was marked as outdated.

@racitores racitores force-pushed the e2e-perps-add-funds branch from 869e8c2 to 705146c Compare October 8, 2025 16:09
Copy link
Contributor

@christopherferreira9 christopherferreira9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

gambinish
gambinish previously approved these changes Oct 8, 2025
@racitores racitores force-pushed the e2e-perps-add-funds branch 2 times, most recently from eeb42d8 to 5e3fffb Compare October 21, 2025 11:56
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 50.00000% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.24%. Comparing base (d68cc52) to head (5e3fffb).
⚠️ Report is 38 commits behind head on main.

Files with missing lines Patch % Lines
app/components/UI/Perps/utils/e2eBridgePerps.ts 50.00% 9 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20936      +/-   ##
==========================================
+ Coverage   77.11%   77.24%   +0.13%     
==========================================
  Files        3615     3642      +27     
  Lines       89144    89531     +387     
  Branches    16861    16956      +95     
==========================================
+ Hits        68745    69160     +415     
+ Misses      15721    15698      -23     
+ Partials     4678     4673       -5     

☔ 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.

jvbriones
jvbriones previously approved these changes Oct 21, 2025
@racitores racitores force-pushed the e2e-perps-add-funds branch 2 times, most recently from b6ccbdf to 2feb60d Compare October 21, 2025 17:05
cursor[bot]

This comment was marked as outdated.

@racitores racitores changed the title E2e perps add funds test: E2e perps add funds Oct 22, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@racitores racitores force-pushed the e2e-perps-add-funds branch from 1f0e273 to a0eec33 Compare October 29, 2025 09:14
cursor[bot]

This comment was marked as outdated.

@racitores racitores requested a review from a team as a code owner October 29, 2025 18:05
cursor[bot]

This comment was marked as outdated.

@racitores racitores force-pushed the e2e-perps-add-funds branch from c48135b to 89b03b8 Compare October 30, 2025 10:31
racitores and others added 18 commits October 30, 2025 17:00
…ead of deeplinks (#21668)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
This PR refactors e2eBridgePerps to use the CommandQueueServer polling
instead of deeplinks.
All references to deeplinks in this context were kept.

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
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**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/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]
> Switches Perps E2E control from deeplinks to an HTTP-polled
CommandQueueServer queue and updates helpers/specs to enqueue commands.
> 
> - **E2E Bridge (Perps)**:
> - Add HTTP polling with axios to read commands from
`http://<host>:<port>/queue.json` (and `/debug.json`) and apply
`push-price`, `force-liquidation`, and `mock-deposit` via the Perps mock
service.
> - Start polling during `autoConfigureE2EBridge`; retain lightweight
deeplink handler as fallback.
> - **E2E Framework**:
> - `e2e/framework/fixtures/CommandQueueServer.ts`: export
`CommandQueueItem`; add `GET /debug.json` (non-destructive) alongside
existing `GET /queue.json` (clears queue).
> - **Test Helpers**:
> - `e2e/specs/perps/helpers/perps-modifiers.ts`: add server-backed
methods (`updateMarketPriceServer`, `triggerLiquidationServer`,
`applyDepositUSDServer`) that enqueue `PerpsModifiersCommandTypes`; keep
deeplink methods.
> - **Specs**:
> - `e2e/specs/perps/perps-add-funds.spec.ts`: use
`TestSuiteParams.commandQueueServer` and switch deposit mock to
`applyDepositUSDServer`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9e3a527. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@racitores racitores force-pushed the e2e-perps-add-funds branch from 89b03b8 to 820d3aa Compare October 30, 2025 16:01
@sonarqubecloud
Copy link

@racitores racitores mentioned this pull request Oct 30, 2025
7 tasks
github-merge-queue bot pushed a commit that referenced this pull request Oct 31, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR is splitting the content of another much bigger
[PR](#20936) to simplify
the review and merge

I'll be adding add funds in perps

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
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**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/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]
> Adds Perps E2E smoke tests and infrastructure (HTTP command-queue
bridge, mocks, Sentry module aliasing) and runs them on iOS/Android CI.
> 
> - **E2E Perps Infrastructure**:
> - Add HTTP command-queue polling in
`app/components/UI/Perps/utils/e2eBridgePerps.ts` with deep link handler
refinements, mock deposit, and duplicate-link protection.
> - Introduce command queue server
(`e2e/framework/fixtures/CommandQueueServer.ts`) and plumb ports via
`app/util/test/utils.js`, `shim.js`, Detox reverse ports, and fixture
lifecycle.
> - Expand Perps controller mixin
(`e2e/controller-mocking/mock-config/perps-controller-mixin.ts`) with
overrides for orders, fills, funding, cancel order, TP/SL updates,
deterministic liquidation price, and provider wrapping.
> - Enhance Perps mock service (`e2e/.../perps-e2e-mocks.ts`) with
deposits, close fills, orders history, TP/SL trigger orders, price/liq
handling, and seeded data.
> - Add Arbitrum RPC and API mocks
(`e2e/api-mocking/perps-arbitrum-mocks.ts`).
> - **New Tests & Page Objects**:
> - Add Perps “Add funds” smoke spec
(`e2e/specs/perps/perps-add-funds.spec.ts`) and helpers/pages
(`PerpsDepositView`, `PerpsDepositProcessingView`, updates to
`PerpsTabView`, `TabBarComponent`, `Matchers`).
> - Update deep link mapping to `metamask://e2e/perps/`
(`e2e/framework/DeepLink.ts`) and add server-driven modifiers.
> - **CI**:
> - Add `perps-android-smoke` and `perps-ios-smoke` jobs and include
them in report steps.
> - **Module Aliasing**:
> - Alias Sentry packages to E2E no-op mocks via `metro.config.js`; add
mock files under `e2e/module-mocking/sentry/`.
> - **Config/Quality**:
> - Exclude `e2eBridgePerps.ts` from Sonar analysis; add docs
(`e2e/docs/*`).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c904dce. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
salimtb pushed a commit that referenced this pull request Nov 4, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR is splitting the content of another much bigger
[PR](#20936) to simplify
the review and merge

I'll be adding add funds in perps

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
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**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/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]
> Adds Perps E2E smoke tests and infrastructure (HTTP command-queue
bridge, mocks, Sentry module aliasing) and runs them on iOS/Android CI.
> 
> - **E2E Perps Infrastructure**:
> - Add HTTP command-queue polling in
`app/components/UI/Perps/utils/e2eBridgePerps.ts` with deep link handler
refinements, mock deposit, and duplicate-link protection.
> - Introduce command queue server
(`e2e/framework/fixtures/CommandQueueServer.ts`) and plumb ports via
`app/util/test/utils.js`, `shim.js`, Detox reverse ports, and fixture
lifecycle.
> - Expand Perps controller mixin
(`e2e/controller-mocking/mock-config/perps-controller-mixin.ts`) with
overrides for orders, fills, funding, cancel order, TP/SL updates,
deterministic liquidation price, and provider wrapping.
> - Enhance Perps mock service (`e2e/.../perps-e2e-mocks.ts`) with
deposits, close fills, orders history, TP/SL trigger orders, price/liq
handling, and seeded data.
> - Add Arbitrum RPC and API mocks
(`e2e/api-mocking/perps-arbitrum-mocks.ts`).
> - **New Tests & Page Objects**:
> - Add Perps “Add funds” smoke spec
(`e2e/specs/perps/perps-add-funds.spec.ts`) and helpers/pages
(`PerpsDepositView`, `PerpsDepositProcessingView`, updates to
`PerpsTabView`, `TabBarComponent`, `Matchers`).
> - Update deep link mapping to `metamask://e2e/perps/`
(`e2e/framework/DeepLink.ts`) and add server-driven modifiers.
> - **CI**:
> - Add `perps-android-smoke` and `perps-ios-smoke` jobs and include
them in report steps.
> - **Module Aliasing**:
> - Alias Sentry packages to E2E no-op mocks via `metro.config.js`; add
mock files under `e2e/module-mocking/sentry/`.
> - **Config/Quality**:
> - Exclude `e2eBridgePerps.ts` from Sonar analysis; add docs
(`e2e/docs/*`).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c904dce. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@georgewrmarshall georgewrmarshall removed the request for review from a team November 6, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed size-XL team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants