test(e2e): make all contentious e2e resources configurable#9099
test(e2e): make all contentious e2e resources configurable#9099mikehardy wants to merge 5 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 65.84% 65.88% +0.04%
- Complexity 1832 1833 +1
============================================
Files 497 498 +1
Lines 38761 38911 +150
Branches 5723 5843 +120
============================================
+ Hits 25518 25631 +113
- Misses 11770 11809 +39
+ Partials 1473 1471 -2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| }; | ||
|
|
||
| exports.getMetroPort = function getMetroPort() { | ||
| if (process.env.RCT_METRO_PORT) { |
There was a problem hiding this comment.
priority order here is flipped compared to jetrc and firebase.test.js. those check the platform specific RNFB var before RCT_METRO_PORT, but this checks RCT_METRO_PORT first. since RCT_METRO_PORT is often already set by RN tooling, this will silently point the bundle at the wrong metro port in slotted runs. can we match the other two and check platform specific first?
|
|
||
| function functionsEmulatorConnectHost() { | ||
| const host = getE2eEmulatorHost(); | ||
| return host === '10.0.2.2' ? '10.0.2.2' : 'localhost'; |
There was a problem hiding this comment.
this returns localhost for non android but functionsCallableUrl below uses 127.0.0.1 from getE2eEmulatorHost directly. can we drop this helper and just use getE2eEmulatorHost everywhere so both paths agree
Slot Metro/Jet/emulator ports per platform, self-detect at runtime, and fully isolate Firebase emulator suites (including Firestore websocket, Eventarc, and Cloud Tasks). Also covers macOS e2e completion detection (stdio detach / kill hardening) that shares the Jet/host harness files.
Allow RNFB_MACOS_PRODUCT_NAME (suffix-only xcodebuild env) so multiple macOS apps can run without colliding on the shared process name.
Summary
Make RNFB e2e ports, devices, and emulator suites configurable via environment variables so multiple platform runs can coexist on one host — as many iOS and Android
:test-coverjobs as you provision slots for, plus one macOS, all at once. Default behaviour is unchanged: unset env vars preserve existing serialyarn tests:*commands, ports, and workflows exactly.packages/app/e2e/helpers.js— shared Metro, Jet, and Firebase emulator host/port resolution with serial fallbacks.tests/.detoxrc.js— multi-slot Android AVD / iOS simulator devices and env-drivenreversePorts/ native Metro build prefix.tests/.jetrc.js— per-platform Jet and Metro ports from env for macOS (and host orchestration).tests/e2e/firebase.test.js— Jet spawn/orchestration and macOS stale-app guard respect slotted ports from env.tests/.babelrc— inline slotted port env vars into app bundles at build time.auth,database,firestore,functions,ai) — route emulator URLs through shared helpers.AppDelegate.mm(iOS/macOS) — honourRCT_METRO_PORTfrom the environment.package.json—RNFB_DETOX_ANDROID_CONFIG/RNFB_DETOX_IOS_CONFIGon Detox build/test scripts; generic AVD/sim setup scripts.firebase.emulator.template.json+start-emulator-slotted.sh— generate and start a per-platform Firebase emulator suite fromRNFB_*_EMULATOR_*env.create-android-avds.sh/create-ios-simulators.sh— provision cloned AVDs and named simulators for slots 1–4.okf-bundle/testing/running-e2e.md— documents the configurable env var surface.A future orchestration layer (outside this PR) will use these hooks to reserve slots and export env on demand — including parallel e2e on a single host — while RNFB itself stays coordinator-agnostic.
Test plan
yarn tests:macos:test-cover(and one native platform) unchanged vsmainRNFB_ANDROID_METRO_PORT/RNFB_ANDROID_JET_PORT/ emulator ports for slot 1 → Android build +:test-coverreaches emulators on non-default portsrunning-e2e.mdconfigurable section