-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
test: E2e perps add funds #20936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
test: E2e perps add funds #20936
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. |
b104891 to
b0745fc
Compare
869e8c2 to
705146c
Compare
christopherferreira9
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
eea1afb
eeb42d8 to
5e3fffb
Compare
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
b6ccbdf to
2feb60d
Compare
1f0e273 to
a0eec33
Compare
c48135b to
89b03b8
Compare
…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 -->
89b03b8 to
820d3aa
Compare
|
<!-- 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 -->
<!-- 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 -->



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
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
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.
/queue.json,/debug.json) with app-side polling (e2eBridgePerps.ts) and deeplink handling cleanup; ports wired viautils.jsandshim.js(XHR proxy bypass for localhost).metamask://uniformly.Written by Cursor Bugbot for commit 820d3aa. This will update automatically on new commits. Configure here.