Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title: [Feature Request] Improve XCUITest Screen Recording #332

Open
tgz0514 opened this issue Feb 10, 2025 · 1 comment
Open

Title: [Feature Request] Improve XCUITest Screen Recording #332

tgz0514 opened this issue Feb 10, 2025 · 1 comment

Comments

@tgz0514
Copy link

tgz0514 commented Feb 10, 2025

Two enhancement requests for XCUITest screen recording:

  1. Save recording files directly on test device
  • Allow custom path and format (e.g. $HOME/video.mp4 or $HOME/video.mov)

Current problems:

  • Base64-encoded output is memory-intensive and inconvenient
  • HTTP/HTTPS/FTP requires additional server setup and lacks clear documentation examples
  1. Fix frame dropping on macOS
  • Current startNativeScreenRecording has noticeable frame drops
  • Native tools like QuickTime Player and screencapture don't have this issue
  • Would appreciate insights into the technical differences and potential solutions

Environment:

  • macOS 15.3
  • Xcode 16.2
@mykola-mokhnach
Copy link
Contributor

Save recording files directly on test device

I have added a possibility to retrieve the recorded payload as a stream using BiDi web socket. See #333 for more details.

In order to make it work it is necessary:

  1. Enable BiDi by setting the webSocketUrl capability to true
  2. Before starting a new video recording via macos: startNativeScreenRecording subscribe to the appium:mac2.nativeVideoRecordingChunkAdded BiDi event. Check https://github.com/appium/java-client/blob/15229beab2e4738612606d34ab26a306d85b1e1e/src/e2eIosTest/java/io/appium/java_client/ios/IOSBiDiTest.java#L32 for an example client implementation
  3. Record each retrieved video chunk into a local file by decoding its payload from base64 and writing into a local file in the same sequence they arrive.
  4. Call macos: stopNativeScreenRecording with ignorePayload set to true in order to finish the video recording. Close the resulting video file after this API returns.

Fix frame dropping on macOS

I don't think there is any reliable solution to it as the recording itself is done by the system daemon called testmanagerd. Maybe, try to bump its process CPU priority

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

No branches or pull requests

2 participants