fix(e2e): improve Detox local debug build support#28965
Conversation
- .detoxrc.js: allow IOS_SIMULATOR env var to override device (falls
back to iPhone 16 Pro)
- tests/helpers.js: use !endsWith('.ci') instead of endsWith('debug')
so all non-CI configs use launchAppForDebugBuild; use METRO_PORT_E2E
or WATCHER_PORT for packager URL
- tests/flows/general.flow.ts: add WATCHER_PORT as fallback after
METRO_PORT_E2E for dismissDevScreens
- tests/jest.e2e.detox.config.js: load .js.env for shared infra vars
(WATCHER_PORT, IOS_SIMULATOR) alongside .e2e.env
|
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. |
Keep endsWith('debug') for backwards compatibility and add
!endsWith('.ci') to also route non-CI configs (e.g. ios.sim.main)
through launchAppForDebugBuild, since they use debug apps locally.
…S_SIMULATOR IOS_SIMULATOR is consumed by .detoxrc.js (Detox CLI, before Jest), not at test runtime. Remove misleading reference from the comment.
dotenv first-loaded wins on collisions. Load .e2e.env before .js.env so test accounts/flags are never overridden by infra vars.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes are foundational to the entire E2E test pipeline. A regression in any of these files could cause all tests to fail silently (wrong app launched, wrong Metro port, wrong simulator). Running all test tags is the conservative and correct approach to validate the infrastructure changes work correctly across all test suites. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8523269. Configure here.
| if ( | ||
| config.configurationName.endsWith('debug') || | ||
| !config.configurationName.endsWith('.ci') | ||
| ) { |
There was a problem hiding this comment.
CI API specs config bypasses recovery-based launch
High Severity
The ios.sim.apiSpecs Detox configuration is used on CI (via run-e2e-api-specs.yml / test:api-specs) with a release app (ios.${METAMASK_BUILD_TYPE}.release), but its name does not end with .ci. The new condition !config.configurationName.endsWith('.ci') causes it to route through launchAppForDebugBuild, which opens an expo-metamask://expo-development-client/ deep link — a URL scheme a release build does not handle. The API specs test calls withFixtures({ restartDevice: true }), which invokes TestHelpers.launchApp(), so this path is exercised on CI.
Reviewed by Cursor Bugbot for commit 8523269. Configure here.
|
|
✅ E2E Fixture Validation — Schema is up to date |





Description
Fixes several issues that prevent Detox e2e specs from running correctly in local debug builds:
.detoxrc.js— AllowIOS_SIMULATORenv var to override the hardcodediPhone 16 Prodevice type. Falls back to the default when unset, so CI is unaffected.tests/helpers.js— launch detection — The originalendsWith('debug')check never matched any Detox configuration name (ios.sim.main,ios.sim.flask,ios.sim.apiSpecs), solaunchAppForDebugBuildwas never called locally. This PR keeps the originalendsWith('debug')check for backwards compatibility and adds!endsWith('.ci')as a fallback, so all non-CI configs (which use debug apps likeios.debug) correctly route throughlaunchAppForDebugBuild. CI configs (ios.sim.main.ci,ios.sim.flask.ci) are unaffected — they still uselaunchAppWithRecoverywith release apps.tests/helpers.js— packager URL — UseMETRO_PORT_E2E/WATCHER_PORTfor the packager URL instead of hardcoded8081.METRO_PORT_E2Eremains the primary source,WATCHER_PORTis a fallback for local.js.envconfig.tests/flows/general.flow.ts— AddWATCHER_PORTas fallback afterMETRO_PORT_E2EindismissDevScreens, so local.js.envport config is respected.tests/jest.e2e.detox.config.js— Load.js.envvia dotenv for shared infra vars (WATCHER_PORT,IOS_SIMULATOR) alongside.e2e.env. dotenv never overrides existing vars, so.e2e.envkeys are unaffected.Backwards compatibility
METRO_PORT_E2Eremains the primary port source everywhere*.ci) are unaffected — they still use release apps and recovery-based launchIOS_SIMULATORfalls back toiPhone 16 Prowhen unsetChangelog
CHANGELOG entry: null
Related issues
Fixes: TAT-2942
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk: changes are limited to Detox/Jest e2e test configuration, but they do alter app launch routing and Metro port selection which could affect local/CI test stability if misconfigured.
Overview
Improves Detox local debug e2e runs by making the iOS simulator and Metro packager port configurable via env vars.
Detox now (1) allows
IOS_SIMULATORto override the default iOS device, (2) routes all non-*.ciconfigurations through the debug-build launch path intests/helpers.js, and (3) usesMETRO_PORT_E2EwithWATCHER_PORTfallback for both deep-link packager URLs anddismissDevScreens.Jest e2e config now loads
.js.envafter.e2e.envso shared infra vars likeWATCHER_PORTare available at runtime without overriding test-specific env.Reviewed by Cursor Bugbot for commit 8523269. Bugbot is set up for automated code reviews on this repo. Configure here.