Skip to content

test: add ios simulator screenrecord tests#250

Open
gmegidish wants to merge 1 commit into
mainfrom
test/ios-simulator-screenrecord
Open

test: add ios simulator screenrecord tests#250
gmegidish wants to merge 1 commit into
mainfrom
test/ios-simulator-screenrecord

Conversation

@gmegidish
Copy link
Copy Markdown
Member

Adds two screenrecord tests for the iOS simulator in test/simulator.spec.ts, mirroring the Android emulator tests (#249):

  • --time-limit 5 -> validates the MP4 with ffprobe.
  • no time limit -> sends SIGINT (Ctrl-C), validates the MP4.

Both assert a non-empty, ffprobe-decodable MP4 and that its dimensions match a screenshot. Unlike the emulator, the simulator records at native resolution (1170x2532 == screenshot), so the dimension assertion applies here.

Notes

  • No production code change needed: the simulator records via xcrun simctl io ... recordVideo locally, and mobilecli signals that local process (the actual writer), so Ctrl-C finalizes the MP4 correctly. (The Android fix in fix: finalize android screenrecord mp4 on ctrl-c by signaling on-device process #249 was needed because the writer ran on-device and didn't receive the forwarded signal.)
  • screenrecord emits progress on stderr (no JSON on stdout), so it can't use this file's JSON-parsing mobilecli() helper. Added dedicated runners that drive the binary directly while preserving the GOCOVERDIR coverage env.

Verification

Both tests pass on Test-iOS-26:

npx playwright test --project=simulator -g "screenrecord"
2 passed

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c2f918c-af8a-44d1-b065-68c7153bcd64

📥 Commits

Reviewing files that changed from the base of the PR and between 116ecc8 and 077fe5f.

📒 Files selected for processing (1)
  • test/simulator.spec.ts

Walkthrough

This PR adds iOS simulator screenrecord test coverage to test/simulator.spec.ts. The changes introduce the spawn import for direct process control, define a Dimensions type for tracking video/screenshot dimensions, add a new test suite with two screenrecord scenarios (one with --time-limit and another interrupted by Ctrl-C), and implement helper functions to drive the screenrecord binary, validate MP4 playability using ffprobe, extract PNG dimensions from the IHDR chunk, and verify that recorded video dimensions match screenshot dimensions.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding iOS simulator screenrecord tests to the test suite.
Description check ✅ Passed The description is directly related to the changeset, providing context about the tests added, their purpose, relevant notes, and verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/ios-simulator-screenrecord

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant