No commit activity in last 3 years
No release in over 3 years
Extends capybara-screenshot with inline image output
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

capybara-inline-screenshot

Extends capybara-screenshot with inline image output.

In iTerm3 (beta):

Screenshot of iTerm2

In Buildkite:

Screenshot of 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
end

Cucumber

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).