Skip to content

Commit

Permalink
Fix webdrivers on 7-0-stable branch for issue #48973. (#48977)
Browse files Browse the repository at this point in the history
* Fix `webdrivers` on `7-0-stable` branch for issue #48973.

Update `Gemfile.lock`.

* Fix `ci/qunit-selenium-runner.rb`.

* Set specific `selenium-webdriver` options for ruby > 3.2.

On CI, require `selenium-webdriver` for Ruby > 3.2.

Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
  • Loading branch information
R.R and rafaelfranca committed Aug 23, 2023
1 parent 740c400 commit f9175db
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
11 changes: 6 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ gem "rake", ">= 13"
gem "sprockets-rails", ">= 2.0.0"
gem "propshaft", ">= 0.1.7"
gem "capybara", ">= 3.26"
gem "selenium-webdriver", ">= 4.0.0"
if RUBY_VERSION < "3"
gem "selenium-webdriver", "<= 4.9.0"
gem "webdrivers"
else
gem "selenium-webdriver", ">= 4.11.0"
end

gem "rack-cache", "~> 1.2"
gem "stimulus-rails"
Expand Down Expand Up @@ -109,10 +114,6 @@ end
gem "aws-sdk-sns", require: false
gem "webmock"

group :ujs do
gem "webdrivers"
end

# Action View
group :view do
gem "blade", require: false, platforms: [:ruby]
Expand Down
9 changes: 2 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ GEM
fugit (~> 1.1, >= 1.1.6)
sdoc (2.6.0)
rdoc (>= 5.0)
selenium-webdriver (4.7.1)
selenium-webdriver (4.11.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
Expand Down Expand Up @@ -556,10 +556,6 @@ GEM
json (>= 1.8)
nokogiri (~> 1.6)
rexml (~> 3.2)
webdrivers (5.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand Down Expand Up @@ -640,7 +636,7 @@ DEPENDENCIES
rubocop-rails
rubyzip (~> 2.0)
sdoc (>= 2.3.0)
selenium-webdriver (>= 4.0.0)
selenium-webdriver (>= 4.11.0)
sequel
sidekiq
sneakers
Expand All @@ -656,7 +652,6 @@ DEPENDENCIES
tzinfo-data
w3c_validators (~> 1.3.6)
wdm (>= 0.1.0)
webdrivers
webmock
webrick
websocket-client-simple!
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/system_testing/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def configure
yield options if block_given? && options
end

# driver_path can be configured as a proc. The webdrivers gem uses this
# driver_path can be configured as a proc.
# proc to update web drivers. Running this proc early allows us to only
# update the webdriver once and avoid race conditions when using
# parallel tests.
Expand Down
12 changes: 10 additions & 2 deletions ci/qunit-selenium-runner.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# frozen_string_literal: true

require "webdrivers"
if RUBY_VERSION < "3"
require "webdrivers"
elsif RUBY_VERSION > "3.2"
require "selenium-webdriver"
end
require_relative "test_run"

driver = if ARGV[1]
capability = ::Selenium::WebDriver::Remote::Capabilities.chrome
capability = if RUBY_VERSION > "3.2"
::Selenium::WebDriver::Options.chrome
else
::Selenium::WebDriver::Remote::Capabilities.chrome
end

::Selenium::WebDriver.for(:remote, url: ARGV[1], capabilities: [capability])
else
Expand Down
4 changes: 4 additions & 0 deletions railties/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Omit `webdrivers` gem dependency from `Gemfile` template

*Sean Doyle*

## Rails 7.0.7.2 (August 22, 2023) ##

* No changes.
Expand Down
2 changes: 2 additions & 0 deletions railties/lib/rails/generators/rails/app/templates/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
<%- if RUBY_VERSION < "3.0" -%>
gem "webdrivers"
<% end %>
end
<%- end -%>

0 comments on commit f9175db

Please sign in to comment.