From deac9ec430f652ddea485c92f39f7b00ebb4d4a5 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 30 Jan 2019 16:21:10 +0900 Subject: Fix system testing failure https://travis-ci.org/rails/rails/jobs/486155626#L1317-L1335 --- .../lib/action_dispatch/system_testing/browser.rb | 19 +++++++++++-------- .../test/dispatch/system_testing/driver_test.rb | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/actionpack/lib/action_dispatch/system_testing/browser.rb b/actionpack/lib/action_dispatch/system_testing/browser.rb index f691bd5fe5..2ffb5f67f6 100644 --- a/actionpack/lib/action_dispatch/system_testing/browser.rb +++ b/actionpack/lib/action_dispatch/system_testing/browser.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "selenium/webdriver" + module ActionDispatch module SystemTesting class Browser # :nodoc: @@ -30,18 +32,19 @@ module ActionDispatch end def capabilities - @option ||= case type - when :chrome - Selenium::WebDriver::Chrome::Options.new - when :firefox - Selenium::WebDriver::Firefox::Options.new - end + @option ||= + case type + when :chrome + Selenium::WebDriver::Chrome::Options.new + when :firefox + Selenium::WebDriver::Firefox::Options.new + end end private def headless_chrome_browser_options - capability.args << "--headless" - capability.args << "--disable-gpu" if Gem.win_platform? + capabilities.args << "--headless" + capabilities.args << "--disable-gpu" if Gem.win_platform? capabilities end diff --git a/actionpack/test/dispatch/system_testing/driver_test.rb b/actionpack/test/dispatch/system_testing/driver_test.rb index 2ab8fac666..0d08f17af3 100644 --- a/actionpack/test/dispatch/system_testing/driver_test.rb +++ b/actionpack/test/dispatch/system_testing/driver_test.rb @@ -23,6 +23,7 @@ class DriverTest < ActiveSupport::TestCase driver = ActionDispatch::SystemTesting::Driver.new(:selenium, using: :headless_chrome, screen_size: [1400, 1400], options: { url: "http://example.com/wd/hub" }) assert_equal :selenium, driver.instance_variable_get(:@name) assert_equal :headless_chrome, driver.instance_variable_get(:@browser).name + assert_instance_of Selenium::WebDriver::Chrome::Options, driver.instance_variable_get(:@browser).options assert_equal [1400, 1400], driver.instance_variable_get(:@screen_size) assert_equal ({ url: "http://example.com/wd/hub" }), driver.instance_variable_get(:@options) end @@ -31,6 +32,7 @@ class DriverTest < ActiveSupport::TestCase driver = ActionDispatch::SystemTesting::Driver.new(:selenium, using: :headless_firefox, screen_size: [1400, 1400], options: { url: "http://example.com/wd/hub" }) assert_equal :selenium, driver.instance_variable_get(:@name) assert_equal :headless_firefox, driver.instance_variable_get(:@browser).name + assert_instance_of Selenium::WebDriver::Firefox::Options, driver.instance_variable_get(:@browser).options assert_equal [1400, 1400], driver.instance_variable_get(:@screen_size) assert_equal ({ url: "http://example.com/wd/hub" }), driver.instance_variable_get(:@options) end -- cgit v1.2.3