test(e2e): make all contentious e2e resources configurable - #9099
test(e2e): make all contentious e2e resources configurable#9099mikehardy wants to merge 12 commits into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enables parallel E2E testing on a single host by making infrastructure resources—such as Metro bundler ports, Jet WebSocket ports, and Firebase emulator suites—configurable via environment variables. By allowing each test run to operate within a distinct 'slot' with its own ports and device instances, the changes eliminate resource contention while maintaining backward compatibility with existing serial test workflows. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a configurable e2e environment to support parallel test runs on a single host using slotted ports and dedicated device clones. It includes scripts for cloning simulators and emulators, and updates configurations, test suites, and native AppDelegates to resolve ports dynamically. The review feedback identifies a critical issue where a dynamic require of an e2e helper in the production AI package will cause consumer build failures. Other feedback addresses a version sorting bug in simulator creation, fragile sed usage, a port-reversing limitation in Detox configurations, and inconsistent Detox global references.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9099 +/- ##
============================================
- Coverage 68.36% 63.61% -4.74%
Complexity 1914 1914
============================================
Files 516 411 -105
Lines 37853 31135 -6718
Branches 5183 4446 -737
============================================
- Hits 25875 19804 -6071
+ Misses 10187 9868 -319
+ Partials 1791 1463 -328
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Hello 👋, this PR has been opened for more than 14 days with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
|
will come back to this shortly |
c15f401 to
1655f36
Compare
Resolve platform-specific Metro, Jet, and Firebase emulator endpoints from RNFB_* environment variables while preserving serial defaults.
Derive per-platform port blocks and device identities from a slot, provide clean export/reset helpers, and pin serial Android defaults without Gradle-home isolation.
Probe and release slot-scoped ports, apps, simulators, and Android emulators with explicit all-slot recovery while keeping core lifecycle independent of Mellifera.
Derive slot-specific product names, bundle identifiers, binary paths, and Jet/Metro endpoints so macOS cells can run concurrently without process collisions.
Start each emulator suite in the background, fail on occupied ports or early exit, and return only after the Functions endpoint is listening.
Kill only listeners on the selected port, reset scoped Watchman state, start Metro without setsid, and wait for packager-status:running.
Keep console ports in the adb-supported range, distinguish Metro waits from device faults, recover retryable launches, and suppress the emulator crash-report modal.
Inject slot identity through environment variables while routing both serial and parallel runs through the same canonical build, packager, emulator, test, check, and release commands.
2144fbe to
8d7d1f9
Compare
Fail fast only on hard infrastructure markers, keep load-induced Detox status latency non-fatal, and centralize Android readiness behavior without serialization gates.
Provide an opt-in HTTP coordinator with FIFO reservations, resource catalogs, lease management, and CLI support for distributed e2e hosts.
Translate leases into RNFB_* environment files and drive smoke, iteration, log-harvest, and multi-platform verification through the canonical lifecycle commands.
Run all platform-slot cells concurrently, classify only hard startup infrastructure as fatal, centralize Detox latency policy, hard-exit dead Jet sessions, and document the final Law.
8d7d1f9 to
a07d46e
Compare
Summary
Make RNFB e2e ports, devices, and emulator suites configurable via environment variables so multiple platform runs can coexist on one host. Default behaviour is unchanged: unset env vars preserve serial
yarn tests:*commands, ports, and workflows.Rebased onto current
mainafter #9192 (tests-macos/split). Slotted e2e is reimplemented on that layout: two Metro roots (tests/for iOS/Android,tests-macos/for macOS). A full slot that runs android/ios and macos starts two packagers (distinctRNFB_{ANDROID,IOS,MACOS}_METRO_PORTs). Same-platform scale-out uses one git worktree per slot (3× android + 3× ios + 3× macos⇒ three worktrees).Tip:
7031b17b1(test(e2e): env-aware Firestore reconnect and macos packager after split).What landed
packages/app/e2e/helpers.js— shared Metro, Jet, and Firebase emulator host/port resolution. Platform-prefixedRNFB_{ANDROID,IOS,MACOS}_*first, thenRCT_METRO_PORT/ serial defaults.getE2eEmulatorHost()is10.0.2.2on Android and127.0.0.1on iOS/macOS (neverlocalhost).packages/app/e2e/config.e2e.jsreconnects Firestore throughgetE2eEmulatorHost()so Android slotted runs are not stuck onlocalhost.tests/.detoxrc.js/tests/.jetrc.js— multi-slot Android AVD / iOS simulator devices; env-driven reverse ports; Jet/Metro for android/ios only.tests-macos/.jetrc.js+tests-macos/.babelrc— macOS Jet spawn (stdio: ignore),RNFB_MACOS_PRODUCT_NAME, and the sameRNFB_*Babel inlines as mobile. Packager:yarn tests:macos:packager:*fromtests-macos/— neveryarn tests:packager:*for macOS Jet.PRODUCT_NAME—io.invertase.testing$(RNFB_MACOS_PRODUCT_NAME_SUFFIX)in the pbx; slottedRNFB_MACOS_PRODUCT_NAME=io.invertase.testing.sN. Do not passPRODUCT_NAME=on the xcodebuild CLI.tests/e2e/firebase.test.js— Jet spawn/orchestration and macOS stale-app guard respect slotted ports.auth,database,firestore,functions,ai) — emulator URLs through shared helpers (Functions localhost helper removed).AppDelegate.mm— honourRCT_METRO_PORT(mobiletests/ios, macOStests-macos/macos).export-slot-env.sh,start-emulator-slotted.sh,run-slotted-packager.sh,run-slotted-test-cover.sh,check-e2e-resources.sh/release-e2e-resources.sh(slot-scoped when env is loaded).create-android-avds.sh/create-ios-simulators.shprovisionTestingAVD-N/RNFB E2E iOS slot-N.okf-bundle/testing/running-e2e.md(slot lifecycle + dual packager roots),e2e-parallel-design.md,CONTRIBUTING.mdmacOS bullets.Slot formula (unchanged):
BASE=12000+slot*1000; android off 0, ios +100, macos +200; metro +7, jet +10, jet-control +11. Full carry-in of allRNFB_{ANDROID,IOS,MACOS}_*for Babel inline.A future orchestration layer (outside this PR) can reserve slots and export env; RNFB stays coordinator-agnostic. Untracked mellifera leftovers are not part of this PR.
Test plan
mainincluding thetests-macos/split; reimplement slotted packager/Jet/app path on the two Metro roots1× android ∥ 1× ios ∥ 1× macos(1485 / 1461 / 1281 passing per wave)yarn lint:js/ Jest helpers 13/13RCT_METRO_PORT; Functions usesgetE2eEmulatorHost()onlyyarn tests:macos:test-cover(and one native platform) still uses:8081/ default emulators