Skip to content

Commit d5f29fd

Browse files
committed
Model devices as simply hashes of options for the driver
1 parent 694efa0 commit d5f29fd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/capybara/cuprite/devices.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
module Capybara
4+
module Cuprite
5+
module Devices
6+
IPHONE_14 = { height: 844, width: 390, mobile: true, scale_factor: 3 }
7+
end
8+
end
9+
end

spec/spec_helper.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
require "capybara/spec/spec_helper"
1313
require "capybara/cuprite"
14+
require "capybara/cuprite/devices"
1415

1516
require "support/test_app"
1617
require "support/external_browser"
@@ -31,7 +32,7 @@
3132
end
3233

3334
Capybara.register_driver(:cuprite_mobile) do |app|
34-
options = { mobile: true }
35+
options = Capybara::Cuprite::Devices::IPHONE_14
3536
options.merge!(inspector: true) if ENV["INSPECTOR"]
3637
options.merge!(logger: StringIO.new) if ENV["CI"]
3738
options.merge!(headless: false) if ENV["HEADLESS"] == "false"

0 commit comments

Comments
 (0)