mirror of https://github.com/rails/rails
Fix tests for selenium-webdriver v4.5.0
`selenium-webdriver` v4.5.0 adds more entries ("acceptInsecureCerts" and "moz:debuggerAddress") to the `as_json` output for `Selenium::WebDriver::Firefox::Options`, causing an exact comparison of the Hash to fail. See SeleniumHQ/selenium@58f5833ba0.
This commit is contained in:
parent
c41e2f1bca
commit
6a0ec0e54e
|
@ -455,10 +455,11 @@ GEM
|
|||
fugit (~> 1.1, >= 1.1.6)
|
||||
sdoc (2.4.0)
|
||||
rdoc (>= 5.0)
|
||||
selenium-webdriver (4.1.0)
|
||||
selenium-webdriver (4.5.0)
|
||||
childprocess (>= 0.5, < 5.0)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
websocket (~> 1.0)
|
||||
sequel (5.52.0)
|
||||
serverengine (2.0.7)
|
||||
sigdump (~> 0.2.2)
|
||||
|
|
|
@ -69,7 +69,6 @@ class DriverTest < ActiveSupport::TestCase
|
|||
option.add_preference(:detach, true)
|
||||
end
|
||||
driver.use
|
||||
browser_options = driver.__send__(:browser_options)
|
||||
|
||||
expected = {
|
||||
"goog:chromeOptions" => {
|
||||
|
@ -79,7 +78,7 @@ class DriverTest < ActiveSupport::TestCase
|
|||
},
|
||||
"browserName" => "chrome"
|
||||
}
|
||||
assert_equal expected, browser_options[:capabilities].as_json
|
||||
assert_driver_capabilities driver, expected
|
||||
end
|
||||
|
||||
test "define extra capabilities using headless_chrome" do
|
||||
|
@ -89,7 +88,6 @@ class DriverTest < ActiveSupport::TestCase
|
|||
option.add_preference(:detach, true)
|
||||
end
|
||||
driver.use
|
||||
browser_options = driver.__send__(:browser_options)
|
||||
|
||||
expected = {
|
||||
"goog:chromeOptions" => {
|
||||
|
@ -99,7 +97,7 @@ class DriverTest < ActiveSupport::TestCase
|
|||
},
|
||||
"browserName" => "chrome"
|
||||
}
|
||||
assert_equal expected, browser_options[:capabilities].as_json
|
||||
assert_driver_capabilities driver, expected
|
||||
end
|
||||
|
||||
test "define extra capabilities using firefox" do
|
||||
|
@ -108,7 +106,6 @@ class DriverTest < ActiveSupport::TestCase
|
|||
option.add_argument("--host=127.0.0.1")
|
||||
end
|
||||
driver.use
|
||||
browser_options = driver.__send__(:browser_options)
|
||||
|
||||
expected = {
|
||||
"moz:firefoxOptions" => {
|
||||
|
@ -117,7 +114,7 @@ class DriverTest < ActiveSupport::TestCase
|
|||
},
|
||||
"browserName" => "firefox"
|
||||
}
|
||||
assert_equal expected, browser_options[:capabilities].as_json
|
||||
assert_driver_capabilities driver, expected
|
||||
end
|
||||
|
||||
test "define extra capabilities using headless_firefox" do
|
||||
|
@ -126,7 +123,6 @@ class DriverTest < ActiveSupport::TestCase
|
|||
option.add_argument("--host=127.0.0.1")
|
||||
end
|
||||
driver.use
|
||||
browser_options = driver.__send__(:browser_options)
|
||||
|
||||
expected = {
|
||||
"moz:firefoxOptions" => {
|
||||
|
@ -135,7 +131,7 @@ class DriverTest < ActiveSupport::TestCase
|
|||
},
|
||||
"browserName" => "firefox"
|
||||
}
|
||||
assert_equal expected, browser_options[:capabilities].as_json
|
||||
assert_driver_capabilities driver, expected
|
||||
end
|
||||
|
||||
test "does not define extra capabilities" do
|
||||
|
@ -176,4 +172,11 @@ class DriverTest < ActiveSupport::TestCase
|
|||
driver = ActionDispatch::SystemTesting::Driver.new(:selenium, options: { name: :best_driver })
|
||||
assert_equal :best_driver, driver.name
|
||||
end
|
||||
|
||||
private
|
||||
def assert_driver_capabilities(driver, expected_capabilities)
|
||||
capabilities = driver.__send__(:browser_options)[:capabilities].as_json
|
||||
|
||||
assert_equal expected_capabilities, capabilities.slice(*expected_capabilities.keys)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue