Skip to content

ci(ios): record test videos via patrol test --record-video - #3198

Open
Kendru98 wants to merge 4 commits into
masterfrom
ci/ios-simulator-record-video
Open

ci(ios): record test videos via patrol test --record-video#3198
Kendru98 wants to merge 4 commits into
masterfrom
ci/ios-simulator-record-video

Conversation

@Kendru98

@Kendru98 Kendru98 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Record iOS-simulator test videos via the CLI --record-video flag (#2741), replacing the flaky manual simctl recordVideo + ffmpeg capture, plus the two patrol_cli fixes needed to make it work.

Changes

  • workflowstest-ios-simulator + test-ios-simulator-webview run patrol test … --record-video, upload videos/ as an artifact, link it in the summary.
  • patrol_cli: log capture — read the simulator log via simctl spawn instead of the host log stream (host stream misses simulator processes → no PATROL_LOG events → recording never started + Total: 0 summary).
  • patrol_cli: recorder stop — start simctl without a shell so SIGINT lands, + a 10s force-kill timeout.

Why the stop timeout

A fast-failing test can send the stop-SIGINT before simctl starts recording; it's ignored, simctl runs forever and holds the simulator, hanging the whole job (hung run, ~40 min). The timeout force-kills it so it can't hang the run (as the Android recorder already does). Video is still saved.

Verified

test ios simulator green; webview completes without hanging and uploads videos. Remaining webview reds are pre-existing test flakiness, unrelated to recording.

Replace the flaky manual iOS simulator recording (a single
`xcrun simctl io recordVideo` capture killed with SIGINT, then
re-encoded with ffmpeg to repair the MP4) with the CLI's new
`--record-video` flag, which records one MP4 per test case and
finalizes each file itself.

- test-ios-simulator-webview: drop the simctl+ffmpeg block, run
  `patrol test --record-video --video-output-dir videos`, upload the
  whole `videos/` dir and link it in the job summary.
- test-ios-simulator: re-add recording (previously removed for
  flakiness) via the same flags + upload/summary steps.
- WORKFLOWS.md: describe the new per-test recording flow.
Copilot AI review requested due to automatic review settings July 27, 2026 09:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates iOS simulator CI video capture to Patrol’s per-test recording.

Changes:

  • Enables --record-video in both iOS simulator workflows.
  • Uploads recordings and adds job-summary download links.
  • Updates workflow documentation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/test-ios-simulator.yaml Adds recording and artifact upload.
.github/workflows/test-ios-simulator-webview.yaml Replaces manual recording with Patrol recording.
.github/WORKFLOWS.md Documents the new recording flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/WORKFLOWS.md Outdated
On iOS simulators the app streams its `PATROL_LOG ...` lines to the
simulator's unified log. patrol_cli read them with a bare host
`log stream`, which on recent macOS/Xcode does not include the
simulator's processes — so no `PATROL_LOG` entries arrived. The test
summary showed `Total: 0` and, because per-test video recording is
driven by those test lifecycle events, `--record-video` never started
a recording on iOS.

Read the simulator's own log with
`xcrun simctl spawn <udid> log stream --type log --color none`
instead (physical devices keep using `idevicesyslog`). This is the same
capture the CI workflows already use successfully for their raw
simulator-log artifacts.
@github-actions github-actions Bot added the package: patrol_cli Related to the patrol_cli package label Jul 27, 2026
@Kendru98
Kendru98 force-pushed the ci/ios-simulator-record-video branch 3 times, most recently from 40786b7 to c77756c Compare July 27, 2026 13:24
Two problems made `--record-video` hang the run on iOS simulators:

1. The recording process was started in a shell (`runInShell: true`), so
   the SIGINT used to stop it hit the shell wrapper instead of `simctl`.
   On CI the shell didn't forward the signal, so `simctl` kept recording
   and the run hung. Start the process directly so SIGINT reaches
   `simctl`, which finalizes the .mp4 and exits.

2. `simctl io recordVideo` takes several seconds to actually start
   recording. If a test fails fast, the stop-SIGINT can arrive during
   that startup window and be ignored, leaving the recording running
   forever (and holding the simulator hostage from later tests). Bound
   the wait for exit with a short timeout that force-kills the process,
   so a stuck recording can never hang the run. Mirrors the timeout the
   Android screenrecord manager already uses.
@Kendru98
Kendru98 force-pushed the ci/ios-simulator-record-video branch from c77756c to 2988ffb Compare July 27, 2026 13:54
@Kendru98
Kendru98 marked this pull request as ready for review July 27, 2026 13:55

@pdenert pdenert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the cleanup in comments. Apart from that LGTM

Comment thread packages/patrol_cli/lib/src/ios/ios_test_backend.dart Outdated
Comment thread packages/patrol_cli/lib/src/ios/ios_video_recording_manager.dart Outdated
Comment thread packages/patrol_cli/lib/src/ios/ios_video_recording_manager.dart Outdated
- Fix webview iOS version in WORKFLOWS.md (26.0 -> 26.2).
- Remove/shorten iOS log-capture and recorder comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: patrol_cli Related to the patrol_cli package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants