mirror of https://github.com/rails/rails
Support selenium-webdriver 4
* Use public API to add argument to the selenium driver. While `args` is also public API it doesn't know how to handle if no argument is being set yet in Selenium 4. * Fix assertions to match return on Selenium 4
This commit is contained in:
parent
947a9f903a
commit
03156c829d
2
Gemfile
2
Gemfile
|
@ -10,7 +10,7 @@ gemspec
|
||||||
gem "rake", ">= 11.1"
|
gem "rake", ">= 11.1"
|
||||||
|
|
||||||
gem "capybara", ">= 3.26"
|
gem "capybara", ">= 3.26"
|
||||||
gem "selenium-webdriver", ">= 3.141.592"
|
gem "selenium-webdriver", ">= 4.0.0.alpha7"
|
||||||
|
|
||||||
gem "rack-cache", "~> 1.2"
|
gem "rack-cache", "~> 1.2"
|
||||||
gem "sass-rails"
|
gem "sass-rails"
|
||||||
|
|
11
Gemfile.lock
11
Gemfile.lock
|
@ -193,7 +193,7 @@ GEM
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
regexp_parser (~> 1.5)
|
regexp_parser (~> 1.5)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
childprocess (3.0.0)
|
childprocess (4.0.0)
|
||||||
coffee-script (2.4.1)
|
coffee-script (2.4.1)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
|
@ -455,9 +455,10 @@ GEM
|
||||||
tilt
|
tilt
|
||||||
sdoc (2.0.3)
|
sdoc (2.0.3)
|
||||||
rdoc (>= 5.0)
|
rdoc (>= 5.0)
|
||||||
selenium-webdriver (3.142.7)
|
selenium-webdriver (4.0.0.alpha7)
|
||||||
childprocess (>= 0.5, < 4.0)
|
childprocess (>= 0.5, < 5.0)
|
||||||
rubyzip (>= 1.2.2)
|
rubyzip (>= 1.2.2)
|
||||||
|
websocket (~> 1.0)
|
||||||
semantic_range (2.3.0)
|
semantic_range (2.3.0)
|
||||||
sequel (5.38.0)
|
sequel (5.38.0)
|
||||||
serverengine (2.0.7)
|
serverengine (2.0.7)
|
||||||
|
@ -605,7 +606,7 @@ DEPENDENCIES
|
||||||
rubocop-rails
|
rubocop-rails
|
||||||
sass-rails
|
sass-rails
|
||||||
sdoc (>= 2.0.3)
|
sdoc (>= 2.0.3)
|
||||||
selenium-webdriver (>= 3.141.592)
|
selenium-webdriver (>= 4.0.0.alpha7)
|
||||||
sequel
|
sequel
|
||||||
sidekiq
|
sidekiq
|
||||||
sneakers
|
sneakers
|
||||||
|
@ -625,4 +626,4 @@ DEPENDENCIES
|
||||||
websocket-client-simple!
|
websocket-client-simple!
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.1.4
|
2.2.3
|
||||||
|
|
|
@ -71,14 +71,14 @@ module ActionDispatch
|
||||||
|
|
||||||
def set_headless_chrome_browser_options
|
def set_headless_chrome_browser_options
|
||||||
configure do |capabilities|
|
configure do |capabilities|
|
||||||
capabilities.args << "--headless"
|
capabilities.add_argument("--headless")
|
||||||
capabilities.args << "--disable-gpu" if Gem.win_platform?
|
capabilities.add_argument("--disable-gpu") if Gem.win_platform?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_headless_firefox_browser_options
|
def set_headless_firefox_browser_options
|
||||||
configure do |capabilities|
|
configure do |capabilities|
|
||||||
capabilities.args << "-headless"
|
capabilities.add_argument("-headless")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,7 +69,8 @@ class DriverTest < ActiveSupport::TestCase
|
||||||
"args" => ["start-maximized"],
|
"args" => ["start-maximized"],
|
||||||
"mobileEmulation" => { "deviceName" => "iphone 6" },
|
"mobileEmulation" => { "deviceName" => "iphone 6" },
|
||||||
"prefs" => { "detach" => true }
|
"prefs" => { "detach" => true }
|
||||||
}
|
},
|
||||||
|
"browserName" => "chrome"
|
||||||
}
|
}
|
||||||
assert_equal expected, browser_options[:options].as_json
|
assert_equal expected, browser_options[:options].as_json
|
||||||
end
|
end
|
||||||
|
@ -88,7 +89,8 @@ class DriverTest < ActiveSupport::TestCase
|
||||||
"args" => ["--headless", "start-maximized"],
|
"args" => ["--headless", "start-maximized"],
|
||||||
"mobileEmulation" => { "deviceName" => "iphone 6" },
|
"mobileEmulation" => { "deviceName" => "iphone 6" },
|
||||||
"prefs" => { "detach" => true }
|
"prefs" => { "detach" => true }
|
||||||
}
|
},
|
||||||
|
"browserName" => "chrome"
|
||||||
}
|
}
|
||||||
assert_equal expected, browser_options[:options].as_json
|
assert_equal expected, browser_options[:options].as_json
|
||||||
end
|
end
|
||||||
|
@ -105,7 +107,8 @@ class DriverTest < ActiveSupport::TestCase
|
||||||
"moz:firefoxOptions" => {
|
"moz:firefoxOptions" => {
|
||||||
"args" => ["--host=127.0.0.1"],
|
"args" => ["--host=127.0.0.1"],
|
||||||
"prefs" => { "browser.startup.homepage" => "http://www.seleniumhq.com/" }
|
"prefs" => { "browser.startup.homepage" => "http://www.seleniumhq.com/" }
|
||||||
}
|
},
|
||||||
|
"browserName" => "firefox"
|
||||||
}
|
}
|
||||||
assert_equal expected, browser_options[:options].as_json
|
assert_equal expected, browser_options[:options].as_json
|
||||||
end
|
end
|
||||||
|
@ -122,7 +125,8 @@ class DriverTest < ActiveSupport::TestCase
|
||||||
"moz:firefoxOptions" => {
|
"moz:firefoxOptions" => {
|
||||||
"args" => ["-headless", "--host=127.0.0.1"],
|
"args" => ["-headless", "--host=127.0.0.1"],
|
||||||
"prefs" => { "browser.startup.homepage" => "http://www.seleniumhq.com/" }
|
"prefs" => { "browser.startup.homepage" => "http://www.seleniumhq.com/" }
|
||||||
}
|
},
|
||||||
|
"browserName" => "firefox"
|
||||||
}
|
}
|
||||||
assert_equal expected, browser_options[:options].as_json
|
assert_equal expected, browser_options[:options].as_json
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue