Skip to content

Commit ab5d7c5

Browse files
authored
override default duration to make some action fast (#36)
* override default duration * fix skipping * update changelog
1 parent ec2ec43 commit ab5d7c5

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55
### Enhancements
6+
- override default duration to make some action fast [#36](https://github.com/appium/ruby_lib_core/pull/36)
67

78
### Bug fixes
89

lib/appium_lib_core/common/base/w3c_bridge.rb

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ module Appium
22
module Core
33
class Base
44
class CoreBridgeW3C < ::Selenium::WebDriver::Remote::W3C::Bridge
5+
# Used for default duration of each touch actions
6+
# Override from 250 milliseconds to 50 milliseconds
7+
::Selenium::WebDriver::PointerActions::DEFAULT_MOVE_DURATION = 0.05
8+
59
def commands(command)
610
::Appium::Core::Commands::COMMANDS_EXTEND_W3C[command]
711
end

test/functional/android/webdriver/w3c_actions_test.rb

+14-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,25 @@ def teardown
1818
end
1919

2020
def test_tap
21-
skip if @@driver.dialect
21+
skip if @@driver.dialect == :oss
2222

2323
el = @@core.wait { @@driver.find_element(:accessibility_id, 'Views') }
2424
@@driver.action.click(el).perform
2525

2626
el = @@core.wait { @@driver.find_element(:accessibility_id, 'Custom') }
27-
@@driver.action.click_and_hold(el).move_to_location(0, 700).release.perform
27+
# same as @@driver.action.click_and_hold(el).move_to_location(0, 700).release.perform
28+
@@driver.action
29+
.move_to(el).pointer_down(:left)
30+
.move_to_location(0, 700)
31+
.release
32+
.perform
33+
34+
# Scroll a bit without elements
35+
@@driver.action
36+
.move_to_location(500, 500).pointer_down(:left)
37+
.move_to_location(0, 700)
38+
.release
39+
.perform
2840

2941
el = @@core.wait { @@driver.find_element(:accessibility_id, 'ImageButton') }
3042
assert_equal 'ImageButton', el.name

test/functional/ios/webdriver/w3c_actions_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def teardown
1515
end
1616

1717
def test_tap
18-
skip if @@driver.dialect
18+
skip if @@driver.dialect == :oss
1919

2020
el = @@core.wait { @@driver.find_element(:accessibility_id, 'Buttons') }
2121
@@driver.action.click(el).perform

0 commit comments

Comments
 (0)