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 @@ -39,6 +39,8 @@
### Fixed
- `Node#drag_to` with `drop_modifiers:` holds the modifiers while moving to the target and sends keydown and keyup for
them, like Selenium does. They used to be set only on mouseup [rubycdp/ferrum#581]
- Resizing the window reset hover and pointer overrides passed with `--blink-settings`, so `@media (hover: hover)`
stopped matching on headless Linux [#282, rubycdp/ferrum#664]

### Removed
- Ruby 3.1 support, Cuprite requires Ruby 3.2 or newer
Expand Down
2 changes: 1 addition & 1 deletion cuprite.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 3.2"

s.add_dependency "capybara", "~> 3.0"
s.add_dependency "ferrum", "~> 0.20.0"
s.add_dependency "ferrum", "~> 0.20.1"
end
2 changes: 1 addition & 1 deletion lib/capybara/cuprite/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Options
attr_accessor :url_blacklist, :url_whitelist, :raise_on_unhandled_modal

def mobile
@options.fetch(:mobile, false)
@options.fetch(:mobile, nil)
end

def scale_factor
Expand Down
16 changes: 16 additions & 0 deletions spec/features/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ def session_url(path)
driver&.quit
end

it "keeps the pointer type set with --blink-settings after resizing the window" do
Capybara.register_driver :cuprite_with_blink_settings do |app|
Capybara::Cuprite::Driver.new(
app, browser_options: { "blink-settings" => "primaryPointerType=2,availablePointerTypes=2" }
)
end
session = Capybara::Session.new(:cuprite_with_blink_settings, TestApp)
session.visit("/")

expect do
session.current_window.resize_to(800, 600)
end.not_to(change { session.evaluate_script("matchMedia('(pointer: coarse)').matches") }.from(true))
ensure
session&.driver&.quit
end

it "leaves the window size to the browser when the option is nil" do
Capybara.register_driver :cuprite_without_window_size do |app|
Capybara::Cuprite::Driver.new(app, window_size: nil)
Expand Down
Loading