appium_lib_core 7.5.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/appium_lib_core.gemspec +2 -2
- data/lib/appium_lib_core/android/device.rb +0 -15
- data/lib/appium_lib_core/common/base/bridge.rb +0 -12
- data/lib/appium_lib_core/common/base/driver.rb +0 -153
- data/lib/appium_lib_core/common/base/search_context.rb +1 -19
- data/lib/appium_lib_core/common/base.rb +0 -2
- data/lib/appium_lib_core/common/command.rb +0 -16
- data/lib/appium_lib_core/common/device/app_management.rb +0 -18
- data/lib/appium_lib_core/common/device/context.rb +0 -4
- data/lib/appium_lib_core/common/log.rb +1 -3
- data/lib/appium_lib_core/device.rb +2 -4
- data/lib/appium_lib_core/element.rb +0 -29
- data/lib/appium_lib_core/version.rb +2 -2
- data/lib/appium_lib_core/windows/device.rb +0 -2
- metadata +6 -11
- data/lib/appium_lib_core/common/device/touch_actions.rb +0 -37
- data/lib/appium_lib_core/common/device/value.rb +0 -50
- data/lib/appium_lib_core/common/touch_action/multi_touch.rb +0 -75
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +0 -217
- data/lib/appium_lib_core/windows/device/app_management.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0dede67687fe20659b7d6835475a0d5f3afec17cacdfe524e85fe969acf5065
|
4
|
+
data.tar.gz: da99daf2ab73305fdae7ac88114bf07db61612806d5d0ad35184c14bd3ee2932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ceab3e96728f645bca3e76aa749679da6061af73d4b5ad46c03975f0e4bc4818a8602f5f391d808083883d4ad1e4075167fee3b877adb69a1081d390a66afe
|
7
|
+
data.tar.gz: 4701430819ac1d48552d30fa81096e264e27ce370820526b9cd4511001b7077c782b6aa708a540e5a4de5670827241cd0c29ada6b3821512403239b20115384d
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,22 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
+
## [8.0.0] - 2024-03-08
|
14
|
+
|
15
|
+
### Deprecations
|
16
|
+
- Removed deprecated methods
|
17
|
+
- `launch_app`, `close_app` and `reset`
|
18
|
+
- Please use `activate_app`, `terminate_app`, or launch/activate/terminate commands by `mobile:` command
|
19
|
+
- `TouchActions`, `MultiActions`
|
20
|
+
- Please refer to W3C WebDriver actions
|
21
|
+
- https://www.rubydoc.info/gems/appium_lib_core/Appium/Core/Base/Bridge#action-instance_method
|
22
|
+
- `immediate_value` and `replace_value`
|
23
|
+
- `end_coverage`
|
24
|
+
- `sessions` and `session_capabilities` since they are not W3C WebDriver spec and already removed from the dependent selenium clients.
|
25
|
+
- To get events info, please use `driver.logs.events` instead
|
26
|
+
- `switch_to_default_context`
|
27
|
+
- Please set proper context instead
|
28
|
+
|
13
29
|
## [7.5.0] - 2024-02-21
|
14
30
|
- Remove upper limitation in `selenium-webdriver`
|
15
31
|
- Users can control the version in their Gemfile
|
data/appium_lib_core.gemspec
CHANGED
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
30
30
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
31
31
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
32
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
33
|
-
spec.add_development_dependency 'rubocop', '1.
|
32
|
+
spec.add_development_dependency 'webmock', '~> 3.23.0'
|
33
|
+
spec.add_development_dependency 'rubocop', '1.62.0'
|
34
34
|
spec.add_development_dependency 'appium_thor', '~> 1.0'
|
35
35
|
spec.add_development_dependency 'parallel_tests'
|
36
36
|
spec.add_development_dependency 'simplecov'
|
@@ -188,13 +188,6 @@ module Appium
|
|
188
188
|
# @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
|
189
189
|
#
|
190
190
|
|
191
|
-
# @deprecated The method no longer exists. This method will be removed.
|
192
|
-
# @!method end_coverage(path, intent)
|
193
|
-
# Android only; Ends the test coverage and writes the results to the given path on device.
|
194
|
-
# @param [String] path Path on the device to write too.
|
195
|
-
# @param [String] intent Intent to broadcast when ending coverage.
|
196
|
-
#
|
197
|
-
|
198
191
|
# @deprecated Use 'mobile: startActivity' extension instead.
|
199
192
|
# @!method start_activity(opts)
|
200
193
|
# Android only. Start a new activity within the current app or launch a new app and start the target activity.
|
@@ -481,14 +474,6 @@ module Appium
|
|
481
474
|
end
|
482
475
|
end
|
483
476
|
|
484
|
-
# TODO: TEST ME
|
485
|
-
::Appium::Core::Device.add_endpoint_method(:end_coverage) do
|
486
|
-
def end_coverage(path, intent)
|
487
|
-
::Appium::Logger.warn '[DEPRECATION] The method no longer exists. This method will be removed.'
|
488
|
-
execute :end_coverage, {}, path: path, intent: intent
|
489
|
-
end
|
490
|
-
end
|
491
|
-
|
492
477
|
::Appium::Core::Device.add_endpoint_method(:execute_cdp) do
|
493
478
|
# SeleniumWebdriver could already define this method
|
494
479
|
return if method_defined? :execute_cdp
|
@@ -21,7 +21,6 @@ module Appium
|
|
21
21
|
include Device::ImeActions
|
22
22
|
include Device::Setting
|
23
23
|
include Device::Context
|
24
|
-
include Device::Value
|
25
24
|
include Device::FileManagement
|
26
25
|
include Device::KeyEvent
|
27
26
|
include Device::ImageComparison
|
@@ -29,7 +28,6 @@ module Appium
|
|
29
28
|
include Device::AppState
|
30
29
|
include Device::ScreenRecord::Command
|
31
30
|
include Device::Device
|
32
|
-
include Device::TouchActions
|
33
31
|
include Device::ExecuteDriver
|
34
32
|
include Device::Orientation
|
35
33
|
|
@@ -170,11 +168,6 @@ module Appium
|
|
170
168
|
@available_commands[command]
|
171
169
|
end
|
172
170
|
|
173
|
-
# Returns all available sessions on the Appium server instance
|
174
|
-
def sessions
|
175
|
-
execute :get_all_sessions
|
176
|
-
end
|
177
|
-
|
178
171
|
def status
|
179
172
|
execute :status
|
180
173
|
end
|
@@ -207,11 +200,6 @@ module Appium
|
|
207
200
|
execute :get_timeouts
|
208
201
|
end
|
209
202
|
|
210
|
-
# Port from MJSONWP
|
211
|
-
def session_capabilities
|
212
|
-
::Appium::Core::Base::Capabilities.json_create execute(:get_capabilities)
|
213
|
-
end
|
214
|
-
|
215
203
|
# For Appium
|
216
204
|
# override
|
217
205
|
def element_displayed?(element)
|
@@ -434,18 +434,6 @@ module Appium
|
|
434
434
|
block_given? ? @bridge.within_context(context, &block) : @bridge.within_context(context)
|
435
435
|
end
|
436
436
|
|
437
|
-
# @deprecated Use set context with proper context name instead.
|
438
|
-
# Change to the default context. This is equivalent to +set_context nil+.
|
439
|
-
#
|
440
|
-
# @example
|
441
|
-
#
|
442
|
-
# @driver.switch_to_default_context
|
443
|
-
#
|
444
|
-
def switch_to_default_context
|
445
|
-
::Appium::Logger.warn '[DEPRECATION] Please set proper context instead of calling this method.'
|
446
|
-
@bridge.switch_to_default_context
|
447
|
-
end
|
448
|
-
|
449
437
|
# @return [String] The context currently being used.
|
450
438
|
#
|
451
439
|
# @example
|
@@ -603,43 +591,6 @@ module Appium
|
|
603
591
|
@bridge.long_press_keycode(key, metastate: metastate, flags: flags)
|
604
592
|
end
|
605
593
|
|
606
|
-
# @deprecated Will be removed, or use 'windows: launchApp' extension instead for Windows.
|
607
|
-
# Start the simulator and application configured with desired capabilities
|
608
|
-
#
|
609
|
-
# @example
|
610
|
-
#
|
611
|
-
# @driver.launch_app
|
612
|
-
#
|
613
|
-
def launch_app
|
614
|
-
@bridge.launch_app
|
615
|
-
end
|
616
|
-
|
617
|
-
# @deprecated Will be removed, or use 'windows: closeApp' extension instead for Windows.
|
618
|
-
# Close an app on device
|
619
|
-
#
|
620
|
-
# @example
|
621
|
-
#
|
622
|
-
# @driver.close_app
|
623
|
-
#
|
624
|
-
def close_app
|
625
|
-
@bridge.close_app
|
626
|
-
end
|
627
|
-
|
628
|
-
# @deprecated
|
629
|
-
# Reset the device, relaunching the application.
|
630
|
-
#
|
631
|
-
# @example
|
632
|
-
#
|
633
|
-
# @driver.reset
|
634
|
-
#
|
635
|
-
def reset
|
636
|
-
::Appium::Logger.warn(
|
637
|
-
'[DEPRECATION] reset is deprecated. Please use terminate_app and activate_app, ' \
|
638
|
-
'or quit and create a new session instead.'
|
639
|
-
)
|
640
|
-
@bridge.reset
|
641
|
-
end
|
642
|
-
|
643
594
|
# @deprecated Use 'mobile: getAppStrings' extension instead.
|
644
595
|
# Return the hash of all localization strings.
|
645
596
|
# @return [Hash]
|
@@ -852,15 +803,6 @@ module Appium
|
|
852
803
|
@bridge.device_time(format)
|
853
804
|
end
|
854
805
|
|
855
|
-
# touch actions
|
856
|
-
def touch_actions(actions)
|
857
|
-
@bridge.touch_actions(actions)
|
858
|
-
end
|
859
|
-
|
860
|
-
def multi_touch(actions)
|
861
|
-
@bridge.multi_touch(actions)
|
862
|
-
end
|
863
|
-
|
864
806
|
#
|
865
807
|
# Send multiple W3C action chains to server. Use +@driver.action+ for single action chain.
|
866
808
|
#
|
@@ -959,101 +901,6 @@ module Appium
|
|
959
901
|
@bridge.get_timeouts
|
960
902
|
end
|
961
903
|
|
962
|
-
# Retrieve the capabilities of the specified session.
|
963
|
-
# It's almost same as +@driver.capabilities+ but you can get more details.
|
964
|
-
#
|
965
|
-
# @return [Selenium::WebDriver::Remote::Capabilities, Selenium::WebDriver::Remote::Capabilities]
|
966
|
-
#
|
967
|
-
# @example
|
968
|
-
# @driver.session_capabilities
|
969
|
-
#
|
970
|
-
# #=> uiautomator2
|
971
|
-
# # <Selenium::WebDriver::Remote::Capabilities:0x007fa38dae1360
|
972
|
-
# # @capabilities=
|
973
|
-
# # {:browser_name=>nil,
|
974
|
-
# # :browser_version=>nil,
|
975
|
-
# # :platform_name=>"android",
|
976
|
-
# # :page_load_strategy=>nil,
|
977
|
-
# # :remote_session_id=>nil,
|
978
|
-
# # :accessibility_checks=>nil,
|
979
|
-
# # :profile=>nil,
|
980
|
-
# # :rotatable=>nil,
|
981
|
-
# # :device=>nil,
|
982
|
-
# # "platform"=>"LINUX",
|
983
|
-
# # "webStorageEnabled"=>false,
|
984
|
-
# # "takesScreenshot"=>true,
|
985
|
-
# # "javascriptEnabled"=>true,
|
986
|
-
# # "databaseEnabled"=>false,
|
987
|
-
# # "networkConnectionEnabled"=>true,
|
988
|
-
# # "locationContextEnabled"=>false,
|
989
|
-
# # "warnings"=>{},
|
990
|
-
# # "desired"=>
|
991
|
-
# # {"platformName"=>"android",
|
992
|
-
# # "automationName"=>"uiautomator2",
|
993
|
-
# # "app"=>"/path/to/app/api.apk.zip",
|
994
|
-
# # "platformVersion"=>"8.1.0",
|
995
|
-
# # "deviceName"=>"Android Emulator",
|
996
|
-
# # "appPackage"=>"io.appium.android.apis",
|
997
|
-
# # "appActivity"=>"io.appium.android.apis.ApiDemos",
|
998
|
-
# # "someCapability"=>"some_capability",
|
999
|
-
# # "automationName"=>"uiautomator2",
|
1000
|
-
# # "app"=>"/path/to/app/api.apk.zip",
|
1001
|
-
# # "platformVersion"=>"8.1.0",
|
1002
|
-
# # "deviceName"=>"emulator-5554",
|
1003
|
-
# # "appPackage"=>"io.appium.android.apis",
|
1004
|
-
# # "appActivity"=>"io.appium.android.apis.ApiDemos",
|
1005
|
-
# # "someCapability"=>"some_capability",
|
1006
|
-
# # "deviceUDID"=>"emulator-5554",
|
1007
|
-
# # "deviceScreenSize"=>"1080x1920",
|
1008
|
-
# # "deviceScreenDensity"=>420,
|
1009
|
-
# # "deviceModel"=>"Android SDK built for x86",
|
1010
|
-
# # "deviceManufacturer"=>"Google",
|
1011
|
-
# # "pixelRatio"=>2.625,
|
1012
|
-
# # "statBarHeight"=>63,
|
1013
|
-
# # "viewportRect"=>{"left"=>0, "top"=>63, "width"=>1080, "height"=>1731}}>
|
1014
|
-
# #
|
1015
|
-
# #=> XCUITest
|
1016
|
-
# # <Selenium::WebDriver::Remote::Capabilities:0x007fb15dc01370
|
1017
|
-
# # @capabilities=
|
1018
|
-
# # {:browser_name=>"UICatalog",
|
1019
|
-
# # :browser_version=>nil,
|
1020
|
-
# # :platform_name=>"ios",
|
1021
|
-
# # :page_load_strategy=>nil,
|
1022
|
-
# # :remote_session_id=>nil,
|
1023
|
-
# # :accessibility_checks=>nil,
|
1024
|
-
# # :profile=>nil,
|
1025
|
-
# # :rotatable=>nil,
|
1026
|
-
# # :device=>"iphone",
|
1027
|
-
# # "udid"=>"DED4DBAD-8E5E-4AD6-BDC4-E75CF9AD84D8",
|
1028
|
-
# # "automationName"=>"XCUITest",
|
1029
|
-
# # "app"=>"/path/to/app/UICatalog.app",
|
1030
|
-
# # "platformVersion"=>"11.4",
|
1031
|
-
# # "deviceName"=>"iPhone Simulator",
|
1032
|
-
# # "useNewWDA"=>true,
|
1033
|
-
# # "useJSONSource"=>true,
|
1034
|
-
# # "someCapability"=>"some_capability",
|
1035
|
-
# # "sdkVersion"=>"11.4",
|
1036
|
-
# # "CFBundleIdentifier"=>"com.example.apple-samplecode.UICatalog",
|
1037
|
-
# # "pixelRatio"=>2,
|
1038
|
-
# # "statBarHeight"=>23.4375,
|
1039
|
-
# # "viewportRect"=>{"left"=>0, "top"=>47, "width"=>750, "height"=>1287}}>
|
1040
|
-
#
|
1041
|
-
def session_capabilities
|
1042
|
-
@bridge.session_capabilities
|
1043
|
-
end
|
1044
|
-
|
1045
|
-
# Returns available sessions on the Appium server
|
1046
|
-
#
|
1047
|
-
# @return [[Hash]]
|
1048
|
-
#
|
1049
|
-
# @example
|
1050
|
-
#
|
1051
|
-
# @driver.sessions #=> [{'id' => 'c363add8-a7ca-4455-b9e3-9ac4d69e95b3', 'capabilities' => { capabilities as Hash }}]
|
1052
|
-
#
|
1053
|
-
def sessions
|
1054
|
-
@bridge.sessions
|
1055
|
-
end
|
1056
|
-
|
1057
904
|
# Image Comparison
|
1058
905
|
def match_images_features(first_image:,
|
1059
906
|
second_image:,
|
@@ -29,12 +29,7 @@ module Appium
|
|
29
29
|
view_matcher: '-android viewmatcher', # Available in Espresso
|
30
30
|
# iOS
|
31
31
|
predicate: '-ios predicate string',
|
32
|
-
class_chain: '-ios class chain'
|
33
|
-
# Windows with windows prefix
|
34
|
-
# @deprecated
|
35
|
-
windows_uiautomation: '-windows uiautomation',
|
36
|
-
# Tizen with Tizen prefix
|
37
|
-
tizen_uiautomation: '-tizen uiautomation'
|
32
|
+
class_chain: '-ios class chain'
|
38
33
|
)
|
39
34
|
|
40
35
|
# rubocop:disable Layout/LineLength
|
@@ -121,13 +116,6 @@ module Appium
|
|
121
116
|
# e = find_element :class_chain, "**/XCUIElementTypeStaticText[$name == 'Buttons'$]"
|
122
117
|
# e.tag_name #=> "XCUIElementTypeStaticText"
|
123
118
|
#
|
124
|
-
# # For Windows
|
125
|
-
# # @deprecated
|
126
|
-
# @driver.find_elements :windows_uiautomation, '....'
|
127
|
-
#
|
128
|
-
# # For Tizen
|
129
|
-
# @driver.find_elements :tizen_uiautomation, '....'
|
130
|
-
#
|
131
119
|
# rubocop:enable Layout/LineLength
|
132
120
|
def find_element(*args)
|
133
121
|
how, what = extract_args(args)
|
@@ -159,12 +147,6 @@ module Appium
|
|
159
147
|
private
|
160
148
|
|
161
149
|
def _set_by_from_finders(how)
|
162
|
-
if how == :windows_uiautomation
|
163
|
-
::Appium::Logger.warn(
|
164
|
-
'[DEPRECATION] :windows_uiautomation is deprecated. Please use other locators.'
|
165
|
-
)
|
166
|
-
end
|
167
|
-
|
168
150
|
by = FINDERS[how.to_sym]
|
169
151
|
unless by
|
170
152
|
raise ::Appium::Core::Error::ArgumentError,
|
@@ -17,7 +17,6 @@ require_relative 'device/keyboard'
|
|
17
17
|
require_relative 'device/ime_actions'
|
18
18
|
require_relative 'device/setting'
|
19
19
|
require_relative 'device/context'
|
20
|
-
require_relative 'device/value'
|
21
20
|
require_relative 'device/file_management'
|
22
21
|
require_relative 'device/keyevent'
|
23
22
|
require_relative 'device/image_comparison'
|
@@ -27,7 +26,6 @@ require_relative 'device/screen_record'
|
|
27
26
|
require_relative 'device/battery_status'
|
28
27
|
require_relative 'device/clipboard_content_type'
|
29
28
|
require_relative 'device/device'
|
30
|
-
require_relative 'device/touch_actions'
|
31
29
|
require_relative 'device/execute_driver'
|
32
30
|
require_relative 'device/orientation'
|
33
31
|
|
@@ -157,10 +157,6 @@ module Appium
|
|
157
157
|
|
158
158
|
get_timeouts: [:get, 'session/:session_id/timeouts'], # https://w3c.github.io/webdriver/#get-timeouts
|
159
159
|
|
160
|
-
# Add OSS commands to W3C commands. We can remove them if we would like to remove them from W3C module.
|
161
|
-
### Session capability
|
162
|
-
get_capabilities: [:get, 'session/:session_id'],
|
163
|
-
|
164
160
|
### rotatable
|
165
161
|
get_screen_orientation: [:get, 'session/:session_id/orientation'],
|
166
162
|
set_screen_orientation: [:post, 'session/:session_id/orientation'],
|
@@ -184,21 +180,10 @@ module Appium
|
|
184
180
|
###
|
185
181
|
|
186
182
|
# common
|
187
|
-
get_all_sessions: [:get, 'sessions'],
|
188
183
|
available_contexts: [:get, 'session/:session_id/contexts'],
|
189
184
|
set_context: [:post, 'session/:session_id/context'],
|
190
185
|
current_context: [:get, 'session/:session_id/context'],
|
191
186
|
|
192
|
-
touch_actions: [:post, 'session/:session_id/touch/perform'],
|
193
|
-
multi_touch: [:post, 'session/:session_id/touch/multi/perform'],
|
194
|
-
|
195
|
-
# TODO: remove
|
196
|
-
set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'],
|
197
|
-
replace_value: [:post, 'session/:session_id/appium/element/:id/replace_value'],
|
198
|
-
|
199
|
-
launch_app: [:post, 'session/:session_id/appium/app/launch'],
|
200
|
-
close_app: [:post, 'session/:session_id/appium/app/close'],
|
201
|
-
reset: [:post, 'session/:session_id/appium/app/reset'],
|
202
187
|
background_app: [:post, 'session/:session_id/appium/app/background'],
|
203
188
|
app_strings: [:post, 'session/:session_id/appium/app/strings'],
|
204
189
|
|
@@ -244,7 +229,6 @@ module Appium
|
|
244
229
|
toggle_wifi: [:post, 'session/:session_id/appium/device/toggle_wifi'],
|
245
230
|
toggle_data: [:post, 'session/:session_id/appium/device/toggle_data'],
|
246
231
|
toggle_location_services: [:post, 'session/:session_id/appium/device/toggle_location_services'],
|
247
|
-
end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'],
|
248
232
|
get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'],
|
249
233
|
get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'],
|
250
234
|
get_network_connection: [:get, 'session/:session_id/network_connection'], # defined also in OSS
|
@@ -17,24 +17,6 @@ module Appium
|
|
17
17
|
class Base
|
18
18
|
module Device
|
19
19
|
module AppManagement
|
20
|
-
def launch_app
|
21
|
-
::Appium::Logger.warn(
|
22
|
-
'[DEPRECATION] launch_app is deprecated. Please use activate_app instead.'
|
23
|
-
)
|
24
|
-
execute :launch_app
|
25
|
-
end
|
26
|
-
|
27
|
-
def close_app
|
28
|
-
::Appium::Logger.warn(
|
29
|
-
'[DEPRECATION] close_app is deprecated. Please use terminate_app instead.'
|
30
|
-
)
|
31
|
-
execute :close_app
|
32
|
-
end
|
33
|
-
|
34
|
-
def reset
|
35
|
-
execute :reset
|
36
|
-
end
|
37
|
-
|
38
20
|
def app_strings(language = nil)
|
39
21
|
opts = language ? { language: language } : {}
|
40
22
|
execute :app_strings, {}, opts
|
@@ -44,8 +44,7 @@ module Appium
|
|
44
44
|
|
45
45
|
# @since Appium 1.16.0
|
46
46
|
#
|
47
|
-
# Logs a custom event. The event is available via {::Appium::Core::Events#get}
|
48
|
-
# <code>@driver.session_capabilities['events']</code> with <code>eventTimings</code> capabilities.
|
47
|
+
# Logs a custom event. The event is available via {::Appium::Core::Events#get}.
|
49
48
|
#
|
50
49
|
# @param [String] vendor The vendor prefix for the event
|
51
50
|
# @param [String] event The name of event
|
@@ -54,7 +53,6 @@ module Appium
|
|
54
53
|
# @example
|
55
54
|
#
|
56
55
|
# @driver.logs.event vendor: 'appium', event: 'funEvent'
|
57
|
-
# @driver.session_capabilities['events'] #=> {...., 'appium:funEvent' => 1572957315}
|
58
56
|
#
|
59
57
|
# @driver.logs.event = { vendor: 'appium', event: 'anotherEvent' }
|
60
58
|
# @driver.logs.events #=> {...., 'appium:funEvent' => [1572957315, 1572960305],
|
@@ -29,17 +29,15 @@ module Appium
|
|
29
29
|
:hide_keyboard, :is_keyboard_shown,
|
30
30
|
:ime_activate, :ime_available_engines, :ime_active_engine, :ime_activated, :ime_deactivate,
|
31
31
|
:get_settings, :update_settings,
|
32
|
-
:within_context, :
|
33
|
-
:set_immediate_value, :replace_value,
|
32
|
+
:within_context, :current_context, :available_contexts, :set_context,
|
34
33
|
:push_file, :pull_file, :pull_folder,
|
35
34
|
:keyevent, :press_keycode, :long_press_keycode,
|
36
35
|
:match_images_features, :find_image_occurrence, :get_images_similarity, :compare_images,
|
37
|
-
:
|
36
|
+
:app_strings, :background_app,
|
38
37
|
:install_app, :remove_app, :app_installed?, :activate_app, :terminate_app,
|
39
38
|
:app_state,
|
40
39
|
:stop_recording_screen, :stop_and_save_recording_screen,
|
41
40
|
:shake, :device_time,
|
42
|
-
:touch_actions, :multi_touch,
|
43
41
|
:execute_driver, :execute_cdp
|
44
42
|
].each(&method(:delegate_from_appium_driver))
|
45
43
|
end
|
@@ -64,35 +64,6 @@ module Appium
|
|
64
64
|
# Alias for type
|
65
65
|
alias type send_keys
|
66
66
|
|
67
|
-
# @deprecated Use element send_keys instead.
|
68
|
-
# Set the value to element directly
|
69
|
-
#
|
70
|
-
# @example
|
71
|
-
#
|
72
|
-
# element.immediate_value 'hello'
|
73
|
-
#
|
74
|
-
def immediate_value(*value)
|
75
|
-
::Appium::Logger.warn(
|
76
|
-
'[DEPRECATION] element.immediate_value is deprecated. Please use element.send_keys instead.'
|
77
|
-
)
|
78
|
-
@bridge.set_immediate_value @id, *value
|
79
|
-
end
|
80
|
-
|
81
|
-
# @deprecated Use element send_keys or 'mobile: replaceElementValue' for UIAutomator2 instead.
|
82
|
-
# Replace the value to element directly
|
83
|
-
#
|
84
|
-
# @example
|
85
|
-
#
|
86
|
-
# element.replace_value 'hello'
|
87
|
-
#
|
88
|
-
def replace_value(*value)
|
89
|
-
::Appium::Logger.warn(
|
90
|
-
'[DEPRECATION] element.replace_value is deprecated. Please use element.send_keys instead, ' \
|
91
|
-
'or "mobile: replaceElementValue" for UIAutomator2.'
|
92
|
-
)
|
93
|
-
@bridge.replace_value @id, *value
|
94
|
-
end
|
95
|
-
|
96
67
|
# For use with location_rel.
|
97
68
|
#
|
98
69
|
# @return [::Selenium::WebDriver::Point] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
module Core
|
17
|
-
VERSION = '
|
18
|
-
DATE = '2024-
|
17
|
+
VERSION = '8.0.0' unless defined? ::Appium::Core::VERSION
|
18
|
+
DATE = '2024-03-08' unless defined? ::Appium::Core::DATE
|
19
19
|
end
|
20
20
|
end
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
require_relative 'device/screen'
|
16
|
-
require_relative 'device/app_management'
|
17
16
|
|
18
17
|
module Appium
|
19
18
|
module Core
|
@@ -79,7 +78,6 @@ module Appium
|
|
79
78
|
class << self
|
80
79
|
def extended(_mod)
|
81
80
|
Screen.add_methods
|
82
|
-
AppManagement.add_methods
|
83
81
|
end
|
84
82
|
end # class << self
|
85
83
|
end # module Device
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -100,28 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 3.
|
103
|
+
version: 3.23.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 3.
|
110
|
+
version: 3.23.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.62.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.62.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: appium_thor
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,13 +228,9 @@ files:
|
|
228
228
|
- lib/appium_lib_core/common/device/orientation.rb
|
229
229
|
- lib/appium_lib_core/common/device/screen_record.rb
|
230
230
|
- lib/appium_lib_core/common/device/setting.rb
|
231
|
-
- lib/appium_lib_core/common/device/touch_actions.rb
|
232
|
-
- lib/appium_lib_core/common/device/value.rb
|
233
231
|
- lib/appium_lib_core/common/error.rb
|
234
232
|
- lib/appium_lib_core/common/log.rb
|
235
233
|
- lib/appium_lib_core/common/logger.rb
|
236
|
-
- lib/appium_lib_core/common/touch_action/multi_touch.rb
|
237
|
-
- lib/appium_lib_core/common/touch_action/touch_actions.rb
|
238
234
|
- lib/appium_lib_core/common/wait.rb
|
239
235
|
- lib/appium_lib_core/common/wait/timer.rb
|
240
236
|
- lib/appium_lib_core/common/ws/websocket.rb
|
@@ -258,7 +254,6 @@ files:
|
|
258
254
|
- lib/appium_lib_core/windows.rb
|
259
255
|
- lib/appium_lib_core/windows/bridge.rb
|
260
256
|
- lib/appium_lib_core/windows/device.rb
|
261
|
-
- lib/appium_lib_core/windows/device/app_management.rb
|
262
257
|
- lib/appium_lib_core/windows/device/screen.rb
|
263
258
|
homepage: https://github.com/appium/ruby_lib_core/
|
264
259
|
licenses:
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
require_relative '../touch_action/touch_actions'
|
16
|
-
require_relative '../touch_action/multi_touch'
|
17
|
-
|
18
|
-
module Appium
|
19
|
-
module Core
|
20
|
-
class Base
|
21
|
-
module Device
|
22
|
-
module TouchActions
|
23
|
-
# @deprecated Use W3C actions instead
|
24
|
-
def touch_actions(actions)
|
25
|
-
actions = { actions: [actions].flatten }
|
26
|
-
execute :touch_actions, {}, actions
|
27
|
-
end
|
28
|
-
|
29
|
-
# @deprecated Use W3C actions instead
|
30
|
-
def multi_touch(actions)
|
31
|
-
execute :multi_touch, {}, actions: actions
|
32
|
-
end
|
33
|
-
end # module TouchActions
|
34
|
-
end # module Device
|
35
|
-
end # class Base
|
36
|
-
end # module Core
|
37
|
-
end # module Appium
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Appium
|
16
|
-
module Core
|
17
|
-
class Base
|
18
|
-
module Device
|
19
|
-
module Value
|
20
|
-
def set_immediate_value(element_id, *value)
|
21
|
-
execute :set_immediate_value, { id: element_id }, generate_value_and_text(value)
|
22
|
-
end
|
23
|
-
|
24
|
-
def replace_value(element_id, *value)
|
25
|
-
execute :replace_value, { id: element_id }, generate_value_and_text(value)
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def generate_value_and_text(*value)
|
31
|
-
keys = ::Selenium::WebDriver::Keys.encode(*value)
|
32
|
-
|
33
|
-
if @file_detector
|
34
|
-
local_files = keys.first.split("\n").map { |key| @file_detector.call(Array(key)) }.compact
|
35
|
-
if local_files.any?
|
36
|
-
keys = local_files.map { |local_file| upload(local_file) }
|
37
|
-
keys = Array(keys.join("\n"))
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Keep .split(//) for backward compatibility for now
|
42
|
-
text = keys.join
|
43
|
-
|
44
|
-
{ text: text }
|
45
|
-
end
|
46
|
-
end # module Value
|
47
|
-
end # module Device
|
48
|
-
end # class Base
|
49
|
-
end # module Core
|
50
|
-
end # module Appium
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Appium
|
16
|
-
module Core
|
17
|
-
#
|
18
|
-
# @deprecated Use W3C actions instead
|
19
|
-
#
|
20
|
-
# MultiTouch actions allow for multiple touches to happen at the same time,
|
21
|
-
# for instance, to simulate multiple finger swipes.
|
22
|
-
#
|
23
|
-
# Create a series of touch actions by themselves (without a +prepare()+), then
|
24
|
-
# add to a new MultiTouch action. When ready, call +prepare()+ and all
|
25
|
-
# actions will be executed simultaneously.
|
26
|
-
#
|
27
|
-
# Consider to use W3C spec touch action like the followings.
|
28
|
-
# https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
|
29
|
-
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/android/webdriver/w3c_actions_test.rb
|
30
|
-
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/ios/webdriver/w3c_actions_test.rb
|
31
|
-
#
|
32
|
-
# About W3C actions
|
33
|
-
# https://www.youtube.com/watch?v=oAJ7jwMNFVU
|
34
|
-
# https://appiumpro.com/editions/30-ios-specific-touch-action-methods
|
35
|
-
# https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
|
36
|
-
#
|
37
|
-
# Functional test code in ruby_lib_core repository also helps.
|
38
|
-
#
|
39
|
-
# @example
|
40
|
-
#
|
41
|
-
# @driver = Appium::Core.for(opts).start_driver
|
42
|
-
# action_1 = Appium::Core::TouchAction.new(@driver).press(x: 45, y: 100).wait(600).release
|
43
|
-
# action_2 = Appium::Core::TouchAction.new(@driver).tap(element: el, x: 50, y:5, count: 3)
|
44
|
-
#
|
45
|
-
# multi_touch_action = MultiTouch.new(@driver)
|
46
|
-
# multi_touch_action.add action_1
|
47
|
-
# multi_touch_action.add action_2
|
48
|
-
# multi_touch_action.perform
|
49
|
-
#
|
50
|
-
class MultiTouch
|
51
|
-
attr_reader :driver
|
52
|
-
|
53
|
-
def initialize(driver)
|
54
|
-
::Appium::Logger.warn(
|
55
|
-
'[DEPRECATION] Appium::Core::MultiTouch is deprecated in W3C spec. Use W3C actions instead'
|
56
|
-
)
|
57
|
-
|
58
|
-
@actions = []
|
59
|
-
@driver = driver
|
60
|
-
end
|
61
|
-
|
62
|
-
# Add a touch_action to be performed
|
63
|
-
# @param chain (TouchAction) The action to add to the chain
|
64
|
-
def add(chain)
|
65
|
-
@actions << chain.actions
|
66
|
-
end
|
67
|
-
|
68
|
-
# Ask Appium to perform the actions
|
69
|
-
def perform
|
70
|
-
@driver.multi_touch @actions
|
71
|
-
@actions.clear
|
72
|
-
end
|
73
|
-
end # class MultiTouch
|
74
|
-
end # module Core
|
75
|
-
end # module Appium
|
@@ -1,217 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Appium
|
16
|
-
module Core
|
17
|
-
#
|
18
|
-
# @deprecated Use W3C actions instead
|
19
|
-
#
|
20
|
-
# Perform a series of gestures, one after another. Gestures are chained
|
21
|
-
# together and only performed when +perform()+ is called. Default is conducted by global driver.
|
22
|
-
#
|
23
|
-
# Each method returns the object itself, so calls can be chained.
|
24
|
-
#
|
25
|
-
# Consider to use W3C spec touch action like the followings.
|
26
|
-
# https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
|
27
|
-
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/android/webdriver/w3c_actions_test.rb
|
28
|
-
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/ios/webdriver/w3c_actions_test.rb
|
29
|
-
#
|
30
|
-
# About W3C actions
|
31
|
-
# https://www.youtube.com/watch?v=oAJ7jwMNFVU
|
32
|
-
# https://appiumpro.com/editions/30-ios-specific-touch-action-methods
|
33
|
-
# https://appiumpro.com/editions/29-automating-complex-gestures-with-the-w3c-actions-api
|
34
|
-
#
|
35
|
-
# Functional test code in ruby_lib_core repository also helps.
|
36
|
-
#
|
37
|
-
# @example
|
38
|
-
#
|
39
|
-
# @driver = Appium::Core.for(opts).start_driver
|
40
|
-
# action = Appium::Core::TouchAction.new(@driver).press(x: 45, y: 100).wait(600).release
|
41
|
-
# action.perform
|
42
|
-
# action = Appium::Core::TouchAction.new(@driver).swipe(....)
|
43
|
-
# action.perform
|
44
|
-
#
|
45
|
-
class TouchAction
|
46
|
-
ACTIONS = %i(move_to long_press double_tap two_finger_tap press release tap wait perform).freeze
|
47
|
-
COMPLEX_ACTIONS = %i(swipe).freeze
|
48
|
-
|
49
|
-
attr_reader :actions, :driver
|
50
|
-
|
51
|
-
def initialize(driver)
|
52
|
-
::Appium::Logger.warn(
|
53
|
-
'[DEPRECATION] Appium::Core::TouchAction is deprecated in W3C spec. Use W3C actions instead'
|
54
|
-
)
|
55
|
-
|
56
|
-
@actions = []
|
57
|
-
@driver = driver
|
58
|
-
end
|
59
|
-
|
60
|
-
# Move to the given co-ordinates.
|
61
|
-
#
|
62
|
-
# +move_to+'s +x+ and +y+ have two case. One is working as coordinate, the other is working as offset.
|
63
|
-
#
|
64
|
-
# @param opts [Hash] Options
|
65
|
-
# @option opts [integer] :x x co-ordinate to move to if element isn't set. Works as an absolute if x is set with Element.
|
66
|
-
# @option opts [integer] :y y co-ordinate to move to if element isn't set. Works as an absolute if y is set with Element.
|
67
|
-
# @option opts [WebDriver::Element] Element to scope this move within.
|
68
|
-
def move_to(opts)
|
69
|
-
opts = args_with_ele_ref(opts)
|
70
|
-
chain_method(:moveTo, opts)
|
71
|
-
end
|
72
|
-
|
73
|
-
# Press down for a specific duration.
|
74
|
-
# Alternatively, you can use +press(...).wait(...).release()+ instead of +long_press+ if duration doesn't work well.
|
75
|
-
# https://github.com/appium/ruby_lib/issues/231#issuecomment-269895512
|
76
|
-
# e.g. Appium::Core::TouchAction.new.press(x: 280, y: 530).wait(2000).release.perform
|
77
|
-
#
|
78
|
-
# @param opts [Hash] Options
|
79
|
-
# @option opts [WebDriver::Element] element the element to press.
|
80
|
-
# @option opts [integer] x X co-ordinate to press on.
|
81
|
-
# @option opts [integer] y Y co-ordinate to press on.
|
82
|
-
# @option opts [integer] duration Number of milliseconds to press.
|
83
|
-
def long_press(opts)
|
84
|
-
args = opts.select { |k, _v| %i(element x y duration).include? k }
|
85
|
-
args = args_with_ele_ref(args)
|
86
|
-
chain_method(:longPress, args) # longPress is what the appium server expects
|
87
|
-
end
|
88
|
-
|
89
|
-
# Press a finger onto the screen. Finger will stay down until you call +release+.
|
90
|
-
#
|
91
|
-
# @param opts [Hash] Options
|
92
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to press within.
|
93
|
-
# @option opts [integer] :x x co-ordinate to press on
|
94
|
-
# @option opts [integer] :y y co-ordinate to press on
|
95
|
-
# @option opts [Float] pressure (iOS Only) press as force touch.
|
96
|
-
# See the description of +force+ property on Apple's UITouch class
|
97
|
-
# (https://developer.apple.com/documentation/uikit/uitouch?language=objc)
|
98
|
-
# for more details on possible value ranges.
|
99
|
-
def press(opts)
|
100
|
-
args = opts.select { |k, _v| %i(element x y).include? k }
|
101
|
-
args = args_with_ele_ref(args)
|
102
|
-
args[:pressure] = opts.delete(:pressure) unless opts[:pressure].nil?
|
103
|
-
chain_method(:press, args)
|
104
|
-
end
|
105
|
-
|
106
|
-
# Remove a finger from the screen.
|
107
|
-
#
|
108
|
-
# @param opts [Hash] Options
|
109
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to release from.
|
110
|
-
# @option opts [integer] :x x co-ordinate to release from
|
111
|
-
# @option opts [integer] :y y co-ordinate to release from
|
112
|
-
def release(opts = nil)
|
113
|
-
args = args_with_ele_ref(opts) if opts
|
114
|
-
chain_method(:release, args)
|
115
|
-
end
|
116
|
-
|
117
|
-
# Touch a point on the screen.
|
118
|
-
# Alternatively, you can use +press(...).release.perform+ instead of +tap(...).perform+.
|
119
|
-
#
|
120
|
-
# @param opts [Hash] Options
|
121
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
122
|
-
# @option opts [integer] :x x co-ordinate to tap
|
123
|
-
# @option opts [integer] :y y co-ordinate to tap
|
124
|
-
# @option opts [integer] :fingers how many fingers to tap with (Default 1)
|
125
|
-
def tap(opts)
|
126
|
-
opts[:count] = opts.delete(:fingers) if opts[:fingers]
|
127
|
-
opts[:count] ||= 1
|
128
|
-
args = args_with_ele_ref opts
|
129
|
-
chain_method(:tap, args)
|
130
|
-
end
|
131
|
-
|
132
|
-
# Double tap an element on the screen
|
133
|
-
#
|
134
|
-
# @param opts [Hash] Options
|
135
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
136
|
-
# @option opts [integer] :x x co-ordinate to tap
|
137
|
-
# @option opts [integer] :y y co-ordinate to tap
|
138
|
-
|
139
|
-
def double_tap(opts)
|
140
|
-
args = opts.select { |k, _v| %i(element x y).include? k }
|
141
|
-
args = args_with_ele_ref(args)
|
142
|
-
chain_method(:doubleTap, args) # doubleTap is what the appium server expects
|
143
|
-
end
|
144
|
-
|
145
|
-
# Two finger tap an element on the screen
|
146
|
-
#
|
147
|
-
# @param opts [Hash] Options
|
148
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
149
|
-
# @option opts [integer] :x x co-ordinate to tap
|
150
|
-
# @option opts [integer] :y y co-ordinate to tap
|
151
|
-
def two_finger_tap(opts)
|
152
|
-
args = opts.select { |k, _v| %i(element x y).include? k }
|
153
|
-
args = args_with_ele_ref(args)
|
154
|
-
chain_method(:twoFingerTap, args) # twoFingerTap is what the appium server expects
|
155
|
-
end
|
156
|
-
|
157
|
-
# Pause for a number of milliseconds before the next action
|
158
|
-
# @param milliseconds [integer] Number of milliseconds to pause for
|
159
|
-
def wait(milliseconds)
|
160
|
-
args = { ms: milliseconds }
|
161
|
-
chain_method(:wait, args)
|
162
|
-
end
|
163
|
-
|
164
|
-
# Convenience method to perform a swipe.
|
165
|
-
#
|
166
|
-
# @param opts [Hash] Options
|
167
|
-
# @option opts [int] :start_x Where to start swiping, on the x axis. Default 0.
|
168
|
-
# @option opts [int] :start_y Where to start swiping, on the y axis. Default 0.
|
169
|
-
# @option opts [int] :end_x Move to the end, on the x axis. Default 0.
|
170
|
-
# @option opts [int] :end_y Move to the end, on the y axis. Default 0.
|
171
|
-
# @option opts [int] :duration How long the actual swipe takes to complete in milliseconds. Default 200.
|
172
|
-
def swipe(opts)
|
173
|
-
start_x = opts.fetch :start_x, 0
|
174
|
-
start_y = opts.fetch :start_y, 0
|
175
|
-
end_x = opts.fetch :end_x, 0
|
176
|
-
end_y = opts.fetch :end_y, 0
|
177
|
-
|
178
|
-
duration = opts.fetch :duration, 200
|
179
|
-
|
180
|
-
press x: start_x, y: start_y
|
181
|
-
wait(duration) if duration
|
182
|
-
move_to x: end_x, y: end_y
|
183
|
-
|
184
|
-
release
|
185
|
-
|
186
|
-
self
|
187
|
-
end
|
188
|
-
|
189
|
-
# Ask the driver to perform all actions in this action chain.
|
190
|
-
def perform
|
191
|
-
@driver.touch_actions @actions
|
192
|
-
@actions.clear
|
193
|
-
self
|
194
|
-
end
|
195
|
-
|
196
|
-
# Does nothing, currently.
|
197
|
-
def cancel
|
198
|
-
@actions << { action: cancel }
|
199
|
-
@driver.touch_actions @actions
|
200
|
-
self
|
201
|
-
end
|
202
|
-
|
203
|
-
private
|
204
|
-
|
205
|
-
def chain_method(method, args = nil)
|
206
|
-
action = args ? { action: method, options: args } : { action: method }
|
207
|
-
@actions << action
|
208
|
-
self
|
209
|
-
end
|
210
|
-
|
211
|
-
def args_with_ele_ref(args)
|
212
|
-
args[:element] = args[:element].id if args.key? :element
|
213
|
-
args
|
214
|
-
end
|
215
|
-
end # class TouchAction
|
216
|
-
end # module Core
|
217
|
-
end # module Appium
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Appium
|
16
|
-
module Core
|
17
|
-
module Windows
|
18
|
-
module Device
|
19
|
-
module AppManagement
|
20
|
-
# override
|
21
|
-
def self.add_methods
|
22
|
-
::Appium::Core::Device.add_endpoint_method(:launch_app) do
|
23
|
-
def launch_app
|
24
|
-
execute :launch_app
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
::Appium::Core::Device.add_endpoint_method(:close_app) do
|
29
|
-
def close_app
|
30
|
-
execute :close_app
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end # module AppManagement
|
35
|
-
end # module Device
|
36
|
-
end # module Windows
|
37
|
-
end # module Core
|
38
|
-
end # module Appium
|