test(e2e): make all contentious e2e resources configurable#9099
test(e2e): make all contentious e2e resources configurable#9099mikehardy wants to merge 1 commit 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 58.61% 58.62% +0.01%
- Complexity 1616 1617 +1
============================================
Files 503 503
Lines 39178 39199 +21
Branches 5807 5814 +7
============================================
+ Hits 22962 22977 +15
- Misses 14811 14822 +11
+ Partials 1405 1400 -5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
The following environment variables override serial e2e defaults when set
(before Metro build and :test-cover); unset vars keep legacy behaviour:
- RCT_METRO_PORT, RNFB_METRO_PORT, RNFB_{ANDROID,IOS,MACOS}_METRO_PORT
- JET_REMOTE_PORT, JET_METRO_PORT, RNFB_{ANDROID,IOS,MACOS}_JET_PORT, RNFB_JET_CONTROL_PORT
- RNFB_{ANDROID,IOS,MACOS}_EMULATOR_{FIRESTORE,AUTH,DATABASE,FUNCTIONS,STORAGE,HUB,LOGGING}_PORT
- RNFB_DETOX_ANDROID_CONFIG, RNFB_DETOX_IOS_CONFIG
- RNFB_E2E_PLATFORM, RNFB_E2E_SLOT, RNFB_E2E_DEBUG
- RNFB_ANDROID_AVD, RNFB_IOS_SIMULATOR, RNFB_ANDROID_EMULATOR_BOOT_ARGS
- ORG_GRADLE_PROJECT_reactNativeDevServerPort, SIMCTL_CHILD_RCT_METRO_PORT
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