DEV: Partially revert 5b91dc1844 (#24838)

Why this change?

The code changes introduced in 5b91dc1844
resulted in errors being raised when `session.quit` is called when using
multiple sessions. From my debugging, this seems to be attributed to the
fact that the change introduced resulted in multiple sessions sharing
the same instance of `Selenium::WebDriver::Remote::Http::Default`. While
sharing the same instance in theory should be fine, but the problem is
that `Selenium::WebDriver::Driver` will mutate the `server_url` of the
client in `Selenium::WebDriver::Remote::Bridge`. This is problematic
because each session created by capbyara relies on a different server
URL and this mutation causes all sorts of weird errors to occur.

To reproduce the problem, run `LOAD_PLUGINS=1 rspec plugins/chat/spec/system/send_message_spec.rb:76`
locally while excluding the changes in this commit.
This commit is contained in:
Alan Guo Xiang Tan 2023-12-12 12:39:23 +08:00 committed by GitHub
parent 7dd150bc95
commit 775dce1f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -388,8 +388,7 @@ RSpec.configure do |config|
options.add_preference("download.default_directory", Downloads::FOLDER)
end
client = Selenium::WebDriver::Remote::Http::Default.new(read_timeout: BROWSER_READ_TIMEOUT)
driver_options = { browser: :chrome, http_client: client }
driver_options = { browser: :chrome }
if ENV["CAPYBARA_REMOTE_DRIVER_URL"].present?
driver_options[:browser] = :remote