Skip to content

Drop driven_by(:selenium) #2856

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Drop driven_by(:selenium) #2856

wants to merge 1 commit into from

Conversation

voxik
Copy link
Contributor

@voxik voxik commented Jul 18, 2025

Landing Ruby on Rails 8.0.2 in Fedora, the rubygem-rspec-rails package test suite started to fail with errors such as:

$ rspec -rspec_helper -rbundler spec

... snip ...

Failures:

  1) RSpec::Rails::SystemExampleGroup hook order calls Capybara.reset_sessions (TestUnit after_teardown) after any after hooks
     Failure/Error: example.run

     RuntimeError:
       Warnings were generated: 2025-07-18 16:38:09 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
         https://selenium.dev/documentation/webdriver/troubleshooting/logging

       2025-07-18 16:38:09 ERROR Selenium Exception occurred: Unsuccessful command executed: ["/usr/share/gems/gems/selenium-webdriver-4.27.0/bin/linux/selenium-manager", "--browser", "chrome", "--language-binding", "ruby", "--output", "json"] - Code 255


       2025-07-18 16:38:09 ERROR Selenium Backtrace:
       	/usr/share/gems/gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/common/selenium_manager.rb:81:in 'Selenium::WebDriver::SeleniumManager.run'
       	/usr/share/gems/gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/common/selenium_manager.rb:44:in 'Selenium::WebDriver::SeleniumManager.binary_paths'
       	/usr/share/gems/gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/common/driver_finder.rb:58:in 'Selenium::WebDriver::DriverFinder#paths'
       	/usr/share/gems/gems/selenium-webdriver-4.27.0/lib/selenium/webdriver/common/driver_finder.rb:39:in 'Selenium::WebDriver::DriverFinder#driver_path'
       	/usr/share/gems/gems/actionpack-8.0.2/lib/action_dispatch/system_testing/browser.rb:68:in 'ActionDispatch::SystemTesting::Browser#resolve_driver_path'
       	/usr/share/gems/gems/actionpack-8.0.2/lib/action_dispatch/system_testing/browser.rb:44:in 'ActionDispatch::SystemTesting::Browser#preload'
       	/usr/share/gems/gems/actionpack-8.0.2/lib/action_dispatch/system_testing/driver.rb:21:in 'ActionDispatch::SystemTesting::Driver#initialize'
       	/usr/share/gems/gems/actionpack-8.0.2/lib/action_dispatch/system_test_case.rb:161:in 'Class#new'
       	/usr/share/gems/gems/actionpack-8.0.2/lib/action_dispatch/system_test_case.rb:161:in 'ActionDispatch::SystemTestCase.driven_by'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/lib/rspec/rails/example/system_example_group.rb:153:in 'RSpec::ExampleGroups::Anonymous#driven_by'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/spec/rspec/rails/example/system_example_group_spec.rb:161:in 'block (5 levels) in <module:Rails>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'BasicObject#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'RSpec::Core::Example#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:365:in 'RSpec::Core::Hooks::BeforeHook#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:529:in 'block in RSpec::Core::Hooks::HookCollections#run_owned_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:528:in 'Array#each'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:528:in 'RSpec::Core::Hooks::HookCollections#run_owned_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:615:in 'block in RSpec::Core::Hooks::HookCollections#run_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:614:in 'Array#reverse_each'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:614:in 'RSpec::Core::Hooks::HookCollections#run_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:484:in 'RSpec::Core::Hooks::HookCollections#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:505:in 'RSpec::Core::Example#run_before_example'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:261:in 'block in RSpec::Core::Example#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:511:in 'block in RSpec::Core::Example#with_around_and_singleton_context_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:468:in 'block in RSpec::Core::Example#with_around_example_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:486:in 'block in RSpec::Core::Hooks::HookCollections#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:626:in 'block in RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:352:in 'RSpec::Core::Example::Procsy#call'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/spec/rspec/rails/example/system_example_group_spec.rb:173:in 'block (5 levels) in <module:Rails>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'BasicObject#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'RSpec::Core::Example#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:390:in 'RSpec::Core::Hooks::AroundHook#execute_with'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:628:in 'block (2 levels) in RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:352:in 'RSpec::Core::Example::Procsy#call'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/lib/rspec/rails/example/system_example_group.rb:174:in 'block (2 levels) in <module:SystemExampleGroup>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'BasicObject#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'RSpec::Core::Example#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:390:in 'RSpec::Core::Hooks::AroundHook#execute_with'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:628:in 'block (2 levels) in RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:352:in 'RSpec::Core::Example::Procsy#call'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/lib/rspec/rails/adapters.rb:75:in 'block (2 levels) in <module:MinitestLifecycleAdapter>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'BasicObject#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'RSpec::Core::Example#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:390:in 'RSpec::Core::Hooks::AroundHook#execute_with'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:628:in 'block (2 levels) in RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:352:in 'RSpec::Core::Example::Procsy#call'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:629:in 'RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:486:in 'RSpec::Core::Hooks::HookCollections#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:468:in 'RSpec::Core::Example#with_around_example_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:511:in 'RSpec::Core::Example#with_around_and_singleton_context_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:259:in 'RSpec::Core::Example#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:653:in 'block in RSpec::Core::ExampleGroup.run_examples'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:649:in 'Array#map'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:649:in 'RSpec::Core::ExampleGroup.run_examples'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:614:in 'RSpec::Core::ExampleGroup.run'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/spec/rspec/rails/example/system_example_group_spec.rb:178:in 'block (3 levels) in <module:Rails>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:263:in 'BasicObject#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:263:in 'block in RSpec::Core::Example#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:511:in 'block in RSpec::Core::Example#with_around_and_singleton_context_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:468:in 'block in RSpec::Core::Example#with_around_example_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:486:in 'block in RSpec::Core::Hooks::HookCollections#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:626:in 'block in RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:352:in 'RSpec::Core::Example::Procsy#call'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/lib/rspec/rails/adapters.rb:75:in 'block (2 levels) in <module:MinitestLifecycleAdapter>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'BasicObject#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'RSpec::Core::Example#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:390:in 'RSpec::Core::Hooks::AroundHook#execute_with'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:628:in 'block (2 levels) in RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:352:in 'RSpec::Core::Example::Procsy#call'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/spec/spec_helper.rb:83:in 'block (3 levels) in <top (required)>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/sandbox.rb:29:in 'RSpec::Core::Sandbox.sandboxed'
       	/builddir/build/BUILD/rubygem-rspec-rails-7.1.0-build/rspec-rails-7.1.0/usr/share/gems/gems/rspec-rails-7.1.0/spec/spec_helper.rb:77:in 'block (2 levels) in <top (required)>'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'BasicObject#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:457:in 'RSpec::Core::Example#instance_exec'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:390:in 'RSpec::Core::Hooks::AroundHook#execute_with'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:628:in 'block (2 levels) in RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:352:in 'RSpec::Core::Example::Procsy#call'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:629:in 'RSpec::Core::Hooks::HookCollections#run_around_example_hooks_for'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/hooks.rb:486:in 'RSpec::Core::Hooks::HookCollections#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:468:in 'RSpec::Core::Example#with_around_example_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:511:in 'RSpec::Core::Example#with_around_and_singleton_context_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example.rb:259:in 'RSpec::Core::Example#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:653:in 'block in RSpec::Core::ExampleGroup.run_examples'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:649:in 'Array#map'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:649:in 'RSpec::Core::ExampleGroup.run_examples'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:614:in 'RSpec::Core::ExampleGroup.run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:615:in 'block in RSpec::Core::ExampleGroup.run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:615:in 'Array#map'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/example_group.rb:615:in 'RSpec::Core::ExampleGroup.run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:121:in 'block (3 levels) in RSpec::Core::Runner#run_specs'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:121:in 'Array#map'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:121:in 'block (2 levels) in RSpec::Core::Runner#run_specs'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/configuration.rb:2097:in 'RSpec::Core::Configuration#with_suite_hooks'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:116:in 'block in RSpec::Core::Runner#run_specs'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/reporter.rb:74:in 'RSpec::Core::Reporter#report'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:115:in 'RSpec::Core::Runner#run_specs'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:89:in 'RSpec::Core::Runner#run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:71:in 'RSpec::Core::Runner.run'
       	/usr/share/gems/gems/rspec-core-3.13.5/lib/rspec/core/runner.rb:45:in 'RSpec::Core::Runner.invoke'
       	/usr/share/gems/gems/rspec-core-3.13.5/exe/rspec:4:in '<top (required)>'
       	/usr/bin/rspec:25:in 'Kernel#load'
       	/usr/bin/rspec:25:in '<main>'
     # ./spec/spec_helper.rb:83:in 'block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:77:in 'block (2 levels) in <top (required)>'

