Skip to content

Instantly share code, notes, and snippets.

@bergerjac
Created March 31, 2015 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergerjac/c6c88102d191f5d94ad3 to your computer and use it in GitHub Desktop.
Save bergerjac/c6c88102d191f5d94ad3 to your computer and use it in GitHub Desktop.
capybara-screenshot
# nano features/support/capybara-screenshot.rb
# screenshot_and_save_page
# screenshot_and_open_image
# disable the auto-generate on failure feature
# Capybara::Screenshot.autosave_on_failure = false
# only keep screenshots from last fail
Capybara::Screenshot.prune_strategy = :keep_last_run
# only keep up to n screenshots
Capybara::Screenshot.prune_strategy = { keep: 20 }
Capybara::Screenshot.webkit_options = { width: 1024, height: 768 }
Capybara.save_and_open_page_path = "tmp/capybara/screenshots"
# nano features/support/env.rb
require 'capybara-screenshot/cucumber'
Capybara.configure do |config|
config.run_server = false
config.app_host = 'http://localhost:3066'
end
group :test do
gem 'capybara-screenshot'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment