mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
DRY chrome options in test
This commit is contained in:
parent
a02e0c94f0
commit
3f4d584e5a
1 changed files with 12 additions and 15 deletions
|
@ -3,25 +3,22 @@ require 'spec_helper'
|
|||
require 'selenium-webdriver'
|
||||
require 'shared_selenium_session'
|
||||
|
||||
chrome_options = {
|
||||
browser: :chrome,
|
||||
options: ::Selenium::WebDriver::Chrome::Options.new(args: ENV['TRAVIS'] ? ['no-sandbox' ] : [])
|
||||
}
|
||||
|
||||
if ENV['CAPYBARA_CHROME_HEADLESS']
|
||||
chrome_options[:options].args << 'headless'
|
||||
Selenium::WebDriver::Chrome.path='/usr/bin/google-chrome-beta' if ENV['TRAVIS']
|
||||
end
|
||||
|
||||
Capybara.register_driver :selenium_chrome do |app|
|
||||
args = ENV['TRAVIS'] ? ['no-sandbox' ] : []
|
||||
if ENV['CAPYBARA_CHROME_HEADLESS']
|
||||
args << 'headless'
|
||||
Selenium::WebDriver::Chrome.path='/usr/bin/google-chrome-beta' if ENV['TRAVIS']
|
||||
end
|
||||
Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args)
|
||||
Capybara::Selenium::Driver.new(app, chrome_options)
|
||||
end
|
||||
|
||||
Capybara.register_driver :selenium_chrome_clear_storage do |app|
|
||||
args = ENV['TRAVIS'] ? ['no-sandbox' ] : []
|
||||
if ENV['CAPYBARA_CHROME_HEADLESS']
|
||||
args << 'headless'
|
||||
Selenium::WebDriver::Chrome.path='/usr/bin/google-chrome-beta' if ENV['TRAVIS']
|
||||
end
|
||||
Capybara::Selenium::Driver.new(app, :browser => :chrome,
|
||||
:args => args,
|
||||
clear_local_storage: true,
|
||||
clear_session_storage: true)
|
||||
Capybara::Selenium::Driver.new(app, chrome_options.merge(clear_local_storage: true, clear_session_storage: true))
|
||||
end
|
||||
|
||||
module TestSessions
|
||||
|
|
Loading…
Add table
Reference in a new issue