Skip to content

Commit

Permalink
Add capybara-screenshot; saves a screenshot any time a feature test f…
Browse files Browse the repository at this point in the history
…ails
  • Loading branch information
hackartisan committed Nov 29, 2018
1 parent 0695823 commit 5720f93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ group :development, :test do
gem 'capistrano-rails-console'
gem 'capybara'
gem 'capybara-selenium'
gem 'capybara-screenshot'
gem 'coveralls', require: false
gem 'database_cleaner'
gem 'factory_bot_rails', require: false
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-screenshot (1.0.22)
capybara (>= 1.0, < 4)
launchy
capybara-selenium (0.0.6)
capybara
selenium-webdriver
Expand Down Expand Up @@ -293,6 +296,8 @@ GEM
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
launchy (2.4.3)
addressable (~> 2.3)
leaflet-rails (1.3.1)
rails (>= 4.2.0)
legato (0.7.0)
Expand Down Expand Up @@ -587,6 +592,7 @@ DEPENDENCIES
capistrano-rails
capistrano-rails-console
capybara
capybara-screenshot
capybara-selenium
coffee-rails
coveralls
Expand Down
8 changes: 6 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "pry-byebug"
require "simplecov"
require "capybara/rspec"
require 'capybara-screenshot/rspec'
require "selenium-webdriver"
require 'webmock/rspec'

Expand All @@ -13,7 +14,10 @@
add_filter '/spec'
end

Capybara.register_driver :headless_chrome do |app|
# This driver uses headless chrome but we call it
# :selenium to conform to a capybara-screenshot convention
# see https://github.com/mattheworiordan/capybara-screenshot/issues/211
Capybara.register_driver :selenium do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu disable-setuid-sandbox window-size=7680,4320) }
)
Expand All @@ -26,7 +30,7 @@
desired_capabilities: capabilities,
http_client: http_client)
end
Capybara.javascript_driver = :headless_chrome
Capybara.javascript_driver = :selenium
Capybara.default_max_wait_time = 15

RSpec.configure do |config|
Expand Down

0 comments on commit 5720f93

Please sign in to comment.