Fastlane Screenshotbot Plugin
Fastlane plugin to upload screenshots to Screenshotbot for visual testing.
Features
- Install the Screenshotbot CLI
- Upload screenshots to Screenshotbot
Installation
Add to your fastlane/Pluginfile:
gem 'fastlane-plugin-screenshotbot'Or install directly:
fastlane add_plugin screenshotbotUsage
Add to your Fastfile:
lane :upload_screenshots do
screenshotbot(
screenshots_directory: "./screenshots",
channel: "production",
api_key: ENV["SCREENSHOTBOT_API_KEY"],
api_secret: ENV["SCREENSHOTBOT_API_SECRET"],
repo_url: "https://github.com/yourusername/your-repo"
)
endFor pull requests:
lane :upload_pr_screenshots do
screenshotbot(
screenshots_directory: "./screenshots",
channel: "pr-preview",
api_key: ENV["SCREENSHOTBOT_API_KEY"],
api_secret: ENV["SCREENSHOTBOT_API_SECRET"],
repo_url: "https://github.com/yourusername/your-repo",
is_pr: true,
pr_destination: ENV["GITHUB_BASE_REF"] || "main"
)
endIf you need to install the Screenshotbot CLI (as it's not part of your CI image or build setup steps):
lane :install_screenshotbot do
screenshotbot_installer
endOptions
| Option | Description | Required | Default |
|---|---|---|---|
screenshots_directory |
Directory with screenshots | ✅ | - |
channel |
Screenshotbot channel | ✅ | - |
api_key |
Screenshotbot API key | ✅ | - |
api_secret |
Screenshotbot API secret | ✅ | - |
repo_url |
Git repository URL | ✅ | - |
is_pr |
PR build flag | ❌ | false |
pr_destination |
PR target branch | ❌ | - |
api_hostname |
Custom API hostname | ❌ | - |
recorder_path |
Path to recorder binary | ❌ | ~/screenshotbot/recorder |
Contributing
See CONTRIBUTING.md.
License
This project is licensed under the MIT License - see the LICENSE file for details.