Skip to content

Conversation

@cmd-ob
Copy link
Contributor

@cmd-ob cmd-ob commented Nov 4, 2025

Description

  • Introduced PortManager to handle port allocation and release for various servers.
  • Updated Ganache, MockServerE2E, DappServer, CommandQueueServer, FixtureServer, and AnvilManager to utilize PortManager for setting and releasing ports.
  • Added methods to set server ports and handle server status in respective classes.
  • Implemented retry logic for starting resources with automatic port management to avoid conflicts.
  • Updated FixtureUtils to include new port management functions and ensure correct RPC URLs are used based on allocated ports.
  • Update swaps tests to use Anvil (from ganache)

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 PortManager-driven dynamic port allocation with retries and platform handling, refactors test servers/utilities to use it, migrates swaps tests to Anvil, and standardizes “Network fee” casing.

  • E2E Infra (Port Management):
    • Introduces PortManager for dynamic/random port allocation (single/multi-instance), release, and BrowserStack fallbacks; adds robust retry start helpers (startResourceWithRetry, startMultiInstanceResourceWithRetry).
    • Implements Android adb reverse mapping, iOS LaunchArgs, and MockServer host-side fallback→actual port translation.
  • Server/Utility Refactors:
    • Update Ganache, AnvilManager, FixtureServer, CommandQueueServer, DappServer, MockServerE2E to setServerPort, track status, and release ports; DappServer supports multi-instance.
    • Revamps FixtureUtils/FixtureHelper APIs (getDappUrl*, get*PortForFixture, RPC/Dapp URL rewrites) and improves network-store/shim host resolution.
  • Tests:
    • New comprehensive PortManager.test.ts.
    • Migrate swaps tests to Anvil; update fixtures and helpers to new APIs; remove manual reverse logic.
  • UX/Text:
    • Standardize casing to Network fee across tests and locales/languages/en.json.
  • Misc:
    • Adjust allowlist/mocks; minor README formatting.

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

…tion

- Introduced PortManager to handle port allocation and release for various servers.
- Updated Ganache, MockServerE2E, DappServer, CommandQueueServer, FixtureServer, and AnvilManager to utilize PortManager for setting and releasing ports.
- Added methods to set server ports and handle server status in respective classes.
- Implemented retry logic for starting resources with automatic port management to avoid conflicts.
- Updated FixtureUtils to include new port management functions and ensure correct RPC URLs are used based on allocated ports.
@cmd-ob cmd-ob requested a review from a team as a code owner November 4, 2025 20:45
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 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.

@metamaskbot metamaskbot added the team-qa QA team label Nov 4, 2025
@github-actions github-actions bot added the size-L label Nov 4, 2025
@cmd-ob cmd-ob added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed and removed size-L labels Nov 4, 2025
@github-actions github-actions bot added the size-L label Nov 4, 2025
@github-actions github-actions bot added size-XL and removed size-L labels Nov 4, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.39%. Comparing base (d3e8361) to head (402cefd).
⚠️ Report is 63 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22158      +/-   ##
==========================================
+ Coverage   77.02%   77.39%   +0.36%     
==========================================
  Files        3805     3805              
  Lines       97085    96984     -101     
  Branches    18926    18911      -15     
==========================================
+ Hits        74781    75057     +276     
+ Misses      17164    16786     -378     
- Partials     5140     5141       +1     

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

@cmd-ob cmd-ob requested a review from a team as a code owner November 5, 2025 19:06
- Updated PortManager to use ResourceType instead of ResourceId for better clarity and maintainability.
- Introduced new methods for handling multi-instance resources and automatic port forwarding for Android.
- Refactored FixtureUtils to provide fallback ports for fixture data construction.
- Updated various fixture-related classes to utilize new port management methods.
- Removed deprecated functions and ensured backward compatibility where necessary.
- Improved logging for resource allocation and port management.
…ility and remove translateFallbackPortToActual in mockserver
@cmd-ob cmd-ob force-pushed the e2e/dynamic-port-allocation branch from 88511b1 to 96dd1e5 Compare November 11, 2025 19:19
for (let i = 1; i <= extraTabs; i++) {
this.fixture.state.browser.tabs.push({
url: getTestDappLocalUrlByDappCounter(i),
url: getDappUrl(i),
Copy link

Choose a reason for hiding this comment

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

Bug: Premature Port Access Breaks Fixture Construction

Calling getDappUrl(i) during fixture construction will fail on iOS because it calls getDappPort() which accesses PortManager before ports are allocated. This should use getDappUrlForFixture(i) instead, which returns fallback ports safe for fixture construction. On Android this works by coincidence since getDappUrl() returns fallback ports, but iOS will throw an error.

Fix in Cursor Fix in Web

@christopherferreira9 christopherferreira9 added the run-android-flask-e2e-smoke Run Android flask E2E tests on next CI run label Nov 12, 2025
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 great work!

@sonarqubecloud
Copy link

Copy link
Member

@OGPoyraz OGPoyraz left a comment

Choose a reason for hiding this comment

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

Confirmation changes LGTM

@cmd-ob cmd-ob enabled auto-merge November 12, 2025 13:47
@cmd-ob cmd-ob added the skip-e2e skip E2E test jobs label Nov 12, 2025
@cmd-ob cmd-ob added this pull request to the merge queue Nov 12, 2025
Merged via the queue into main with commit 601632f Nov 12, 2025
100 of 102 checks passed
@cmd-ob cmd-ob deleted the e2e/dynamic-port-allocation branch November 12, 2025 14:38
@github-actions github-actions bot locked and limited conversation to collaborators Nov 12, 2025
@metamaskbot metamaskbot added the release-7.60.0 Issue or pull request that will be included in release 7.60.0 label Nov 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.60.0 Issue or pull request that will be included in release 7.60.0 run-android-flask-e2e-smoke Run Android flask E2E tests on next CI run size-XL skip-e2e skip E2E test jobs team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants