From 77b6f4b3f9cbae2386ca46590c729aa271b91eaa Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Tue, 14 Nov 2023 20:57:01 +0100 Subject: [PATCH] Replace webdrivers with selenium-webdriver 4.15 REDMINE-20415 --- pageflow.gemspec | 2 +- .../pageflow/support/config/capybara.rb | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/pageflow.gemspec b/pageflow.gemspec index 97dfc8aae..84cd99985 100644 --- a/pageflow.gemspec +++ b/pageflow.gemspec @@ -177,7 +177,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'puma', '~> 3.12' # Chrome Headless browser testing - s.add_development_dependency 'webdrivers', '= 5.3.0' + s.add_development_dependency 'selenium-webdriver', '~> 4.15' # View abstraction fro integration testing s.add_development_dependency 'domino', '~> 0.7.0' diff --git a/spec/support/pageflow/support/config/capybara.rb b/spec/support/pageflow/support/config/capybara.rb index 282912686..ca7f755c1 100644 --- a/spec/support/pageflow/support/config/capybara.rb +++ b/spec/support/pageflow/support/config/capybara.rb @@ -1,24 +1,19 @@ require 'capybara/rspec' require 'selenium-webdriver' require 'capybara/chromedriver/logger' -require 'webdrivers/chromedriver' Capybara.register_driver :selenium_chrome_headless_no_sandbox do |app| - browser_options = ::Selenium::WebDriver::Chrome::Options.new - browser_options.args << '--headless' - browser_options.args << '--disable-gpu' - # Required for chrome to work in container based Travis environment - # (see https://docs.travis-ci.com/user/chrome) - browser_options.args << '--no-sandbox' - - capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( - # see https://github.com/SeleniumHQ/selenium/issues/3738 - 'goog:loggingPrefs': {browser: 'ALL'} + options = Selenium::WebDriver::Options.chrome( + logging_prefs: {browser: 'ALL'} ) + options.add_argument('--headless') + options.add_argument('--no-sandbox') + options.add_argument('--disable-gpu') if Gem.win_platform? + Capybara::Selenium::Driver.new(app, browser: :chrome, - capabilities: [browser_options, capabilities]) + options: options) end Capybara.javascript_driver = :selenium_chrome_headless_no_sandbox