Extends capybara-screenshot with inline image output.
In iTerm2 (nightly):
In Buildkite:
In your Gemfile simply replace capybara-screenshot
with capybara-inline-screenshot
:
gem 'capybara-inline-screenshot'
And where you initialize Capybara simply replace your call to:
require 'capybara-screenshot/rspec'
with:
require 'capybara-inline-screenshot/rspec'
The final step is to configure your build steps to upload the screenshot artifacts. The default path is your app’s tmp
directory, so the artifact upload pattern would be tmp/*.png
Thanks the wonder of ANSI escape codes if your terminal client doesn't understand the escape codes it'll simply ignore them—it'll just be be like using the standard capybara-screenshot gem.
If the CI
environment variable is present screenshots will be output in the Terminal artifact:// format with the expectation that the images are uploaded as build artifacts and inlined by your CI system. You can also force this mode by setting the environment variable CAPYBARA_INLINE_SCREENSHOT=artifact
.
If the CI
environment variable is not present screenshots will be output in the base64 encoded iTerm2 image format for viewing in a local terminal. You'll need the nightly release of iTerm to see the images.
See the LICENSE file for license rights and limitations (MIT).