appium_lib 11.2.0 → 12.0.0.rc4
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/.github/dependabot.yml +8 -0
- data/.github/workflows/rubocop.yml +1 -1
- data/.rubocop.yml +89 -1
- data/CHANGELOG.md +19 -6
- data/appium_lib.gemspec +5 -5
- data/lib/appium_lib/android/common/helper.rb +2 -2
- data/lib/appium_lib/android/element/button.rb +2 -2
- data/lib/appium_lib/android/element/generic.rb +8 -12
- data/lib/appium_lib/android/espresso/element/generic.rb +20 -24
- data/lib/appium_lib/android/uiautomator2/element/button.rb +2 -2
- data/lib/appium_lib/appium.rb +22 -26
- data/lib/appium_lib/common/wait.rb +2 -3
- data/lib/appium_lib/driver.rb +6 -37
- data/lib/appium_lib/ios/xcuitest/command/gestures.rb +9 -9
- data/lib/appium_lib/version.rb +2 -2
- data/readme.md +4 -9
- metadata +26 -21
- data/docs/index_paths.md +0 -26
- data/docs/travis.sample.yml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d7d7fcbce0bf73c13c462fa4cb83da298c19230d976ebff717684d56465e2d
|
4
|
+
data.tar.gz: fa87321a4d2bbf7647aa0683072fa20a6c40efc034dd778494e903acd06e7bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21e5285ece74a226157d0957f0dd49c9ea7207cb7c6296a8c2565c1dbae2ad771342c187c00a0bc989f33ea6c90e2370996cb5053d2257352f2a40ed9d9a7aab
|
7
|
+
data.tar.gz: 341f87e156a134a0ca6204299b9647f9d8f02ef07b5c68b16d54cd05b4b31abd7ee64f671ffdbb6a194ad060ea20eeb226ad5f590e4a69c3075e20df3c881000
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.6
|
3
3
|
Metrics/LineLength:
|
4
4
|
Max: 128
|
5
5
|
Metrics/MethodLength:
|
@@ -51,3 +51,91 @@ Style/StringConcatenation:
|
|
51
51
|
Enabled: false
|
52
52
|
Lint/NonDeterministicRequireOrder:
|
53
53
|
Enabled: false
|
54
|
+
Gemspec/DateAssignment:
|
55
|
+
Enabled: true
|
56
|
+
Layout/LineEndStringConcatenationIndentation:
|
57
|
+
Enabled: true
|
58
|
+
Layout/SpaceBeforeBrackets:
|
59
|
+
Enabled: true
|
60
|
+
Lint/AmbiguousAssignment:
|
61
|
+
Enabled: true
|
62
|
+
Lint/AmbiguousOperatorPrecedence:
|
63
|
+
Enabled: false
|
64
|
+
Lint/AmbiguousRange:
|
65
|
+
Enabled: true
|
66
|
+
Lint/DeprecatedConstants:
|
67
|
+
Enabled: true
|
68
|
+
Lint/DuplicateBranch:
|
69
|
+
Enabled: true
|
70
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
71
|
+
Enabled: true
|
72
|
+
Lint/EmptyBlock:
|
73
|
+
Enabled: true
|
74
|
+
Lint/EmptyClass:
|
75
|
+
Enabled: false
|
76
|
+
Lint/EmptyInPattern:
|
77
|
+
Enabled: true
|
78
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
79
|
+
Enabled: true
|
80
|
+
Lint/LambdaWithoutLiteralBlock:
|
81
|
+
Enabled: true
|
82
|
+
Lint/NoReturnInBeginEndBlocks:
|
83
|
+
Enabled: true
|
84
|
+
Lint/NumberedParameterAssignment:
|
85
|
+
Enabled: true
|
86
|
+
Lint/OrAssignmentToConstant:
|
87
|
+
Enabled: true
|
88
|
+
Lint/RedundantDirGlobSort:
|
89
|
+
Enabled: true
|
90
|
+
Lint/RequireRelativeSelfPath:
|
91
|
+
Enabled: true
|
92
|
+
Lint/SymbolConversion:
|
93
|
+
Enabled: true
|
94
|
+
Lint/ToEnumArguments:
|
95
|
+
Enabled: true
|
96
|
+
Lint/TripleQuotes:
|
97
|
+
Enabled: true
|
98
|
+
Lint/UnexpectedBlockArity:
|
99
|
+
Enabled: true
|
100
|
+
Lint/UnmodifiedReduceAccumulator:
|
101
|
+
Enabled: true
|
102
|
+
Security/IoMethods:
|
103
|
+
Enabled: true
|
104
|
+
Style/ArgumentsForwarding:
|
105
|
+
Enabled: true
|
106
|
+
Style/CollectionCompact:
|
107
|
+
Enabled: true
|
108
|
+
Style/DocumentDynamicEvalDefinition:
|
109
|
+
Enabled: true
|
110
|
+
Style/EndlessMethod:
|
111
|
+
Enabled: true
|
112
|
+
Style/HashConversion:
|
113
|
+
Enabled: false
|
114
|
+
Style/HashExcept:
|
115
|
+
Enabled: true
|
116
|
+
Style/IfWithBooleanLiteralBranches:
|
117
|
+
Enabled: true
|
118
|
+
Style/InPatternThen:
|
119
|
+
Enabled: true
|
120
|
+
Style/MultilineInPatternThen:
|
121
|
+
Enabled: true
|
122
|
+
Style/NegatedIfElseCondition:
|
123
|
+
Enabled: true
|
124
|
+
Style/NilLambda:
|
125
|
+
Enabled: true
|
126
|
+
Style/NumberedParameters:
|
127
|
+
Enabled: true
|
128
|
+
Style/NumberedParametersLimit:
|
129
|
+
Enabled: true
|
130
|
+
Style/QuotedSymbols:
|
131
|
+
Enabled: true
|
132
|
+
Style/RedundantArgument:
|
133
|
+
Enabled: true
|
134
|
+
Style/RedundantSelfAssignmentBranch:
|
135
|
+
Enabled: true
|
136
|
+
Style/SelectByRegexp:
|
137
|
+
Enabled: true
|
138
|
+
Style/StringChars:
|
139
|
+
Enabled: true
|
140
|
+
Style/SwapValues:
|
141
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -7,9 +7,22 @@ Release tags are https://github.com/appium/ruby_lib/releases .
|
|
7
7
|
|
8
8
|
### 1. Enhancements
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
- Update base [ruby_lib_core client](https://github.com/appium/ruby_lib_core) to v5
|
11
|
+
- Update base selenium webdriver version to `4.0.0`
|
12
|
+
- Support only W3C spec as following Selenium v4 client
|
13
|
+
- Support Ruby 2.6+
|
14
|
+
- `element.id` returns the element id instead of `element.ref`. `element.ref` now returns an array.
|
15
|
+
- Removed `forceMjsonwp` to send only MJSONWP capabilities since Selenium cleint v4 no longer supports MJSONWP
|
16
|
+
- No longer set default `timeouts` as `0`. ruby_lib_core calls `/timeouts` endpoint only when `appium_lib: { wait: 5 }` is provided explicitly
|
17
|
+
- Raises `::Appium::Core::Error::ArgumentError` instead of `ArgumentError` for this library specific argument errors
|
18
|
+
|
19
|
+
### 2. Deprecations
|
20
|
+
- `TouchAction` and `MultiTouch` are deprecated
|
21
|
+
- Please use W3C actions instead https://github.com/appium/ruby_lib/blob/master/docs/w3c.md
|
22
|
+
- Other examples: https://github.com/appium/ruby_lib/pull/909
|
23
|
+
- Removed Selendroid related methods
|
24
|
+
|
25
|
+
## 11.1.0 - 2020-12-29 (11.2.0 is the same as this version)
|
13
26
|
|
14
27
|
Support Ruby 3
|
15
28
|
|
@@ -105,7 +118,7 @@ This change has a breaking change about implicit wait.
|
|
105
118
|
- **Breaking changes**
|
106
119
|
- Set implicit wait zero by default following [WebDriver spec in Selenium](https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp)
|
107
120
|
- The change potentially break your `find_element/s`
|
108
|
-
- You can wrap it with `wait` method to avoid the error explicitly
|
121
|
+
- You can wrap it with `wait` method to avoid the error explicitly
|
109
122
|
- Or you also can configure `wait: 20` as `appium_lib` capability to keep the behaviour
|
110
123
|
- [Experimental]
|
111
124
|
- Add `direct_connect` capability
|
@@ -162,7 +175,7 @@ This change has a breaking change about implicit wait.
|
|
162
175
|
{ platformName: :windows,
|
163
176
|
app: 'relative/path/to/app'
|
164
177
|
}
|
165
|
-
} # `:app` will be alsolute path to the `:app` if the path exists
|
178
|
+
} # `:app` will be alsolute path to the `:app` if the path exists
|
166
179
|
```
|
167
180
|
|
168
181
|
### 3. Deprecations
|
@@ -312,7 +325,7 @@ This change has a breaking change about implicit wait.
|
|
312
325
|
## v9.9.0
|
313
326
|
### 1. Enhancements
|
314
327
|
- Bump the core library to 1.3.0
|
315
|
-
- The change have one breaking change for `start_recording_screen`(Android)
|
328
|
+
- The change have one breaking change for `start_recording_screen`(Android)
|
316
329
|
- Read `docs/migration.md`
|
317
330
|
|
318
331
|
### 2. Bug fixes
|
data/appium_lib.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'lib/appium_lib/version'
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.required_ruby_version = '>= 2.
|
4
|
+
s.required_ruby_version = '>= 2.6'
|
5
5
|
|
6
6
|
s.name = 'appium_lib'
|
7
7
|
s.version = Appium::VERSION
|
@@ -14,17 +14,17 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.homepage = 'https://github.com/appium/ruby_lib' # published as appium_lib
|
15
15
|
s.require_paths = ['lib']
|
16
16
|
|
17
|
-
s.add_runtime_dependency 'appium_lib_core', '
|
17
|
+
s.add_runtime_dependency 'appium_lib_core', '5.0.0.rc8'
|
18
18
|
s.add_runtime_dependency 'nokogiri', '~> 1.8', '>= 1.8.1'
|
19
|
-
s.add_runtime_dependency 'tomlrb', '
|
19
|
+
s.add_runtime_dependency 'tomlrb', '>= 1.1', '< 3.0'
|
20
20
|
|
21
21
|
s.add_development_dependency 'appium_thor', '~> 1.1', '>= 1.1.4'
|
22
|
-
s.add_development_dependency 'fakefs', '~> 1.
|
22
|
+
s.add_development_dependency 'fakefs', '~> 1.4.0'
|
23
23
|
s.add_development_dependency 'hashdiff', '~> 1.0.0'
|
24
24
|
s.add_development_dependency 'posix-spawn', '~> 0.3'
|
25
25
|
s.add_development_dependency 'pry'
|
26
26
|
s.add_development_dependency 'rake', '~> 13.0'
|
27
|
-
s.add_development_dependency 'rubocop', '1.
|
27
|
+
s.add_development_dependency 'rubocop', '1.22.3'
|
28
28
|
s.add_development_dependency 'spec', '~> 5.3', '>= 5.3.4'
|
29
29
|
s.add_development_dependency 'yard', '~> 0.9.11'
|
30
30
|
|
@@ -234,11 +234,11 @@ module Appium
|
|
234
234
|
|
235
235
|
if class_name == '*'
|
236
236
|
return "//*[contains(translate(@text,'#{value.upcase}', '#{value}'), '#{value}')" \
|
237
|
-
|
237
|
+
" or contains(translate(@content-desc,'#{value.upcase}', '#{value}'), '#{value}')" + r_id + ']'
|
238
238
|
end
|
239
239
|
|
240
240
|
"//#{class_name}[contains(translate(@text,'#{value.upcase}', '#{value}'), '#{value}')" \
|
241
|
-
|
241
|
+
" or contains(translate(@content-desc,'#{value.upcase}', '#{value}'), '#{value}')" + r_id + ']'
|
242
242
|
end
|
243
243
|
|
244
244
|
# Returns a string that matches the first element that contains value
|
@@ -98,10 +98,10 @@ module Appium
|
|
98
98
|
|
99
99
|
if button_index && image_button_index
|
100
100
|
"new UiSelector().className(#{BUTTON}).instance(#{button_index});" \
|
101
|
-
|
101
|
+
"new UiSelector().className(#{IMAGE_BUTTON}).instance(#{image_button_index});"
|
102
102
|
else
|
103
103
|
"new UiSelector().className(#{BUTTON});" \
|
104
|
-
|
104
|
+
"new UiSelector().className(#{IMAGE_BUTTON});"
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -56,12 +56,10 @@ module Appium
|
|
56
56
|
rid = resource_id(text, "new UiSelector().resourceId(#{text})")
|
57
57
|
args = rid.empty? ? ["new UiSelector().textContains(#{text})", "new UiSelector().descriptionContains(#{text})"] : [rid]
|
58
58
|
args.each_with_index do |arg, index|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
raise e if index == args.size - 1
|
64
|
-
end
|
59
|
+
elem = find_element :uiautomator, scroll_uiselector(arg, scrollable_index)
|
60
|
+
return elem
|
61
|
+
rescue StandardError => e
|
62
|
+
raise e if index == args.size - 1
|
65
63
|
end
|
66
64
|
end
|
67
65
|
|
@@ -74,12 +72,10 @@ module Appium
|
|
74
72
|
rid = resource_id(text, "new UiSelector().resourceId(#{text})")
|
75
73
|
args = rid.empty? ? ["new UiSelector().text(#{text})", "new UiSelector().description(#{text})"] : [rid]
|
76
74
|
args.each_with_index do |arg, index|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
raise e if index == args.size - 1
|
82
|
-
end
|
75
|
+
elem = find_element :uiautomator, scroll_uiselector(arg, scrollable_index)
|
76
|
+
return elem
|
77
|
+
rescue StandardError => e
|
78
|
+
raise e if index == args.size - 1
|
83
79
|
end
|
84
80
|
end
|
85
81
|
end # module Android
|
@@ -25,19 +25,17 @@ module Appium
|
|
25
25
|
w_s = window_rect
|
26
26
|
|
27
27
|
(1..30).each do |_count|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
sleep 1 # we must wait finish scrolling
|
28
|
+
action
|
29
|
+
.move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number
|
30
|
+
.pointer_down(:left)
|
31
|
+
.move_to_location(0, w_s.height / 5)
|
32
|
+
.release
|
33
|
+
.perform
|
34
|
+
sleep 1 # we must wait finish scrolling
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
36
|
+
return text(text)
|
37
|
+
rescue StandardError => e
|
38
|
+
err = e
|
41
39
|
end
|
42
40
|
|
43
41
|
raise err
|
@@ -52,19 +50,17 @@ module Appium
|
|
52
50
|
w_s = window_rect
|
53
51
|
|
54
52
|
(1..30).each do |_count|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
sleep 1 # we must wait finish scrolling
|
53
|
+
action
|
54
|
+
.move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number
|
55
|
+
.pointer_down(:left)
|
56
|
+
.move_to_location(0, w_s.height / 5)
|
57
|
+
.release
|
58
|
+
.perform
|
59
|
+
sleep 1 # we must wait finish scrolling
|
63
60
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
61
|
+
return text_exact(text)
|
62
|
+
rescue StandardError => e
|
63
|
+
err = e
|
68
64
|
end
|
69
65
|
|
70
66
|
raise err
|
@@ -101,10 +101,10 @@ module Appium
|
|
101
101
|
|
102
102
|
if button_index && image_button_index
|
103
103
|
"new UiSelector().className(#{::Appium::Android::Button}).instance(#{button_index});" \
|
104
|
-
|
104
|
+
"new UiSelector().className(#{::Appium::Android::ImageButton}).instance(#{image_button_index});"
|
105
105
|
else
|
106
106
|
"new UiSelector().className(#{::Appium::Android::Button});" \
|
107
|
-
|
107
|
+
"new UiSelector().className(#{::Appium::Android::ImageButton});"
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
data/lib/appium_lib/appium.rb
CHANGED
@@ -156,18 +156,16 @@ module Appium
|
|
156
156
|
|
157
157
|
target_modules.each do |const|
|
158
158
|
# noinspection RubyResolve
|
159
|
-
# rubocop:disable Style/MultilineIfModifier
|
160
159
|
driver.public_methods(false).each do |m|
|
160
|
+
# override unless there's an existing method with matching arity
|
161
|
+
next if const.respond_to?(m) && const.method(m).arity == driver.method(m).arity
|
162
|
+
|
161
163
|
const.send(:define_singleton_method, m) do |*args, &block|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
end
|
167
|
-
# override unless there's an existing method with matching arity
|
168
|
-
end unless const.respond_to?(m) && const.method(m).arity == driver.method(m).arity
|
164
|
+
super(*args, &block) # promote.rb
|
165
|
+
rescue NoMethodError, ArgumentError
|
166
|
+
driver.send m, *args, &block if driver.respond_to?(m)
|
167
|
+
end
|
169
168
|
end
|
170
|
-
# rubocop:enable Style/MultilineIfModifier
|
171
169
|
end
|
172
170
|
end
|
173
171
|
|
@@ -210,23 +208,21 @@ module Appium
|
|
210
208
|
end
|
211
209
|
|
212
210
|
define_method method do |*args, &block|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
driver.send method, *args, &block if driver.respond_to?(method)
|
229
|
-
end
|
211
|
+
# Prefer existing method.
|
212
|
+
# super will invoke method missing on driver
|
213
|
+
super(*args, &block)
|
214
|
+
|
215
|
+
# minitest also defines a name method,
|
216
|
+
# so rescue argument error
|
217
|
+
# and call the name method on $driver
|
218
|
+
rescue NoMethodError, ArgumentError
|
219
|
+
if args.size == 1 && args.first.is_a?(Hash)
|
220
|
+
# To prevent warnings by keyword arguments (for Ruby 2.7 and 3)
|
221
|
+
driver.send method, **args.first, &block if driver.respond_to?(method)
|
222
|
+
else
|
223
|
+
::Appium::Logger.warn "Should fix this '#{args}' for Ruby 2.7 (and 3)" if args.first.is_a?(Hash)
|
224
|
+
|
225
|
+
driver.send method, *args, &block if driver.respond_to?(method)
|
230
226
|
end
|
231
227
|
end
|
232
228
|
end
|
@@ -42,7 +42,7 @@ module Appium
|
|
42
42
|
# wait_true(20) { button_exact('Back') }.click
|
43
43
|
#
|
44
44
|
def wait_true(opts = {})
|
45
|
-
opts =
|
45
|
+
opts = { timeout: opts } if opts.is_a? Numeric
|
46
46
|
|
47
47
|
if opts.is_a? Hash
|
48
48
|
opts.empty? ? @core.wait_true { yield } : @core.wait_true(**opts) { yield }
|
@@ -71,8 +71,7 @@ module Appium
|
|
71
71
|
# wait(20) { button_exact('Back') }.click
|
72
72
|
#
|
73
73
|
def wait(opts = {})
|
74
|
-
opts =
|
75
|
-
|
74
|
+
opts = { timeout: opts } if opts.is_a? Numeric
|
76
75
|
if opts.is_a? Hash
|
77
76
|
opts.empty? ? @core.wait { yield } : @core.wait(**opts) { yield }
|
78
77
|
else
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -151,18 +151,10 @@ module Appium
|
|
151
151
|
# @param opts [Object] A hash containing various options.
|
152
152
|
# @param global_driver [Bool] A bool require global driver before initialize.
|
153
153
|
# @return [Driver]
|
154
|
-
def initialize(opts = {}, global_driver =
|
155
|
-
# TODO: set `global_driver = false` by default in the future.
|
154
|
+
def initialize(opts = {}, global_driver = false)
|
156
155
|
# Capybara can't put `global_driver` as the 2nd argument.
|
157
156
|
global_driver = opts.delete :global_driver if global_driver.nil?
|
158
157
|
|
159
|
-
if global_driver.nil?
|
160
|
-
warn '[DEPRECATION] Appium::Driver.new(opts) will not generate global driver by default.' \
|
161
|
-
'If you would like to generate the global driver dy default, ' \
|
162
|
-
'please initialise driver with Appium::Driver.new(opts, true)'
|
163
|
-
global_driver = true # if global_driver is nil, then global_driver must be default value.
|
164
|
-
end
|
165
|
-
|
166
158
|
$driver&.driver_quit if global_driver
|
167
159
|
|
168
160
|
raise 'opts must be a hash' unless opts.is_a? Hash
|
@@ -325,27 +317,7 @@ module Appium
|
|
325
317
|
!@core.automation_name.nil? && @core.automation_name == :xcuitest
|
326
318
|
end
|
327
319
|
|
328
|
-
#
|
329
|
-
#
|
330
|
-
# @return [:oss | :w3c]
|
331
|
-
#
|
332
|
-
# @example
|
333
|
-
#
|
334
|
-
# if dialect == :w3c
|
335
|
-
# driver.action
|
336
|
-
# .move_to_location(500, 500).pointer_down(:left)
|
337
|
-
# .move_to_location(0, 700)
|
338
|
-
# .release.perform
|
339
|
-
# else
|
340
|
-
# action = TouchAction.new(driver).press(x: 500, y: 500).move_to(500, 700).release
|
341
|
-
# action.perform
|
342
|
-
# end
|
343
|
-
#
|
344
|
-
def dialect
|
345
|
-
@driver.dialect
|
346
|
-
end
|
347
|
-
|
348
|
-
# An entry point to chain W3C actions. Returns `TouchAction.new` if it works as MJSONWP instead of W3C action.
|
320
|
+
# An entry point to chain W3C actions
|
349
321
|
# Read https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Base/Bridge/W3C#action-instance_method
|
350
322
|
#
|
351
323
|
# @return [TouchAction|Selenium::WebDriver::PointerActions]
|
@@ -356,12 +328,7 @@ module Appium
|
|
356
328
|
# action.click(element).perform # The `click` is a part of `PointerActions`
|
357
329
|
#
|
358
330
|
def action
|
359
|
-
|
360
|
-
::Appium::Logger.info('Calls TouchAction instead of W3C actions for MJSONWP module')
|
361
|
-
TouchAction.new($driver || @driver)
|
362
|
-
else
|
363
|
-
@driver.action
|
364
|
-
end
|
331
|
+
@driver.action
|
365
332
|
end
|
366
333
|
|
367
334
|
# Returns the server's version info
|
@@ -815,7 +782,9 @@ module Appium
|
|
815
782
|
end
|
816
783
|
|
817
784
|
def log_event=(log_event)
|
818
|
-
|
785
|
+
unless log_event.is_a?(Hash)
|
786
|
+
raise ::Appium::Core::Error::ArgumentError('log_event should be Hash like { vendor: "appium", event: "funEvent"}')
|
787
|
+
end
|
819
788
|
|
820
789
|
@driver.logs.event vendor: log_event[:vendor], event: log_event[:event]
|
821
790
|
end
|
@@ -24,7 +24,7 @@ module Appium
|
|
24
24
|
# ```
|
25
25
|
def swipe(direction:, element: nil)
|
26
26
|
args = { direction: direction }
|
27
|
-
args[:element] = element.
|
27
|
+
args[:element] = element.id if element
|
28
28
|
|
29
29
|
@driver.execute_script 'mobile: swipe', args
|
30
30
|
end
|
@@ -47,7 +47,7 @@ module Appium
|
|
47
47
|
return 'Set "up", "down", "left" or "right" for :direction' unless %w(up down left right).include?(direction)
|
48
48
|
|
49
49
|
args = { direction: direction }
|
50
|
-
args[:element] = element.
|
50
|
+
args[:element] = element.id if element
|
51
51
|
args[:distance] = distance if distance
|
52
52
|
args[:name] = name if name
|
53
53
|
args[:toVisible] = to_visible if to_visible
|
@@ -66,7 +66,7 @@ module Appium
|
|
66
66
|
# ```
|
67
67
|
def pinch(scale:, velocity: 1.0, element: nil)
|
68
68
|
args = { scale: scale, velocity: velocity }
|
69
|
-
args[:element] = element.
|
69
|
+
args[:element] = element.id if element
|
70
70
|
|
71
71
|
@driver.execute_script 'mobile: pinch', args
|
72
72
|
end
|
@@ -82,7 +82,7 @@ module Appium
|
|
82
82
|
def double_tap(x: nil, y: nil, element: nil)
|
83
83
|
return 'Set x, y or element' if (x.nil? || y.nil?) && element.nil?
|
84
84
|
|
85
|
-
args = element.nil? ? { x: x, y: y } : { element: element.
|
85
|
+
args = element.nil? ? { x: x, y: y } : { element: element.id }
|
86
86
|
@driver.execute_script 'mobile: doubleTap', args
|
87
87
|
end
|
88
88
|
|
@@ -99,7 +99,7 @@ module Appium
|
|
99
99
|
def touch_and_hold(x: nil, y: nil, element: nil, duration: 1.0)
|
100
100
|
return 'Set x, y or element' if (x.nil? || y.nil?) && element.nil?
|
101
101
|
|
102
|
-
args = element.nil? ? { x: x, y: y } : { element: element.
|
102
|
+
args = element.nil? ? { x: x, y: y } : { element: element.id }
|
103
103
|
args[:duration] = duration
|
104
104
|
@driver.execute_script 'mobile: touchAndHold', args
|
105
105
|
end
|
@@ -110,7 +110,7 @@ module Appium
|
|
110
110
|
# two_finger_tap element: find_element(:accessibility_id, "some item")
|
111
111
|
# ```
|
112
112
|
def two_finger_tap(element:)
|
113
|
-
args = { element: element.
|
113
|
+
args = { element: element.id }
|
114
114
|
@driver.execute_script 'mobile: twoFingerTap', args
|
115
115
|
end
|
116
116
|
|
@@ -126,7 +126,7 @@ module Appium
|
|
126
126
|
# ```
|
127
127
|
def one_finger_tap(x:, y:, element: nil)
|
128
128
|
args = { x: x, y: y }
|
129
|
-
args[:element] = element.
|
129
|
+
args[:element] = element.id if element
|
130
130
|
@driver.execute_script 'mobile: tap', args
|
131
131
|
end
|
132
132
|
|
@@ -146,7 +146,7 @@ module Appium
|
|
146
146
|
# ```
|
147
147
|
def drag_from_to_for_duration(from_x:, from_y:, to_x:, to_y:, duration: 1.0, element: nil)
|
148
148
|
args = { fromX: from_x, fromY: from_y, toX: to_x, toY: to_y, duration: duration }
|
149
|
-
args[:element] = element.
|
149
|
+
args[:element] = element.id if element
|
150
150
|
@driver.execute_script 'mobile: dragFromToForDuration', args
|
151
151
|
end
|
152
152
|
# rubocop:enable Metrics/ParameterLists
|
@@ -164,7 +164,7 @@ module Appium
|
|
164
164
|
def select_picker_wheel(element:, order:, offset: nil)
|
165
165
|
return 'Set "next" or "previous" for :order' unless %w(next previous).include?(order)
|
166
166
|
|
167
|
-
args = { element: element.
|
167
|
+
args = { element: element.id, order: order }
|
168
168
|
args[:offset] = offset if offset
|
169
169
|
@driver.execute_script 'mobile: selectPickerWheelValue', args
|
170
170
|
end
|
data/lib/appium_lib/version.rb
CHANGED
@@ -14,6 +14,6 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
|
17
|
-
VERSION = '
|
18
|
-
DATE = '2021-01
|
17
|
+
VERSION = '12.0.0.rc4' unless defined? ::Appium::VERSION
|
18
|
+
DATE = '2021-11-01' unless defined? ::Appium::DATE
|
19
19
|
end
|
data/readme.md
CHANGED
@@ -21,9 +21,11 @@ We can avoid the class driver with current `ruby_lib`, but if you'd like to impl
|
|
21
21
|
# Setup
|
22
22
|
## Requirement
|
23
23
|
- [Appium](https://github.com/appium/appium#requirements)
|
24
|
-
- Ruby: 2.
|
24
|
+
- Ruby: 2.6+
|
25
25
|
|
26
26
|
### Ruby Lib and Appium
|
27
|
+
|
28
|
+
- Ruby library version over `12.0.0` is based on Selenium v4
|
27
29
|
- Ruby library version over `9.8.0` requires Appium over `1.8`
|
28
30
|
- Ruby library version under `9.7.5` can work with Appium under `1.7`
|
29
31
|
|
@@ -35,16 +37,9 @@ $ appium
|
|
35
37
|
```
|
36
38
|
|
37
39
|
## Install / Upgrade
|
38
|
-
- Update rubygems and bundler
|
39
|
-
```bash
|
40
|
-
$ gem update --system
|
41
|
-
$ gem update bundler
|
42
|
-
```
|
43
40
|
|
44
|
-
- Install the latest gem release
|
45
41
|
```bash
|
46
|
-
gem
|
47
|
-
gem install --no-rdoc --no-ri appium_lib
|
42
|
+
gem install appium_lib
|
48
43
|
```
|
49
44
|
|
50
45
|
## [Sauce Labs env vars](https://github.com/appium/ruby_lib/blob/master/lib/appium_lib/sauce_labs.rb)
|
metadata
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
- Kazuaki Matsuo
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-01
|
12
|
+
date: 2021-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appium_lib_core
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 5.0.0.rc8
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 5.0.0.rc8
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: nokogiri
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,16 +49,22 @@ dependencies:
|
|
49
49
|
name: tomlrb
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.1'
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3.0'
|
55
58
|
type: :runtime
|
56
59
|
prerelease: false
|
57
60
|
version_requirements: !ruby/object:Gem::Requirement
|
58
61
|
requirements:
|
59
|
-
- - "
|
62
|
+
- - ">="
|
60
63
|
- !ruby/object:Gem::Version
|
61
64
|
version: '1.1'
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.0'
|
62
68
|
- !ruby/object:Gem::Dependency
|
63
69
|
name: appium_thor
|
64
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,14 +91,14 @@ dependencies:
|
|
85
91
|
requirements:
|
86
92
|
- - "~>"
|
87
93
|
- !ruby/object:Gem::Version
|
88
|
-
version: 1.
|
94
|
+
version: 1.4.0
|
89
95
|
type: :development
|
90
96
|
prerelease: false
|
91
97
|
version_requirements: !ruby/object:Gem::Requirement
|
92
98
|
requirements:
|
93
99
|
- - "~>"
|
94
100
|
- !ruby/object:Gem::Version
|
95
|
-
version: 1.
|
101
|
+
version: 1.4.0
|
96
102
|
- !ruby/object:Gem::Dependency
|
97
103
|
name: hashdiff
|
98
104
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,14 +161,14 @@ dependencies:
|
|
155
161
|
requirements:
|
156
162
|
- - '='
|
157
163
|
- !ruby/object:Gem::Version
|
158
|
-
version: 1.
|
164
|
+
version: 1.22.3
|
159
165
|
type: :development
|
160
166
|
prerelease: false
|
161
167
|
version_requirements: !ruby/object:Gem::Requirement
|
162
168
|
requirements:
|
163
169
|
- - '='
|
164
170
|
- !ruby/object:Gem::Version
|
165
|
-
version: 1.
|
171
|
+
version: 1.22.3
|
166
172
|
- !ruby/object:Gem::Dependency
|
167
173
|
name: spec
|
168
174
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,6 +214,7 @@ files:
|
|
208
214
|
- ".azure-pipelines.yml"
|
209
215
|
- ".github/ISSUE_TEMPLATE.md"
|
210
216
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
217
|
+
- ".github/dependabot.yml"
|
211
218
|
- ".github/workflows/rubocop.yml"
|
212
219
|
- ".gitignore"
|
213
220
|
- ".rubocop.yml"
|
@@ -221,12 +228,10 @@ files:
|
|
221
228
|
- docs/android_docs.md
|
222
229
|
- docs/android_uiautomator.md
|
223
230
|
- docs/docs.md
|
224
|
-
- docs/index_paths.md
|
225
231
|
- docs/ios_docs.md
|
226
232
|
- docs/ios_xcuitest.md
|
227
233
|
- docs/migration.md
|
228
234
|
- docs/parallel.md
|
229
|
-
- docs/travis.sample.yml
|
230
235
|
- docs/w3c.md
|
231
236
|
- lib/appium_lib.rb
|
232
237
|
- lib/appium_lib/android/android.rb
|
@@ -290,7 +295,7 @@ homepage: https://github.com/appium/ruby_lib
|
|
290
295
|
licenses:
|
291
296
|
- Apache-2.0
|
292
297
|
metadata: {}
|
293
|
-
post_install_message:
|
298
|
+
post_install_message:
|
294
299
|
rdoc_options: []
|
295
300
|
require_paths:
|
296
301
|
- lib
|
@@ -298,15 +303,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
298
303
|
requirements:
|
299
304
|
- - ">="
|
300
305
|
- !ruby/object:Gem::Version
|
301
|
-
version: '2.
|
306
|
+
version: '2.6'
|
302
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
303
308
|
requirements:
|
304
|
-
- - "
|
309
|
+
- - ">"
|
305
310
|
- !ruby/object:Gem::Version
|
306
|
-
version:
|
311
|
+
version: 1.3.1
|
307
312
|
requirements: []
|
308
|
-
rubygems_version: 3.
|
309
|
-
signing_key:
|
313
|
+
rubygems_version: 3.2.15
|
314
|
+
signing_key:
|
310
315
|
specification_version: 4
|
311
316
|
summary: Ruby library for Appium
|
312
317
|
test_files: []
|
data/docs/index_paths.md
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
**Deprecated** Because iOS driver for UIAutomation is deprecated.
|
2
|
-
|
3
|
-
# Index Paths on iOS
|
4
|
-
|
5
|
-
Elements on iOS have an [index path attribute](https://github.com/appium/appium-uiauto/blob/2cf1e30801263dfc01627ded28a1be5af1083bc5/uiauto/lib/element-patch/tree-patch.js#L9)
|
6
|
-
that appium calculates when the page source is requested. Note this is not the same as xpath.
|
7
|
-
|
8
|
-
> <UIAStaticText name="Alerts" label="Alerts" value="Alerts" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/1/10/0" x="17.578125" y="596" width="53.90625" height="25.78125">
|
9
|
-
|
10
|
-
The index path can be used by calling [getElementByIndexPath]( https://github.com/appium/appium-uiauto/blob/af1befa8208074686cd38b845ddefabc057106fc/uiauto/lib/mechanic-ext/xpath-ext.js#L239):
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
# ruby example # For Appium(automation name), not XCUITest
|
14
|
-
execute_script('$.getElementByIndexPath("/0/1/1/10/0")').text # Alerts
|
15
|
-
```
|
16
|
-
|
17
|
-
Internally what happens is `/0/1/1/10/0` is transformed into `1/1/10/0` and executed as follows:
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
# ruby example # For Appium(automation name), not XCUITest
|
21
|
-
execute_script('$.mainApp().elements()[1].elements()[1].elements()[10].elements()[0]').text # Alerts
|
22
|
-
```
|
23
|
-
|
24
|
-
The initial 0 refers to the context so that's [discarded](https://github.com/appium/appium-uiauto/blob/af1befa8208074686cd38b845ddefabc057106fc/uiauto/lib/mechanic-ext/xpath-ext.js#L218).
|
25
|
-
|
26
|
-
In summary, you shouldn't try and convert the index path to an xpath. It's meant to be used via the built in helper method.
|
data/docs/travis.sample.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
language: objective-c
|
2
|
-
sudo: false
|
3
|
-
osx_image: xcode8.3
|
4
|
-
|
5
|
-
cache: bundler
|
6
|
-
|
7
|
-
rvm:
|
8
|
-
- 2.4
|
9
|
-
|
10
|
-
install:
|
11
|
-
- bundle install
|
12
|
-
- npm install -g appium@1.6.4
|
13
|
-
|
14
|
-
before_script:
|
15
|
-
- appium --log-level warn &
|
16
|
-
|
17
|
-
script:
|
18
|
-
- bundle exec rake rubocop
|
19
|
-
- cd ios_tests; rake ios
|
20
|
-
|
21
|
-
notifications:
|
22
|
-
email:
|
23
|
-
on_success: never
|
24
|
-
on_failure: never
|