Skip to content

Allow allowlist and blocklist in browser options hash - #330

Closed
Greg-Myers-SB wants to merge 1 commit into
rubycdp:mainfrom
Greg-Myers-SB:patch-1
Closed

Greg-Myers-SB wants to merge 1 commit into
rubycdp:mainfrom
Greg-Myers-SB:patch-1

Conversation

@Greg-Myers-SB

Copy link
Copy Markdown

The alias for these already exist within this file but the options hash did not allow the aliased keys, until now.

Same as 575ef9c extended to options.

The alias for these already existed within this file but the options hash did not until now.
@Greg-Myers-SB

Copy link
Copy Markdown
Author

The test failures on 3.1 look the same as these test failures on another branch.
There may be a source of flakiness in the suite.
https://github.com/rubycdp/cuprite/actions/runs/36502102471/job/109195094304

@route

route commented Oct 13, 2026

Copy link
Copy Markdown
Member

Thanks for the PR! The idea is good, but as it stands the new keys only work until the first Capybara reset.

Driver#reset! sets both lists again using only the legacy keys:

# lib/capybara/cuprite/driver.rb
browser.url_blacklist = @options[:url_blacklist]
browser.url_whitelist = @options[:url_whitelist]

So when the driver is registered with url_blocklist: / url_allowlist:, @options[:url_blacklist] is nil, prepare_wildcards(nil) returns [], and the list is cleared after the first test. Every test after that runs with no blocklist/allowlist.

To land this, it would need:

  • the new keys handled in one place, so Browser#initialize and Driver#reset! agree (for example, by mapping them to the legacy keys once in Driver#initialize)
  • a spec like the existing url_blacklist: / url_whitelist: driver-registration specs in spec/features/driver_spec.rb, using the new keys and covering a reset
  • a README update for the options list, plus a short CHANGELOG entry

I'm closing this for now. Feel free to reopen or open a new PR with those changes. The 3.1 failure is an unrelated flaky spec, as you noted.

@route route closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants