capybara-inline-screenshot
Extends capybara-screenshot with inline image output.
In iTerm3 (beta):
In Buildkite:
Usage
In your Gemfile simply replace capybara-screenshot with capybara-inline-screenshot:
gem 'capybara-inline-screenshot'RSpec
For RSpec update your capabara-screenshot require statement from:
require 'capybara-screenshot/rspec'to:
require 'capybara-inline-screenshot/rspec'MiniTest
For MiniTest update your capabara-screenshot require statement from:
require 'capybara-screenshot/rspec'to:
require 'capybara-inline-screenshot/minitest'and then include it in your tests as you need:
class SystemTest < Minitest::Test
include CapybaraInlineScreenshot::Minitest
endCucumber
For Cucumber update your capabara-screenshot require statement from:
require 'capybara-screenshot/cucumber'to:
require 'capybara-inline-screenshot/cucumber'Artifact uploads
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
Fallback
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.
CI-mode
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.
License
See the LICENSE file for license rights and limitations (MIT).

