Skip to content

Commit 35d1dc2

Browse files
committed
fix: browser_options
1 parent b5d72b9 commit 35d1dc2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/capybara/cuprite/driver.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ def initialize(app, options = {})
3434
@screen_size ||= DEFAULT_MAXIMIZE_SCREEN_SIZE
3535
@options[:save_path] ||= File.expand_path(Capybara.save_path) if Capybara.save_path
3636

37-
@options[:"remote-allow-origins"] = "*"
37+
# It's set for debug() to make devtools tab open correctly.
38+
@options[:browser_options] ||= {}
39+
unless @options[:browser_options][:"remote-allow-origins"]
40+
@options[:browser_options].merge!("remote-allow-origins": "*")
41+
end
3842

3943
ENV["FERRUM_DEBUG"] = "true" if ENV["CUPRITE_DEBUG"]
4044

spec/lib/driver_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
it "sets the remote-allow-origins option" do
66
driver = described_class.new(nil)
77

8-
expect(driver.browser.options.to_h).to include("remote-allow-origins": "*")
8+
expect(driver.browser.options.to_h[:browser_options]).to include("remote-allow-origins": "*")
99
end
1010
end
1111

0 commit comments

Comments
 (0)