Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🚀 Feature]: Ruby 3.4 support #14934

Open
voxik opened this issue Dec 23, 2024 · 4 comments
Open

[🚀 Feature]: Ruby 3.4 support #14934

voxik opened this issue Dec 23, 2024 · 4 comments

Comments

@voxik
Copy link

voxik commented Dec 23, 2024

Feature and motivation

Is there Ruby 3.4 support planned any time soon? The official release should be out in just two days

Usage example

Observing test failures such as:

  1) Selenium::WebDriver::Chrome::Options#as_json errors when unrecognized capability is passed
     Failure/Error:
       expect {
         options.as_json
       }.to raise_error(Error::WebDriverError, 'These options are not w3c compliant: {:foo=>"bar"}')

       expected Selenium::WebDriver::Error::WebDriverError with "These options are not w3c compliant: {:foo=>\"bar\"}", got #<Selenium::WebDriver::Error::WebDriverError: These options are not w3c compliant: {foo: "bar"}> with backtrace:
         # ./lib/selenium/webdriver/common/options.rb:118:in 'Selenium::WebDriver::Options#as_json'
         # ./spec/unit/selenium/webdriver/chrome/options_spec.rb:249:in 'block (4 levels) in <module:Chrome>'
         # ./spec/unit/selenium/webdriver/chrome/options_spec.rb:250:in 'block (3 levels) in <module:Chrome>'
         # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
     # ./spec/unit/selenium/webdriver/chrome/options_spec.rb:250:in 'block (3 levels) in <module:Chrome>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  2) Selenium::WebDriver::Edge::Options#as_json errors when unrecognized capability is passed
     Failure/Error:
       expect {
         options.as_json
       }.to raise_error(Error::WebDriverError, 'These options are not w3c compliant: {:foo=>"bar"}')

       expected Selenium::WebDriver::Error::WebDriverError with "These options are not w3c compliant: {:foo=>\"bar\"}", got #<Selenium::WebDriver::Error::WebDriverError: These options are not w3c compliant: {foo: "bar"}> with backtrace:
         # ./lib/selenium/webdriver/common/options.rb:118:in 'Selenium::WebDriver::Options#as_json'
         # ./spec/unit/selenium/webdriver/edge/options_spec.rb:211:in 'block (4 levels) in <module:Edge>'
         # ./spec/unit/selenium/webdriver/edge/options_spec.rb:212:in 'block (3 levels) in <module:Edge>'
         # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
     # ./spec/unit/selenium/webdriver/edge/options_spec.rb:212:in 'block (3 levels) in <module:Edge>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  3) Selenium::WebDriver::Support::Guards#disposition is pending without provided reason
     Failure/Error:
       expect(guards.disposition).to eq [:pending,
                                         'Test guarded; Guarded by {:foo=>false, :reason=>"No reason given"};']

       expected: [:pending, "Test guarded; Guarded by {:foo=>false, :reason=>\"No reason given\"};"]
            got: [:pending, "Test guarded; Guarded by {foo: false, reason: \"No reason given\"};"]

       (compared using ==)

       Diff:
       @@ -1,3 +1,3 @@
        [:pending,
       - "Test guarded; Guarded by {:foo=>false, :reason=>\"No reason given\"};"]
       + "Test guarded; Guarded by {foo: false, reason: \"No reason given\"};"]
     # ./spec/unit/selenium/webdriver/guard_spec.rb:80:in 'block (3 levels) in <module:Support>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  4) Selenium::WebDriver::Support::Guards#disposition is skipped without provided reason
     Failure/Error: expect(guards.disposition).to eq [:skip, message]

       expected: [:skip, "Test does not apply to this configuration; Guarded by {:foo=>true, :reason=>\"No reason given\"};"]
            got: [:skip, "Test does not apply to this configuration; Guarded by {foo: true, reason: \"No reason given\"};"]

       (compared using ==)

       Diff:
       @@ -1,3 +1,3 @@
        [:skip,
       - "Test does not apply to this configuration; Guarded by {:foo=>true, :reason=>\"No reason given\"};"]
       + "Test does not apply to this configuration; Guarded by {foo: true, reason: \"No reason given\"};"]
     # ./spec/unit/selenium/webdriver/guard_spec.rb:89:in 'block (3 levels) in <module:Support>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  5) Selenium::WebDriver::Support::Guards::Guard#message defaults to no reason given
     Failure/Error: expect(guard.message).to eq('Test guarded; Guarded by {:reason=>"No reason given"};')

       expected: "Test guarded; Guarded by {:reason=>\"No reason given\"};"
            got: "Test guarded; Guarded by {reason: \"No reason given\"};"

       (compared using ==)
     # ./spec/unit/selenium/webdriver/guard_spec.rb:161:in 'block (3 levels) in <module:Support>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  6) Selenium::WebDriver::Support::Guards::Guard#message accepts String
     Failure/Error: expect(guard.message).to eq('Test guarded; Guarded by {:reason=>"because"};')

       expected: "Test guarded; Guarded by {:reason=>\"because\"};"
            got: "Test guarded; Guarded by {reason: \"because\"};"

       (compared using ==)
     # ./spec/unit/selenium/webdriver/guard_spec.rb:174:in 'block (3 levels) in <module:Support>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  7) Selenium::WebDriver::Support::Guards::Guard#message has special message for exclude
     Failure/Error: expect(guard.message).to eq('Test skipped because it breaks test run; Guarded by {:reason=>"because"};')

       expected: "Test skipped because it breaks test run; Guarded by {:reason=>\"because\"};"
            got: "Test skipped because it breaks test run; Guarded by {reason: \"because\"};"

       (compared using ==)
     # ./spec/unit/selenium/webdriver/guard_spec.rb:194:in 'block (3 levels) in <module:Support>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  8) Selenium::WebDriver::Support::Guards::Guard#message has special message for flaky
     Failure/Error: expect(guard.message).to eq(msg)

       expected: "Test skipped because it is unreliable in this configuration; Guarded by {:reason=>\"because\"};"
            got: "Test skipped because it is unreliable in this configuration; Guarded by {reason: \"because\"};"

       (compared using ==)
     # ./spec/unit/selenium/webdriver/guard_spec.rb:201:in 'block (3 levels) in <module:Support>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

  9) Selenium::WebDriver::Support::Guards::Guard#message has special message for exclusive
     Failure/Error: expect(guard.message).to eq('Test does not apply to this configuration; Guarded by {:reason=>"because"};')

       expected: "Test does not apply to this configuration; Guarded by {:reason=>\"because\"};"
            got: "Test does not apply to this configuration; Guarded by {reason: \"because\"};"

       (compared using ==)
     # ./spec/unit/selenium/webdriver/guard_spec.rb:207:in 'block (3 levels) in <module:Support>'
     # /usr/share/gems/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

