diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-10-13 15:17:17 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-10-17 07:35:48 +0900 |
commit | ada05850f84ee0eef5413950333e5b5332a64b48 (patch) | |
tree | 58d9b3df5e88c56749088e3e50cd41b071179ec4 /actionpack/lib/action_dispatch/system_testing | |
parent | 68a2888ef08faf38c0643921a8259beef5fbe630 (diff) | |
download | rails-ada05850f84ee0eef5413950333e5b5332a64b48.tar.gz rails-ada05850f84ee0eef5413950333e5b5332a64b48.tar.bz2 rails-ada05850f84ee0eef5413950333e5b5332a64b48.zip |
Add headless chrome driver to System Tests
Diffstat (limited to 'actionpack/lib/action_dispatch/system_testing')
-rw-r--r-- | actionpack/lib/action_dispatch/system_testing/driver.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/driver.rb b/actionpack/lib/action_dispatch/system_testing/driver.rb index 4279336f2f..770fbde74e 100644 --- a/actionpack/lib/action_dispatch/system_testing/driver.rb +++ b/actionpack/lib/action_dispatch/system_testing/driver.rb @@ -31,8 +31,24 @@ module ActionDispatch end end + def browser_options + if @browser == :headless_chrome + browser_options = Selenium::WebDriver::Chrome::Options.new + browser_options.args << "--headless" + browser_options.args << "--disable-gpu" + + @options.merge(options: browser_options) + else + @options + end + end + + def browser + @browser == :headless_chrome ? :chrome : @browser + end + def register_selenium(app) - Capybara::Selenium::Driver.new(app, { browser: @browser }.merge(@options)).tap do |driver| + Capybara::Selenium::Driver.new(app, { browser: browser }.merge(browser_options)).tap do |driver| driver.browser.manage.window.size = Selenium::WebDriver::Dimension.new(*@screen_size) end end |