Skip to content

Commit

Permalink
fix: browser_options
Browse files Browse the repository at this point in the history
  • Loading branch information
route committed Dec 13, 2023
1 parent b5d72b9 commit 35d1dc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/capybara/cuprite/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def initialize(app, options = {})
@screen_size ||= DEFAULT_MAXIMIZE_SCREEN_SIZE
@options[:save_path] ||= File.expand_path(Capybara.save_path) if Capybara.save_path

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

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

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
it "sets the remote-allow-origins option" do
driver = described_class.new(nil)

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

Expand Down

0 comments on commit 35d1dc2

Please sign in to comment.