aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/system_testing/browser.rb
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-01-29 17:54:16 -0500
committerGitHub <noreply@github.com>2019-01-29 17:54:16 -0500
commit94d54fa4ab641a0ddeb173409cb41cc5becc02a9 (patch)
tree0d9d2aa005388fb7980226068c720e6d362c451c /actionpack/lib/action_dispatch/system_testing/browser.rb
parent3d22069c6355dc60be65e01958cf32917bc53142 (diff)
parent1a4f61307286702205fd32b3aa62c26c21c9cce3 (diff)
downloadrails-94d54fa4ab641a0ddeb173409cb41cc5becc02a9.tar.gz
rails-94d54fa4ab641a0ddeb173409cb41cc5becc02a9.tar.bz2
rails-94d54fa4ab641a0ddeb173409cb41cc5becc02a9.zip
Merge pull request #35081 from eileencodes/ec-driver-option-updated
[UPDATED] Implement a way to add browser capabilities
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..f691bd5fe5 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 capabilities
+ @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?
+ capability.args << "--headless"
+ capability.args << "--disable-gpu" if Gem.win_platform?
- options
+ capabilities
end
def headless_firefox_browser_options
- options = Selenium::WebDriver::Firefox::Options.new
- options.args << "-headless"
+ capabilities.args << "-headless"
- options
+ capabilities
end
end
end