... snip ...

Finished in 2.14 seconds (files took 1.05 seconds to load)
981 examples, 3 failures, 5 pending

Failed examples:

rspec ./spec/rspec/rails/example/system_example_group_spec.rb:153 # RSpec::Rails::SystemExampleGroup hook order calls Capybara.reset_sessions (TestUnit after_teardown) after any after hooks
rspec ./spec/rspec/rails/example/system_example_group_spec.rb:106 # RSpec::Rails::SystemExampleGroup#take_screenshot handles Rails calling metadata
rspec ./spec/rspec/rails/example/system_example_group_spec.rb:84 # RSpec::Rails::SystemExampleGroup#after sets the :extra_failure_lines metadata to an array of STDOUT lines

As it turns out, this due to missing Chromedriver. However, this was not needed previously with Ruby on Rails 7.0 and it seems it is needed due to this change.

Of course one option would be to let the test have the the Chromedriver. But that is big beast. So I tried to remove the driven_by(:selenium), expecting the something will fail by some way, but nothing happened and the test suite still seems to be happy.

I am very likely missing something and doing something wrong and in that case sorry for the noise. But maybe not and this change is worth of it.

In my testing, it does not have any influence.
@voxik voxik changed the title Try to drop seleinum Drop driven_by(:selenium) Jul 18, 2025
@pirj
Copy link
Member

pirj commented Aug 6, 2025

Why does this command fail for you? What if you run this manually?

 /usr/share/gems/gems/selenium-webdriver-4.27.0/bin/linux/selenium-manager --browser chrome --language-binding ruby --output json

@JonRowe
Copy link
Member

JonRowe commented Aug 7, 2025

Apologies for the delay here, as far as I can tell / remember the point of these is to ensure the tests are running on a javascript capable runner, but as the test on line 33 shows, the default is a selenium driver...

So I guess my question is why they work when removing the explicit driver selection when the default should also be chromedriver...

I'm not adversed to merging this, but if theres a more complex behaviour going on I'd like to understand it.

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

Successfully merging this pull request may close these issues.

3 participants