Created
June 17, 2017 08:58
-
-
Save jdelStrother/2ce5786f774962c287f44704b3cd978f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.register_driver :chrome do |app| | |
require 'selenium-webdriver' | |
client = Selenium::WebDriver::Remote::Http::Default.new | |
opts = { | |
chrome_options: { | |
# Canary has a couple of benefits right now - eg screenshots actually work. | |
binary: "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" | |
args: %w[headless] | |
} | |
} | |
if ENV['CAPYBARA_DEBUG'] | |
opts[:loggingPrefs] = { browser: 'ALL', driver: 'ALL' } | |
end | |
caps = Selenium::WebDriver::Remote::Capabilities.chrome(opts) | |
Capybara::Selenium::Driver.new(app, browser: :chrome, | |
http_client: client, | |
driver_opts: { log_path: Rails.root.join("log/test-chrome-#{ENV['TEST_ENV_NUMBER']}.log") }, | |
desired_capabilities: caps) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment