You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Phase Docs — NA reqs + consolidation | PDoc | open | open | open | documentation |`none`|`docs: new-architecture requirements + migration consolidation`| Opportunistic; does not gate 4. |
361
362
| Phase PD — platform divergence | PPD | open | open | open | documentation |`none`|`docs(<pkg>): …` per package | Opportunistic; gap-analysis first. |
362
363
| Phase R — remove `NativeModules` fallback | PR-fallback | open | open | open | pre-merge-validation |`full`| (Phase R) | Decision B. Jest + `app` e2e "unknown module throws". |
Copy file name to clipboardExpand all lines: okf-bundle/testing/running-e2e.md
+32-9Lines changed: 32 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,10 +97,11 @@ macOS: `yarn tests:macos:test-cover` only — same `:8090` transport, no Detox.
97
97
98
98
**Launch gate (orchestration race fix)** — `firebase.test.js` starts the test runner with `RNFB_JET_DEFER_RUN=1`. It listens on 8090 and **defers**`server.run()` until the host signals launch success:
99
99
100
-
1. Host waits for TCP **8090**, then Metro (debug) if needed, then `launchAppWithRetry`.
101
-
2. Host `POST`s **`/orchestrate-state`** (`{ "phase": "launch-pending" | "launch-ok" | … }`) to the control port (best-effort diagnostics).
102
-
3. After `launchApp` succeeds, host `POST`s **`/launch-ready`** → test runner calls `server.run()` and the app may receive the mocha-remote `run` action.
103
-
4. Mocha tests must not start during a stuck or retried `launchApp`; on inner launch retry the host may kill and respawn the test runner before `terminateApp`/simulator reboot.
100
+
1. On Android, host force-stops both test packages and clears any stray **8090** listener before spawning Jet.
101
+
2. Host waits for TCP **8090**, then Metro (debug) if needed, then `launchAppWithRetry`.
102
+
3. Host `POST`s **`/orchestrate-state`** (`{ "phase": "launch-pending" | "launch-ok" | … }`) to the control port (best-effort diagnostics).
103
+
4. After `launchApp` succeeds, host `POST`s **`/launch-ready`** → test runner calls `server.run()` and the app may receive the mocha-remote `run` action.
104
+
5. Mocha tests must not start during a stuck or retried `launchApp`; on inner launch retry the host may kill and respawn the test runner before `terminateApp`/simulator reboot.
104
105
105
106
**Log markers** — `[rnfb-e2e] orchestrate-state=…`, `[jet-control] deferring server.run until POST /launch-ready`, `[jet-control] launch-ready received`, `[jet-control] listening on http://…:8091`, `[jet-coverage] …`, `Jet client connected`.
106
107
@@ -165,15 +166,34 @@ No in-flight test run on the target platform:
165
166
166
167
| Platform | Clear when |
167
168
|----------|------------|
168
-
|**Android**|[Host-clear probes](#host-clear-probes) pass (no instrumentation PID)|
|**iOS**|[Host-clear probes](#host-clear-probes) pass — **zero booted simulators** and no stray listener on `:8090`. Detox boots `iPhone 17` from `tests/.detoxrc.js`; do not pre-boot or leave simulators running. |
170
171
|**macOS**|[Host-clear probes](#host-clear-probes) pass (no `io.invertase.testing` process) |
171
172
172
173
Also wait for any visible unfinished `yarn tests:*:test-cover`.
173
174
175
+
<aid="android-app-reset-blocking"></a>
176
+
177
+
**Android app reset (blocking)** — run **before every** Android `:test-cover`, not only after a failed run:
178
+
179
+
```bash
180
+
adb -s emulator-5554 shell am force-stop com.invertase.testing
181
+
adb -s emulator-5554 shell am force-stop com.invertase.testing.test
182
+
```
183
+
184
+
The main app (`com.invertase.testing`) can sit on **“waiting for jet to start tests…”** while the [host-clear probe](#host-clear-probes) still passes (it only checks `com.invertase.testing.test`). A stale main app then connects as a **second Jet client** after Detox launches a fresh run → `Received a message from the client, but server wasn't running` and no Mocha summary. Force-stop **both** packages, then re-run the probe.
185
+
186
+
On **darwin** hosts, also clear the macOS test app before Android `:test-cover` — macOS and Android share Jet **`:8090`**. Alternating macOS and Android runs without killing `io.invertase.testing` leaves a stale macOS Jet client that connects when Android starts → duplicate clients and `server wasn't running`.
187
+
188
+
```bash
189
+
! pgrep -x io.invertase.testing >/dev/null 2>&1
190
+
```
191
+
192
+
(`firebase.test.js` runs this automatically via `ensureAndroidJetHostClear` before spawning Android Jet; use the probe manually when prepping from the runbook.)
193
+
174
194
<aid="host-clear-probes"></a>
175
195
176
-
**Host-clear probes** — run the block for your platform; **exit 0 = clear** (chain with `&&`):
196
+
**Host-clear probes** — run after [Android app reset](#android-app-reset-blocking) (Android) or directly (iOS/macOS); **exit 0 = clear** (chain with `&&`):
**Pre-flight recovery** — when probes fail afterabort, kill, or `EADDRINUSE` on `:8090`. Then re-run [host-clear probes](#host-clear-probes).
212
+
**Pre-flight recovery** — when probes fail **after**[Android app reset](#android-app-reset-blocking), abort, kill, or `EADDRINUSE` on `:8090`. Before any new `:test-cover`, kill the stray **8090** listener, re-run force-stop (Android) or the iOS/macOS steps below, then[host-clear probes](#host-clear-probes).
193
213
194
214
```bash
195
-
# Android
215
+
# Android — force-stop both apps, then clear the Jet WS listener
196
216
adb -s emulator-5554 shell am force-stop com.invertase.testing
197
217
adb -s emulator-5554 shell am force-stop com.invertase.testing.test
After Android recovery, verify `pidof com.invertase.testing.test` is empty and `:8090` is closed before rerunning `:test-cover`.
228
+
206
229
Do **not** use `boot-simulator.sh` or `simctl shutdown all` as routine prep ([what not to do](#what-not-to-do)).
207
230
208
231
#### 2. Services ready
@@ -332,7 +355,7 @@ Each run owns its blocking `:test-cover` and returns summaries only.
332
355
333
356
### Interrupted run (abort, killed terminal, EADDRINUSE on :8090)
334
357
335
-
Run [pre-flight recovery](#pre-flight-recovery), confirm [host-clear probes](#host-clear-probes) pass, then rerun from repo root: `yarn tests:<platform>:build && yarn tests:<platform>:test-cover` (foreground; tee if logging).
358
+
Run [pre-flight recovery](#pre-flight-recovery), confirm [host-clear probes](#host-clear-probes) pass, then rerun from repo root: `yarn tests:<platform>:build && yarn tests:<platform>:test-cover` (foreground; tee if logging). Keep one `:test-cover` active at a time on a host.
0 commit comments