Skip to content

Commit

Permalink
Merge pull request #2351 from jhawthorn/capybara_driver_name
Browse files Browse the repository at this point in the history
Use selenium_chrome_headless capybara driver name
  • Loading branch information
jhawthorn authored Nov 7, 2017
2 parents faad469 + e871250 commit faf3ce0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
24 changes: 7 additions & 17 deletions backend/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,15 @@

require "selenium/webdriver"

Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
Capybara.register_driver :selenium_chrome_headless do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
browser_options.args << '--headless'
browser_options.args << '--disable-gpu'
browser_options.args << '--window-size=1440,1080'
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end

Capybara.register_driver :chrome_headless do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu window-size=1440,1080) }
)

Capybara::Selenium::Driver.new app,
browser: :chrome,
desired_capabilities: capabilities
end

Capybara::Screenshot.register_driver(:chrome_headless) do |driver, path|
driver.browser.save_screenshot(path)
end

Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :chrome_headless).to_sym
Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :selenium_chrome_headless).to_sym

ActionView::Base.raise_on_missing_translations = true

Expand Down
4 changes: 2 additions & 2 deletions common_spree_dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
gem 'sass-rails'

group :test do
gem 'capybara', '~> 2.7'
gem 'capybara-screenshot'
gem 'capybara', '~> 2.15'
gem 'capybara-screenshot', '>= 1.0.18'
gem 'database_cleaner', '~> 1.3'
gem 'factory_bot_rails', '~> 4.8'
gem 'launchy'
Expand Down

0 comments on commit faf3ce0

Please sign in to comment.