Skip to content

Commit

Permalink
Clarify cuprite driver configuration
Browse files Browse the repository at this point in the history
Rails is registering a driver called `cuprite`. And when we did that as
well the driver got registered three times somehow. It looked like our
driver options were used in the end but just to clarify I gave it a
unique name.

This was inspired by:

* ViewComponent/view_component#1877

It suggests that it may avoid dead browser errors on CI. We'll see.
  • Loading branch information
mkllnk authored and Flavien LE BLOND committed Mar 13, 2024
1 parent 8c8a254 commit 6003748
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/system/support/cuprite_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
browser_options = {}
browser_options["no-sandbox"] = nil if ENV['CI']

Capybara.register_driver(:cuprite) do |app|
Capybara.register_driver(:cuprite_ofn) do |app|
Capybara::Cuprite::Driver.new(
app,
**{
Expand All @@ -24,14 +24,14 @@
)
end

# Configure Capybara to use :cuprite driver by default
Capybara.default_driver = Capybara.javascript_driver = :cuprite
# Configure Capybara to use :cuprite_ofn driver by default
Capybara.default_driver = Capybara.javascript_driver = :cuprite_ofn

RSpec.configure do |config|
config.include CupriteHelpers, type: :system
config.include Devise::Test::IntegrationHelpers, type: :system

config.prepend_before(:each, type: :system) { driven_by :cuprite }
config.prepend_before(:each, type: :system) { driven_by :cuprite_ofn }

# Make sure url helpers in mailers use the Capybara server host.
config.around(:each, type: :system) do |example|
Expand Down

0 comments on commit 6003748

Please sign in to comment.