These seems to be caused by Hash#inspect formatting change:

https://bugs.ruby-lang.org/issues/20433

I'd contributed the fixes, but I can't sign the CLA 🤷

Copy link

@voxik, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@voxik
Copy link
Author

voxik commented Dec 23, 2024

This would be the patch:

From 197157e98ce42550eed6a3c387eb89a0e99cfa3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <[email protected]>
Date: Mon, 23 Dec 2024 16:55:02 +0100
Subject: [PATCH] Fix `Hash#inspect` formatting for Ruby 3.4 compatibility

https://bugs.ruby-lang.org/issues/20433

Fixes #14934
---
 .../unit/selenium/webdriver/chrome/options_spec.rb |  2 +-
 .../unit/selenium/webdriver/edge/options_spec.rb   |  2 +-
 rb/spec/unit/selenium/webdriver/guard_spec.rb      | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/rb/spec/unit/selenium/webdriver/chrome/options_spec.rb b/rb/spec/unit/selenium/webdriver/chrome/options_spec.rb
index a87f073e50..8eb6ebe042 100644
--- a/rb/spec/unit/selenium/webdriver/chrome/options_spec.rb
+++ b/rb/spec/unit/selenium/webdriver/chrome/options_spec.rb
@@ -247,7 +247,7 @@ module Selenium
 
             expect {
               options.as_json
-            }.to raise_error(Error::WebDriverError, 'These options are not w3c compliant: {:foo=>"bar"}')
+            }.to raise_error(Error::WebDriverError, %|These options are not w3c compliant: #{{:foo=>"bar"}}|)
           end
 
           it 'returns added options' do
diff --git a/rb/spec/unit/selenium/webdriver/edge/options_spec.rb b/rb/spec/unit/selenium/webdriver/edge/options_spec.rb
index eccaeadf6e..1bced2acaf 100644
--- a/rb/spec/unit/selenium/webdriver/edge/options_spec.rb
+++ b/rb/spec/unit/selenium/webdriver/edge/options_spec.rb
@@ -209,7 +209,7 @@ module Selenium
 
             expect {
               options.as_json
-            }.to raise_error(Error::WebDriverError, 'These options are not w3c compliant: {:foo=>"bar"}')
+            }.to raise_error(Error::WebDriverError, %|These options are not w3c compliant: #{{:foo=>"bar"}}|)
           end
 
           it 'returns added options' do
diff --git a/rb/spec/unit/selenium/webdriver/guard_spec.rb b/rb/spec/unit/selenium/webdriver/guard_spec.rb
index 60a17ac67e..5c45311389 100644
--- a/rb/spec/unit/selenium/webdriver/guard_spec.rb
+++ b/rb/spec/unit/selenium/webdriver/guard_spec.rb
@@ -78,14 +78,14 @@ module Selenium
             guards.add_condition(:foo, false)
 
             expect(guards.disposition).to eq [:pending,
-                                              'Test guarded; Guarded by {:foo=>false, :reason=>"No reason given"};']
+                                              %|Test guarded; Guarded by #{{:foo=>false, :reason=>"No reason given"}};|]
           end
 
           it 'is skipped without provided reason', exclusive: {foo: true} do |example|
             guards = described_class.new(example)
             guards.add_condition(:foo, false)
 
-            message = 'Test does not apply to this configuration; Guarded by {:foo=>true, :reason=>"No reason given"};'
+            message = %|Test does not apply to this configuration; Guarded by #{{:foo=>true, :reason=>"No reason given"}};|
             expect(guards.disposition).to eq [:skip, message]
           end
         end
@@ -158,7 +158,7 @@ module Selenium
           it 'defaults to no reason given' do
             guard = described_class.new({}, :only)
 
-            expect(guard.message).to eq('Test guarded; Guarded by {:reason=>"No reason given"};')
+            expect(guard.message).to eq(%|Test guarded; Guarded by #{{:reason=>"No reason given"}};|)
           end
 
           it 'accepts integer' do |example|
@@ -171,7 +171,7 @@ module Selenium
           it 'accepts String' do
             guard = described_class.new({reason: 'because'}, :only)
 
-            expect(guard.message).to eq('Test guarded; Guarded by {:reason=>"because"};')
+            expect(guard.message).to eq(%|Test guarded; Guarded by #{{:reason=>"because"}};|)
           end
 
           it 'accepts Symbol of known message' do
@@ -191,20 +191,20 @@ module Selenium
           it 'has special message for exclude' do
             guard = described_class.new({reason: 'because'}, :exclude)
 
-            expect(guard.message).to eq('Test skipped because it breaks test run; Guarded by {:reason=>"because"};')
+            expect(guard.message).to eq(%|Test skipped because it breaks test run; Guarded by #{{:reason=>"because"}};|)
           end
 
           it 'has special message for flaky' do
             guard = described_class.new({reason: 'because'}, :flaky)
 
-            msg = 'Test skipped because it is unreliable in this configuration; Guarded by {:reason=>"because"};'
+            msg = %|Test skipped because it is unreliable in this configuration; Guarded by #{{:reason=>"because"}};|
             expect(guard.message).to eq(msg)
           end
 
           it 'has special message for exclusive' do
             guard = described_class.new({reason: 'because'}, :exclusive)
 
-            expect(guard.message).to eq('Test does not apply to this configuration; Guarded by {:reason=>"because"};')
+            expect(guard.message).to eq(%|Test does not apply to this configuration; Guarded by #{{:reason=>"because"}};|)
           end
         end
       end

@VietND96
Copy link
Member

There is the PR for Ruby update is going on #14791
cc: @aguspe

@aguspe
Copy link
Contributor

aguspe commented Jan 1, 2025

This week I will be wrapping up #14900 and afterward, I will go back to the 3.2.2 upgrade, we need to do a procedural upgrade also to validate that all the tests and dependencies work as expected, so hopefully after successfully upgrading to 3.2.2 we can work towards 3.4.0 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants