appium_lib_core 4.1.0 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +357 -270
- data/README.md +68 -16
- data/Rakefile +8 -20
- data/Steepfile +11 -0
- data/appium_lib_core.gemspec +13 -15
- data/bin/console +0 -4
- data/lib/appium_lib_core/android/device/auth_finger_print.rb +4 -1
- data/lib/appium_lib_core/android/device/clipboard.rb +4 -2
- data/lib/appium_lib_core/android/device/emulator.rb +11 -5
- data/lib/appium_lib_core/android/device/network.rb +10 -0
- data/lib/appium_lib_core/android/device/performance.rb +3 -0
- data/lib/appium_lib_core/android/device/screen.rb +5 -1
- data/lib/appium_lib_core/android/device.rb +83 -20
- data/lib/appium_lib_core/common/base/bridge.rb +238 -95
- data/lib/appium_lib_core/common/base/capabilities.rb +21 -8
- data/lib/appium_lib_core/common/{command/mjsonwp.rb → base/device_ime.rb} +33 -12
- data/lib/appium_lib_core/common/base/driver.rb +260 -334
- data/lib/appium_lib_core/common/base/driver_settings.rb +51 -0
- data/lib/appium_lib_core/common/base/has_location.rb +80 -0
- data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
- data/lib/appium_lib_core/common/base/http_default.rb +22 -38
- data/lib/appium_lib_core/{ios/uiautomation/bridge.rb → common/base/remote_status.rb} +9 -8
- data/lib/appium_lib_core/common/base/rotable.rb +62 -0
- data/lib/appium_lib_core/common/base/screenshot.rb +10 -10
- data/lib/appium_lib_core/common/base/search_context.rb +98 -172
- data/lib/appium_lib_core/common/base.rb +1 -5
- data/lib/appium_lib_core/common/command.rb +244 -4
- data/lib/appium_lib_core/common/device/app_management.rb +2 -26
- data/lib/appium_lib_core/common/device/context.rb +1 -5
- data/lib/appium_lib_core/common/device/image_comparison.rb +27 -10
- data/lib/appium_lib_core/common/device/keyevent.rb +4 -4
- data/lib/appium_lib_core/common/device/{touch_actions.rb → orientation.rb} +6 -10
- data/lib/appium_lib_core/common/device/screen_record.rb +8 -2
- data/lib/appium_lib_core/common/error.rb +5 -5
- data/lib/appium_lib_core/common/log.rb +5 -4
- data/lib/appium_lib_core/common/wait.rb +38 -6
- data/lib/appium_lib_core/device.rb +3 -9
- data/lib/appium_lib_core/driver.rb +193 -182
- data/lib/appium_lib_core/{patch.rb → element.rb} +64 -26
- data/lib/appium_lib_core/ios/device/clipboard.rb +4 -2
- data/lib/appium_lib_core/ios/xcuitest/device.rb +2 -0
- data/lib/appium_lib_core/{common/base/command.rb → mac2/bridge.rb} +9 -8
- data/lib/appium_lib_core/mac2/device/screen.rb +48 -0
- data/lib/appium_lib_core/mac2/device.rb +92 -0
- data/lib/appium_lib_core/{ios.rb → mac2.rb} +2 -5
- data/lib/appium_lib_core/support/event_firing_bridge.rb +57 -0
- data/lib/appium_lib_core/version.rb +2 -2
- data/lib/appium_lib_core.rb +23 -10
- data/rbs_collection.lock.yaml +252 -0
- data/rbs_collection.yaml +15 -0
- data/sig/gems/selenium/abstract_event_listener.rbs +8 -0
- data/sig/gems/selenium/capabilities.rbs +8 -0
- data/sig/gems/selenium/common.rbs +10 -0
- data/sig/gems/selenium/default.rbs +10 -0
- data/sig/gems/selenium/driver.rbs +7 -0
- data/sig/gems/selenium/has_session_id.rbs +8 -0
- data/sig/gems/selenium/has_web_storage.rbs +8 -0
- data/sig/gems/selenium/uploads_files.rbs +8 -0
- data/sig/lib/appium_lib_core/common/base/capabilities.rbs +9 -0
- data/sig/lib/appium_lib_core/common/base/driver.rbs +167 -0
- data/sig/lib/appium_lib_core/common/base/driver_settings.rbs +15 -0
- data/sig/lib/appium_lib_core/common/base/has_location.rbs +13 -0
- data/sig/lib/appium_lib_core/common/base/has_network_connection.rbs +19 -0
- data/sig/lib/appium_lib_core/common/base/http_default.rbs +38 -0
- data/sig/lib/appium_lib_core/common/base/platform.rbs +7 -0
- data/sig/lib/appium_lib_core/common/base/remote_status.rbs +9 -0
- data/sig/lib/appium_lib_core/common/base/rotable.rbs +17 -0
- data/sig/lib/appium_lib_core/common/base/screenshot.rbs +19 -0
- data/sig/lib/appium_lib_core/common/device/battery_status.rbs +13 -0
- data/sig/lib/appium_lib_core/common/wait.rbs +31 -0
- data/sig/lib/appium_lib_core/device.rbs +21 -0
- data/sig/lib/appium_lib_core/driver.rbs +196 -0
- data/sig/lib/appium_lib_core/ios/xcuitest/device/battery.rbs +15 -0
- data/sig/lib/appium_lib_core/version.rbs +7 -0
- data/sig/lib/appium_lib_core.rbs +8 -0
- metadata +88 -111
- data/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
- data/.github/contributing.md +0 -26
- data/.github/issue_template.md +0 -20
- data/.github/workflows/unittest.yml +0 -68
- data/.gitignore +0 -18
- data/.rubocop.yml +0 -58
- data/azure-pipelines.yml +0 -15
- data/ci-jobs/functional/android_setup.yml +0 -3
- data/ci-jobs/functional/ios_setup.yml +0 -7
- data/ci-jobs/functional/publish_test_result.yml +0 -18
- data/ci-jobs/functional/run_appium.yml +0 -25
- data/ci-jobs/functional/start-emulator.sh +0 -26
- data/ci-jobs/functional_test.yml +0 -298
- data/docs/mobile_command.md +0 -34
- data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +0 -252
- data/lib/appium_lib_core/common/command/common.rb +0 -110
- data/lib/appium_lib_core/common/command/w3c.rb +0 -56
- data/lib/appium_lib_core/common/device/value.rb +0 -52
- data/lib/appium_lib_core/common/touch_action/multi_touch.rb +0 -56
- data/lib/appium_lib_core/common/touch_action/touch_actions.rb +0 -203
- data/lib/appium_lib_core/ios/uiautomation/device.rb +0 -44
- data/lib/appium_lib_core/ios/uiautomation/patch.rb +0 -34
- data/release_notes.md +0 -816
- data/script/commands.rb +0 -200
|
@@ -1,203 +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
|
-
# Perform a series of gestures, one after another. Gestures are chained
|
|
18
|
-
# together and only performed when +perform()+ is called. Default is conducted by global driver.
|
|
19
|
-
#
|
|
20
|
-
# Each method returns the object itself, so calls can be chained.
|
|
21
|
-
#
|
|
22
|
-
# Consider to use W3C spec touch action like the followings.
|
|
23
|
-
# https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
|
|
24
|
-
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/android/webdriver/w3c_actions_test.rb
|
|
25
|
-
# https://github.com/appium/ruby_lib_core/blob/master/test/functional/ios/webdriver/w3c_actions_test.rb
|
|
26
|
-
#
|
|
27
|
-
# @example
|
|
28
|
-
#
|
|
29
|
-
# @driver = Appium::Core.for(opts).start_driver
|
|
30
|
-
# action = Appium::Core::TouchAction.new(@driver).press(x: 45, y: 100).wait(600).release
|
|
31
|
-
# action.perform
|
|
32
|
-
# action = Appium::Core::TouchAction.new(@driver).swipe(....)
|
|
33
|
-
# action.perform
|
|
34
|
-
#
|
|
35
|
-
class TouchAction
|
|
36
|
-
ACTIONS = %i(move_to long_press double_tap two_finger_tap press release tap wait perform).freeze
|
|
37
|
-
COMPLEX_ACTIONS = %i(swipe).freeze
|
|
38
|
-
|
|
39
|
-
attr_reader :actions, :driver
|
|
40
|
-
|
|
41
|
-
def initialize(driver)
|
|
42
|
-
@actions = []
|
|
43
|
-
@driver = driver
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Move to the given co-ordinates.
|
|
47
|
-
#
|
|
48
|
-
# +move_to+'s +x+ and +y+ have two case. One is working as coordinate, the other is working as offset.
|
|
49
|
-
#
|
|
50
|
-
# @param opts [Hash] Options
|
|
51
|
-
# @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.
|
|
52
|
-
# @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.
|
|
53
|
-
# @option opts [WebDriver::Element] Element to scope this move within.
|
|
54
|
-
def move_to(opts)
|
|
55
|
-
opts = args_with_ele_ref(opts)
|
|
56
|
-
chain_method(:moveTo, opts)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Press down for a specific duration.
|
|
60
|
-
# Alternatively, you can use +press(...).wait(...).release()+ instead of +long_press+ if duration doesn't work well.
|
|
61
|
-
# https://github.com/appium/ruby_lib/issues/231#issuecomment-269895512
|
|
62
|
-
# e.g. Appium::Core::TouchAction.new.press(x: 280, y: 530).wait(2000).release.perform
|
|
63
|
-
#
|
|
64
|
-
# @param opts [Hash] Options
|
|
65
|
-
# @option opts [WebDriver::Element] element the element to press.
|
|
66
|
-
# @option opts [integer] x X co-ordinate to press on.
|
|
67
|
-
# @option opts [integer] y Y co-ordinate to press on.
|
|
68
|
-
# @option opts [integer] duration Number of milliseconds to press.
|
|
69
|
-
def long_press(opts)
|
|
70
|
-
args = opts.select { |k, _v| %i(element x y duration).include? k }
|
|
71
|
-
args = args_with_ele_ref(args)
|
|
72
|
-
chain_method(:longPress, args) # longPress is what the appium server expects
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Press a finger onto the screen. Finger will stay down until you call +release+.
|
|
76
|
-
#
|
|
77
|
-
# @param opts [Hash] Options
|
|
78
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to press within.
|
|
79
|
-
# @option opts [integer] :x x co-ordinate to press on
|
|
80
|
-
# @option opts [integer] :y y co-ordinate to press on
|
|
81
|
-
# @option opts [Float] pressure (iOS Only) press as force touch.
|
|
82
|
-
# See the description of +force+ property on Apple's UITouch class
|
|
83
|
-
# (https://developer.apple.com/documentation/uikit/uitouch?language=objc)
|
|
84
|
-
# for more details on possible value ranges.
|
|
85
|
-
def press(opts)
|
|
86
|
-
args = opts.select { |k, _v| %i(element x y).include? k }
|
|
87
|
-
args = args_with_ele_ref(args)
|
|
88
|
-
args[:pressure] = opts.delete(:pressure) unless opts[:pressure].nil?
|
|
89
|
-
chain_method(:press, args)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
# Remove a finger from the screen.
|
|
93
|
-
#
|
|
94
|
-
# @param opts [Hash] Options
|
|
95
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to release from.
|
|
96
|
-
# @option opts [integer] :x x co-ordinate to release from
|
|
97
|
-
# @option opts [integer] :y y co-ordinate to release from
|
|
98
|
-
def release(opts = nil)
|
|
99
|
-
args = args_with_ele_ref(opts) if opts
|
|
100
|
-
chain_method(:release, args)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# Touch a point on the screen.
|
|
104
|
-
# Alternatively, you can use +press(...).release.perform+ instead of +tap(...).perform+.
|
|
105
|
-
#
|
|
106
|
-
# @param opts [Hash] Options
|
|
107
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
|
108
|
-
# @option opts [integer] :x x co-ordinate to tap
|
|
109
|
-
# @option opts [integer] :y y co-ordinate to tap
|
|
110
|
-
# @option opts [integer] :fingers how many fingers to tap with (Default 1)
|
|
111
|
-
def tap(opts)
|
|
112
|
-
opts[:count] = opts.delete(:fingers) if opts[:fingers]
|
|
113
|
-
opts[:count] ||= 1
|
|
114
|
-
args = args_with_ele_ref opts
|
|
115
|
-
chain_method(:tap, args)
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
# Double tap an element on the screen
|
|
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
|
-
|
|
125
|
-
def double_tap(opts)
|
|
126
|
-
args = opts.select { |k, _v| %i(element x y).include? k }
|
|
127
|
-
args = args_with_ele_ref(args)
|
|
128
|
-
chain_method(:doubleTap, args) # doubleTap is what the appium server expects
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# Two finger tap an element on the screen
|
|
132
|
-
#
|
|
133
|
-
# @param opts [Hash] Options
|
|
134
|
-
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
|
135
|
-
# @option opts [integer] :x x co-ordinate to tap
|
|
136
|
-
# @option opts [integer] :y y co-ordinate to tap
|
|
137
|
-
def two_finger_tap(opts)
|
|
138
|
-
args = opts.select { |k, _v| %i(element x y).include? k }
|
|
139
|
-
args = args_with_ele_ref(args)
|
|
140
|
-
chain_method(:twoFingerTap, args) # twoFingerTap is what the appium server expects
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
# Pause for a number of milliseconds before the next action
|
|
144
|
-
# @param milliseconds [integer] Number of milliseconds to pause for
|
|
145
|
-
def wait(milliseconds)
|
|
146
|
-
args = { ms: milliseconds }
|
|
147
|
-
chain_method(:wait, args)
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
# Convenience method to perform a swipe.
|
|
151
|
-
#
|
|
152
|
-
# @param opts [Hash] Options
|
|
153
|
-
# @option opts [int] :start_x Where to start swiping, on the x axis. Default 0.
|
|
154
|
-
# @option opts [int] :start_y Where to start swiping, on the y axis. Default 0.
|
|
155
|
-
# @option opts [int] :end_x Move to the end, on the x axis. Default 0.
|
|
156
|
-
# @option opts [int] :end_y Move to the end, on the y axis. Default 0.
|
|
157
|
-
# @option opts [int] :duration How long the actual swipe takes to complete in milliseconds. Default 200.
|
|
158
|
-
def swipe(opts)
|
|
159
|
-
start_x = opts.fetch :start_x, 0
|
|
160
|
-
start_y = opts.fetch :start_y, 0
|
|
161
|
-
end_x = opts.fetch :end_x, 0
|
|
162
|
-
end_y = opts.fetch :end_y, 0
|
|
163
|
-
|
|
164
|
-
duration = opts.fetch :duration, 200
|
|
165
|
-
|
|
166
|
-
press x: start_x, y: start_y
|
|
167
|
-
wait(duration) if duration
|
|
168
|
-
move_to x: end_x, y: end_y
|
|
169
|
-
|
|
170
|
-
release
|
|
171
|
-
|
|
172
|
-
self
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
# Ask the driver to perform all actions in this action chain.
|
|
176
|
-
def perform
|
|
177
|
-
@driver.touch_actions @actions
|
|
178
|
-
@actions.clear
|
|
179
|
-
self
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# Does nothing, currently.
|
|
183
|
-
def cancel
|
|
184
|
-
@actions << { action: cancel }
|
|
185
|
-
@driver.touch_actions @actions
|
|
186
|
-
self
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
private
|
|
190
|
-
|
|
191
|
-
def chain_method(method, args = nil)
|
|
192
|
-
action = args ? { action: method, options: args } : { action: method }
|
|
193
|
-
@actions << action
|
|
194
|
-
self
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
def args_with_ele_ref(args)
|
|
198
|
-
args[:element] = args[:element].ref if args.key? :element
|
|
199
|
-
args
|
|
200
|
-
end
|
|
201
|
-
end # class TouchAction
|
|
202
|
-
end # module Core
|
|
203
|
-
end # module Appium
|
|
@@ -1,44 +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 Ios
|
|
18
|
-
module Uiautomation
|
|
19
|
-
module Device
|
|
20
|
-
def self.add_methods
|
|
21
|
-
# UiAutomation, Override included method in bridge
|
|
22
|
-
::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
|
|
23
|
-
def hide_keyboard(close_key = nil, strategy = nil)
|
|
24
|
-
option = {}
|
|
25
|
-
|
|
26
|
-
option[:key] = close_key || 'Done' # default to Done key.
|
|
27
|
-
option[:strategy] = strategy || :pressKey # default to pressKey
|
|
28
|
-
|
|
29
|
-
execute :hide_keyboard, {}, option
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# UiAutomation, Override included method in bridge
|
|
34
|
-
::Appium::Core::Device.add_endpoint_method(:background_app) do
|
|
35
|
-
def background_app(duration = 0)
|
|
36
|
-
execute :background_app, {}, seconds: duration
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end # module Device
|
|
41
|
-
end # module Uiautomation
|
|
42
|
-
end # module Ios
|
|
43
|
-
end # module Core
|
|
44
|
-
end # module Appium
|
|
@@ -1,34 +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 Ios
|
|
18
|
-
module Uiautomation
|
|
19
|
-
# @private
|
|
20
|
-
# class_eval inside a method because class Selenium::WebDriver::Element
|
|
21
|
-
# will trigger as soon as the file is required. in contrast a method
|
|
22
|
-
# will trigger only when invoked.
|
|
23
|
-
def self.patch_webdriver_element
|
|
24
|
-
::Selenium::WebDriver::Element.class_eval do
|
|
25
|
-
# Cross platform way of entering text into a textfield
|
|
26
|
-
def type(text, driver)
|
|
27
|
-
driver.execute_script %(au.getElement('#{ref}').setValue('#{text}');)
|
|
28
|
-
end # def type
|
|
29
|
-
end # Selenium::WebDriver::Element.class_eval
|
|
30
|
-
end # def patch_webdriver_element
|
|
31
|
-
end # module Uiautomation
|
|
32
|
-
end # module Ios
|
|
33
|
-
end # module Core
|
|
34
|
-
end # module Appium
|