Skip to content

Commit

Permalink
[rb] fix bug in default durations
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed May 31, 2022
1 parent f677d2d commit 6652c1a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module PointerActions
#

def default_move_duration
@default_move_duration ||= @duration / 1000 # convert ms to seconds
@default_move_duration ||= @duration / 1000.0 # convert ms to seconds
end

#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module WheelActions
#

def default_scroll_duration
@default_scroll_duration ||= @duration / 1000 # convert ms to seconds
@default_scroll_duration ||= @duration / 1000.0 # convert ms to seconds
end

#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ module WebDriver

describe 'pen stylus', except: {browser: :firefox, reason: 'Unknown pointerType'} do
it 'sets pointer event properties' do
driver.get 'https://titusfortner.com/examples/pointerActionsPage.html'
driver.navigate.to url_for('pointerActionsPage.html')
pointer_area = driver.find_element(id: 'pointerArea')
rect = pointer_area.rect
x_val = rect.x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def initialize

extract_browser_from_bazel_target_name

@driver = ENV.fetch('WD_SPEC_DRIVER', :firefox).to_sym
@driver = ENV.fetch('WD_SPEC_DRIVER', :chrome).to_sym
@driver_instance = nil
end

Expand Down
5 changes: 5 additions & 0 deletions rb/spec/unit/selenium/webdriver/common/action_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ module WebDriver
expect(action_builder.devices).to eq([mouse, keyboard, none, touch])
end

it 'accepts duration' do
action_builder = ActionBuilder.new(bridge, duration: 2200)
expect(action_builder.default_move_duration).to eq(2.2)
end

it 'does not accept additional devices if deprecated parameters are used' do
none = Interactions.none('none')
touch = Interactions.pointer(:touch, name: 'touch')
Expand Down

0 comments on commit 6652c1a

Please sign in to comment.