Skip to content

capture_ios_screenshots

Community Action Reference: Inspected directly from Fastlane core ruby gem definitions.

Supported Platforms: ios, mac

Generate new localized screenshots on multiple devices (via snapshot)

Parameters & Options

Total options available: 54

Key Type Env Variable Default Required Description
workspace String SNAPSHOT_WORKSPACE - No Path to the workspace file
project String SNAPSHOT_PROJECT - No Path to the project file
xcargs String SNAPSHOT_XCARGS - No Pass additional arguments to xcodebuild for the test phase. Be sure to quote the setting names and values e.g. OTHER_LDFLAGS=“-ObjC -lstdc++”
xcconfig String SNAPSHOT_XCCONFIG - No Use an extra XCCONFIG file to build your app
devices Array - - No A list of devices you want to take the screenshots from
languages Array - ["en-US"] Yes A list of languages which should be used
launch_arguments Array SNAPSHOT_LAUNCH_ARGUMENTS [""] Yes A list of launch arguments which should be used
output_directory String SNAPSHOT_OUTPUT_DIRECTORY screenshots Yes The directory where to store the screenshots
output_simulator_logs Fastlane::Boolean SNAPSHOT_OUTPUT_SIMULATOR_LOGS false No If the logs generated by the app (e.g. using NSLog, perror, etc.) in the Simulator should be written to the output_directory
ios_version String - - No By default, the latest version should be used automatically. If you want to change it, do it here
skip_open_summary String SNAPSHOT_SKIP_OPEN_SUMMARY false Yes Don’t open the HTML summary after running snapshot
skip_helper_version_check String SNAPSHOT_SKIP_SKIP_HELPER_VERSION_CHECK false Yes Do not check for most recent SnapshotHelper code
clear_previous_screenshots String SNAPSHOT_CLEAR_PREVIOUS_SCREENSHOTS false Yes Enabling this option will automatically clear previously generated screenshots before running snapshot
reinstall_app String SNAPSHOT_REINSTALL_APP false Yes Enabling this option will automatically uninstall the application before running it
erase_simulator String SNAPSHOT_ERASE_SIMULATOR false Yes Enabling this option will automatically erase the simulator before running the application
headless Fastlane::Boolean SNAPSHOT_HEADLESS true Yes Enabling this option will prevent displaying the simulator window
override_status_bar String SNAPSHOT_OVERRIDE_STATUS_BAR false Yes Enabling this option will automatically override the status bar to show 9:41 AM, full battery, and full reception (Adjust ‘SNAPSHOT_SIMULATOR_WAIT_FOR_BOOT_TIMEOUT’ environment variable if override status bar is not working. Might be because simulator is not fully booted. Defaults to 10 seconds)
override_status_bar_arguments String SNAPSHOT_OVERRIDE_STATUS_BAR_ARGUMENTS - No Fully customize the status bar by setting each option here. Requires override_status_bar to be set to true. See xcrun simctl status_bar --help
localize_simulator String SNAPSHOT_LOCALIZE_SIMULATOR false Yes Enabling this option will configure the Simulator’s system language
dark_mode Fastlane::Boolean SNAPSHOT_DARK_MODE - No Enabling this option will configure the Simulator to be in dark mode (false for light, true for dark)
app_identifier String SNAPSHOT_APP_IDENTIFIER - No The bundle identifier of the app to uninstall (only needed when enabling reinstall_app)
add_photos Array SNAPSHOT_PHOTOS - No A list of photos that should be added to the simulator before running the application
add_videos Array SNAPSHOT_VIDEOS - No A list of videos that should be added to the simulator before running the application
html_template String SNAPSHOT_HTML_TEMPLATE - No A path to screenshots.html template
buildlog_path String SNAPSHOT_BUILDLOG_PATH ~/Library/Logs/snapshot Yes The directory where to store the build log
clean String SNAPSHOT_CLEAN false Yes Should the project be cleaned before building it?
test_without_building Fastlane::Boolean SNAPSHOT_TEST_WITHOUT_BUILDING - No Test without building, requires a derived data path
configuration String SNAPSHOT_CONFIGURATION - No The configuration to use when building the app. Defaults to ‘Release’
sdk String SNAPSHOT_SDK - No The SDK that should be used for building the application
scheme String SNAPSHOT_SCHEME - No The scheme you want to use, this must be the scheme for the UI Tests
number_of_retries Integer SNAPSHOT_NUMBER_OF_RETRIES 1 Yes The number of times a test can fail before snapshot should stop retrying
stop_after_first_error String SNAPSHOT_BREAK_ON_FIRST_ERROR false Yes Should snapshot stop immediately after the tests completely failed on one device?
derived_data_path String SNAPSHOT_DERIVED_DATA_PATH - No The directory where build products and other derived data will go
result_bundle String SNAPSHOT_RESULT_BUNDLE false No Should an Xcode result bundle be generated in the output directory
test_target_name String SNAPSHOT_TEST_TARGET_NAME - No The name of the target you want to test (if you desire to override the Target Application from Xcode)
namespace_log_files String SNAPSHOT_NAMESPACE_LOG_FILES - No Separate the log files per device and per language
concurrent_simulators String SNAPSHOT_EXECUTE_CONCURRENT_SIMULATORS true Yes Take snapshots on multiple simulators concurrently. Note: This option is only applicable when running against Xcode 9
disable_slide_to_type String SNAPSHOT_DISABLE_SLIDE_TO_TYPE false No Disable the simulator from showing the ‘Slide to type’ prompt
cloned_source_packages_path String SNAPSHOT_CLONED_SOURCE_PACKAGES_PATH - No Sets a custom path for Swift Package Manager dependencies
package_cache_path String SNAPSHOT_PACKAGE_CACHE_PATH - No Sets a custom package cache path for Swift Package Manager dependencies
skip_package_dependencies_resolution Fastlane::Boolean SNAPSHOT_SKIP_PACKAGE_DEPENDENCIES_RESOLUTION false Yes Skips resolution of Swift Package Manager dependencies
disallow_xcodebuild_settings_lookup Fastlane::Boolean SNAPSHOT_DISALLOW_XCODEBUILD_SETTINGS_LOOKUP false Yes Raises an error instead of fetching build settings by running xcodebuild -showBuildSettings, which can take a long time on large projects. The error names the required build setting, so the corresponding option can be specified manually
disable_package_automatic_updates Fastlane::Boolean SNAPSHOT_DISABLE_PACKAGE_AUTOMATIC_UPDATES false Yes Prevents packages from automatically being resolved to versions other than those recorded in the Package.resolved file. This translates in the option -disableAutomaticPackageResolution being passed to xcodebuild
skip_package_repository_fetches Fastlane::Boolean SNAPSHOT_SKIP_PACKAGE_REPOSITORY_FETCHES false Yes Skips updating package dependencies from their remote. This translates in the option -skipPackageUpdates being passed to xcodebuild
package_authorization_provider String SNAPSHOT_PACKAGE_AUTHORIZATION_PROVIDER - No Lets xcodebuild use a specified package authorization provider (keychain|netrc)
testplan String SNAPSHOT_TESTPLAN - No The testplan associated with the scheme that should be used for testing
only_testing String SNAPSHOT_ONLY_TESTING - No Array of strings matching Test Bundle/Test Suite/Test Cases to run
skip_testing String SNAPSHOT_SKIP_TESTING - No Array of strings matching Test Bundle/Test Suite/Test Cases to skip
run_rosetta_simulator Fastlane::Boolean SNAPSHOT_RUN_ROSETTA_SIMULATOR false Yes Run simulator in a Rosetta mode
xcodebuild_formatter String - xcbeautify Yes xcodebuild formatter to use (ex: ‘xcbeautify’, ‘xcbeautify —quieter’, ‘xcpretty’, ‘xcpretty -test’). Use empty string (ex: ”) to disable any formatter (More information: https://docs.fastlane.tools/best-practices/xcodebuild-formatters/)
xcpretty_args String SNAPSHOT_XCPRETTY_ARGS - No DEPRECATED! Use xcodebuild_formatter: '' instead - Additional xcpretty arguments
disable_xcpretty Fastlane::Boolean SNAPSHOT_DISABLE_XCPRETTY - No Disable xcpretty formatting of build
suppress_xcode_output Fastlane::Boolean SNAPSHOT_SUPPRESS_XCODE_OUTPUT - No Suppress the output of xcodebuild to stdout. Output is still saved in buildlog_path
use_system_scm Fastlane::Boolean SNAPSHOT_USE_SYSTEM_SCM false Yes Lets xcodebuild use system’s scm configuration

Lane Context Shared Values

This action writes the following values to Actions.lane_context[SharedValues::...]:

Key Description
SharedValues::SNAPSHOT_SCREENSHOTS_PATH The path to the screenshots

Examples

capture_ios_screenshots
snapshot # alias for "capture_ios_screenshots"
capture_ios_screenshots(
skip_open_summary: true,
clean: true
)

Source & Upstream