Skip to content

Commit

Permalink
Fix system testing failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kamipo committed Jan 30, 2019
1 parent bf42e15 commit deac9ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 11 additions & 8 deletions 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:
Expand Down Expand Up @@ -30,18 +32,19 @@ def options
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
Expand Down
2 changes: 2 additions & 0 deletions actionpack/test/dispatch/system_testing/driver_test.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit deac9ec

Please sign in to comment.