aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/system_testing/browser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/system_testing/browser.rb')
-rw-r--r--actionpack/lib/action_dispatch/system_testing/browser.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/browser.rb b/actionpack/lib/action_dispatch/system_testing/browser.rb
index 1b0bce6b9e..9361b165ff 100644
--- a/actionpack/lib/action_dispatch/system_testing/browser.rb
+++ b/actionpack/lib/action_dispatch/system_testing/browser.rb
@@ -29,20 +29,27 @@ module ActionDispatch
end
end
+ def driver_option
+ @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
- options = Selenium::WebDriver::Chrome::Options.new
- options.args << "--headless"
- options.args << "--disable-gpu" if Gem.win_platform?
+ driver_option.args << "--headless"
+ driver_option.args << "--disable-gpu" if Gem.win_platform?
- options
+ driver_option
end
def headless_firefox_browser_options
- options = Selenium::WebDriver::Firefox::Options.new
- options.args << "-headless"
+ driver_option.args << "-headless"
- options
+ driver_option
end
end
end