Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Changed
- Ferrum is bumped to `~> 0.19.0`
- `--disable-web-security` is added to the browser options, since Ferrum dropped it from its defaults. Tests keep
reaching into cross-origin frames, e.g. `current_url` within a frame from another origin [rubycdp/ferrum#472]
- Change `Node#send_keys` to avoid triggering `click` on an already focused element. `send_keys(:tab)` without an
element no longer clicks the middle of the page first, so Tab moves focus from the start of the page, and Capybara's
`#active_element` and `focused:` specs run in the suite [#327]
Expand Down
3 changes: 2 additions & 1 deletion docs/2-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Cuprite changes a few Ferrum defaults:
* `:save_path` - defaults to `Capybara.save_path` if it's set.
* `:pending_connection_errors` - `true` by default.
* `:browser_options` - `"remote-allow-origins" => "*"` is always added, so that
[debug](/docs/cuprite/debugging) can open DevTools.
[debug](/docs/cuprite/debugging) can open DevTools, and so is `"disable-web-security" => nil`, so that tests
can reach into cross-origin frames.

## Examples

Expand Down
1 change: 1 addition & 0 deletions lib/capybara/cuprite/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def initialize(app, options = {})
unless @options[:browser_options][:"remote-allow-origins"]
@options[:browser_options].merge!("remote-allow-origins": "*")
end
@options[:browser_options] = { "disable-web-security": nil }.merge(@options[:browser_options])

super()
end
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

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

it "sets the disable-web-security option" do
driver = described_class.new(nil)

expect(driver.browser.options.to_h[:browser_options]).to include("disable-web-security": nil)
end
end

describe "raise_on_unhandled_modal configuration" do
Expand Down
Loading