Deterministic Maestro flows against the test app. Full rationale: CONTEXT.md.
CI matrix: CI_MATRIX_DESIGN.md.
# 1. Fixtures (one-time, or after changing generate.sh; requires ffmpeg)
./e2e/fixtures/generate.sh
# 2. Serve fixtures (dependency-free — the same server CI starts via
# .github/actions/e2e-setup/action.yml; run it from the repo root and leave it running).
# iOS flows also open their deep links through it, on the booted simulator; with more
# than one simulator booted, start it with E2E_SIM_UDID=<udid>.
node e2e/fixtures/serve.mjs e2e/fixtures/media 8090
# 3. Pick the React Native version and install.
# 0.77 is the floor and needs no switch; see e2e/rn-matrix/README.md for the others.
# Switching rewrites test-app/package.json and the root bun.lock — restore them with
# `git checkout -- bun.lock test-app/package.json` before committing.
node scripts/e2e/use-rn-version.mjs 0.77
bun install --frozen-lockfile # also applies test-app/patches/ via the root postinstall
# 4. Bundle the app's JS. react-native-test-app embeds test-app/dist/ at build time and
# falls back to a Metro dev server when it is missing. Either build the bundle (what
# CI does) or keep `bun run --cwd test-app start` running instead.
bun run --cwd test-app build:android # or build:ios — before pod install on iOS
# Android: build a debug APK and install it on a running emulator. The bundle step above
# already generated test-app/android/app/build/generated/rnta/.../AndroidManifest.xml,
# BEFORE react-native-test-app applied the config plugins (deep-link intent filter,
# cleartext HTTP), and the generator only regenerates when app.json is newer than that
# file. Delete it so Gradle regenerates it with the plugins applied.
rm -rf test-app/android/app/build/generated/rnta
cd test-app/android && ./gradlew assembleDebug -PreactNativeArchitectures=x86_64 && cd ../..
adb install -r test-app/android/app/build/outputs/apk/debug/app-debug.apk
# iOS: install pods, build, then install on a booted simulator
# (see .github/workflows/_e2e-ios.yml for the exact CI commands this mirrors)
cd test-app && bundle install && bundle exec pod install --project-directory=ios && cd ..
xcodebuild -workspace test-app/ios/RNVideoE2E.xcworkspace \
-scheme RNVideoE2E -configuration Debug -sdk iphonesimulator \
-derivedDataPath build \
-destination "platform=iOS Simulator,name=<simulator name>" build
xcrun simctl boot "<simulator name>" || true # already-booted is fine, hence `|| true`
xcrun simctl install booted "$(find build/Build/Products -name '*.app' -maxdepth 3 | head -1)"
# 5. Run (APP_ID is com.rnvtest.host, from _e2e-android.yml's/_e2e-ios.yml's env)
maestro test -e APP_ID=com.rnvtest.host e2e/flows/ # all
maestro test -e APP_ID=com.rnvtest.host e2e/flows/smoke-mp4-happy-path.yaml # oneAndroid emulator reaches fixtures via 10.0.2.2:8090 (cleartext HTTP must be allowed in
the debug build), iOS simulator via localhost:8090 — handled in the app (fixtures.ts).
The test app renders player events as text markers with stable testIDs
(evt-onLoad, evt-progress-gt-2s, evt-onEnded, evt-onError, ...). Flows assert
marker visibility — never parse numbers, never assert on video pixels. Scenarios open via
deep links (rnvtest://scenario/<name>), never via UI navigation.
- If the scenario needs new app behavior: add its name to
SCENARIO_NAMESindeepLink.ts, its source infixtures.ts(the compiler requires one per name), and (if needed) a derived marker ineventLog.ts— markers over number-parsing, always. - Copy the closest existing flow in
e2e/flows/, rename, adjust deep link + assertions. Start withrunFlow: ../shared/launch-app.yaml(a clean launch that waits until the app can receive a deep link), then open scenarios throughrunFlow: ../shared/open-scenario.yamlwithSCENARIO, never with a bareopenLink: that subflow owns the deep-link transport retry, the iOS "Open in app?" confirmation and the wait for the scenario screen. To interact after the clip's natural end, wait withrunFlow: ../shared/wait-for-end.yaml, not onevt-onEndeddirectly. Press controls on an idle player throughrunFlow: ../shared/press.yamlwithBUTTON(testID) andNTH(1 for that control's first press in the scenario, 2 for its second): it waits for the app'spressed-<testID>-<n>marker and re-sends the tap only if that never appeared, so a tap lost in transport does not fail a flow and a marker the player never produces still does. Taps issued during playback stay baretapOn: iOS delivers them only once the player is idle, later than the subflow waits. - Timeouts: generous on first event after load (emulator decoders are slow to start), tight after playback is running. Clips are 8 s; only HLS's first load waits up to 40 s.
- End every flow that expects playback with
assertNotVisible: evt-onError, so an error after the asserted marker still fails it. - Run locally on the platforms you have before opening a PR; CI runs both. If you cannot run the suite at all, describe the scenario under "Test plan" in the pull request.
- One flow = one scenario = one file. Keep flows independent: each starts from a clean launch.
However a flow was drafted, the committed artifact is plain YAML, reviewed by hand.
- No external network in flows — local fixtures only.
- Zero retries on anything the flows assert. A flaky flow gets quarantined
(
tags: [flaky]) with an issue, never retried into a false green — a retry hides the race the flow just caught. The only retries in the suite are on transport: the iOS deep link (e2e/shared/open-scenario.yamlasks the fixture server to open it, and the server retriessimctl openurlwhen it times out on a hosted simulator; Maestro's ownretrydoes not catch that failure) and the tap ine2e/shared/press.yaml(re-sent only when the app never rendered the press marker); a scenario screen or marker that does not appear still fails the flow. - Bugfix in an E2E-coverable area ⇒ the PR includes a reproducing flow.