CircleCI Video Recording is an example configuration of CircleCI's config.yml and fastlane's Fastfile which lets you record your iOS XCTests. It uses applescript files for the recording process.
You need to initialize CircleCI and fastlane in order to use CircleCI Video Recording. You can setup CircleCI by following this documentation and fastlane with this one. MacOS environment is needed in order to run XCTests and record video of them.
Copy .circleci and Fastlane folders from CircleCI Video Recording to your project. After this, with every commit you make to Github, a commit workflow which runs XCTests will start on CircleCI and the recording will be saved as artifacts to CircleCI.
The commit triggers the build_test
job on CircleCI, the job runs build_and_test
lane from Fastlane.
The build_and_test
job first builds the application, then starts video recording. After the recording is started, it runs the tests and stops recording at the end.
tell application "QuickTime Player"
set recording to new screen recording
tell recording
start
delay 3
end tell
end tell
tell application "QuickTime Player"
set recording to document "screen recording"
tell recording
pause
set current_path to do shell script "pwd"
set file_path to current_path & "/testrecording.mov"
save in (file_path as POSIX file)
-- export in ("../testrecording.mov" as POSIX file) using settings preset "480p"
stop
return "Test recording saved to " & file_path
close
end tell
end tell
Applescript uses Quick Time and by default it saves videos as .mov files. However, these files can't be played on web and their file size is quite large. As a work around you can uncomment the below lines in Fastfile in order to convert the output video to .mp4 format.
sh("HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg")
sh('ffmpeg -y -i /Users/distiller/src/testrecording.mov -vf "setpts=1.25*PTS" -r 20 /Users/distiller/src/testrecording.mp4')
sh("rm /Users/distiller/src/testrecording.mov")
Connected2.me / Dogu Deniz Ugur @DoguD
CircleCI Video Recording is available under the MIT license. See the LICENSE file for more info.