testa_appium_driver 0.1.15 → 0.1.16
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/.rubocop.yml +5 -13
- data/Gemfile.lock +8 -6
- data/appium-driver.iml +74 -0
- data/lib/testa_appium_driver/common/locator.rb +39 -72
- data/lib/testa_appium_driver/version.rb +1 -1
- data/testa_appium_driver.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04d14488eadbd006c7a0a2fe092d659f36f0243f0817603af99ee6340d0e1bd4
|
4
|
+
data.tar.gz: 3e088e3621679a7067b8af46f5b2da9fc9220fcea84265b7c3785ea8df161c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d864abaa064f5ade1f6788126e6907242a9f0797d5474dc8cf602258c1c08b4c7c14f3c41eabfe5ceabdcf995cb7341f543d394e8ea2dc9a5efcd6b2cc4914
|
7
|
+
data.tar.gz: 8dd2ca357b5bbd87ecc1b95f8ab1e53d0388f8a8fbcefd60b5e972521934b224e16d1d4ac251bed41fb2de348638fd541a69ece948663e5faf70f418126589e2
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
EnforcedStyle: double_quotes
|
7
|
-
|
8
|
-
Style/StringLiteralsInInterpolation:
|
9
|
-
Enabled: true
|
10
|
-
EnforcedStyle: double_quotes
|
11
|
-
|
12
|
-
Layout/LineLength:
|
13
|
-
Max: 120
|
1
|
+
# we have to have per project rubcop files (IDE limitation),
|
2
|
+
# but we want only one config across all projects
|
3
|
+
# you can override any global cops here, in this file
|
4
|
+
inherit_from:
|
5
|
+
- ../.rubocop.yml
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
testa_appium_driver (0.1.
|
5
|
-
appium_lib_core (~> 5.
|
4
|
+
testa_appium_driver (0.1.15)
|
5
|
+
appium_lib_core (~> 5.2.0)
|
6
6
|
json (~> 2.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
appium_lib_core (5.
|
11
|
+
appium_lib_core (5.2.2)
|
12
12
|
faye-websocket (~> 0.11.0)
|
13
|
-
selenium-webdriver (~> 4.
|
13
|
+
selenium-webdriver (~> 4.2, < 4.4)
|
14
14
|
ast (2.4.2)
|
15
15
|
childprocess (4.1.0)
|
16
16
|
diff-lcs (1.5.0)
|
@@ -52,11 +52,13 @@ GEM
|
|
52
52
|
parser (>= 3.1.1.0)
|
53
53
|
ruby-progressbar (1.11.0)
|
54
54
|
rubyzip (2.3.2)
|
55
|
-
selenium-webdriver (4.
|
55
|
+
selenium-webdriver (4.3.0)
|
56
56
|
childprocess (>= 0.5, < 5.0)
|
57
57
|
rexml (~> 3.2, >= 3.2.5)
|
58
|
-
rubyzip (>= 1.2.2)
|
58
|
+
rubyzip (>= 1.2.2, < 3.0)
|
59
|
+
websocket (~> 1.0)
|
59
60
|
unicode-display_width (2.1.0)
|
61
|
+
websocket (1.2.9)
|
60
62
|
websocket-driver (0.7.5)
|
61
63
|
websocket-extensions (>= 0.1.0)
|
62
64
|
websocket-extensions (0.1.5)
|
data/appium-driver.iml
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$">
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
|
7
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
8
|
+
</content>
|
9
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.6" jdkType="RUBY_SDK" />
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="appium_lib_core (v5.2.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.14, RVM: ruby-2.7.6) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="childprocess (v4.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="eventmachine (v1.2.7, RVM: ruby-2.7.6) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="faye-websocket (v0.11.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.6) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.4.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.26.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.18.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v4.3.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket (v1.2.9, RVM: ruby-2.7.6) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
39
|
+
</component>
|
40
|
+
<component name="RakeTasksCache">
|
41
|
+
<option name="myRootTask">
|
42
|
+
<RakeTaskImpl id="rake">
|
43
|
+
<subtasks>
|
44
|
+
<RakeTaskImpl description="Build testa_appium_driver-0.1.131.gem into the pkg directory" fullCommand="build" id="build" />
|
45
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
46
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
47
|
+
<RakeTaskImpl description="Build and install testa_appium_driver-0.1.131.gem into system gems" fullCommand="install" id="install" />
|
48
|
+
<RakeTaskImpl id="install">
|
49
|
+
<subtasks>
|
50
|
+
<RakeTaskImpl description="Build and install testa_appium_driver-0.1.131.gem into system gems without network access" fullCommand="install:local" id="local" />
|
51
|
+
</subtasks>
|
52
|
+
</RakeTaskImpl>
|
53
|
+
<RakeTaskImpl description="Create tag v0.1.131 and build and push testa_appium_driver-0.1.131.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
54
|
+
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
55
|
+
<RakeTaskImpl id="rubocop">
|
56
|
+
<subtasks>
|
57
|
+
<RakeTaskImpl description="Auto-correct RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
|
58
|
+
</subtasks>
|
59
|
+
</RakeTaskImpl>
|
60
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
61
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
62
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
63
|
+
<RakeTaskImpl id="release">
|
64
|
+
<subtasks>
|
65
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
66
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
67
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
68
|
+
</subtasks>
|
69
|
+
</RakeTaskImpl>
|
70
|
+
</subtasks>
|
71
|
+
</RakeTaskImpl>
|
72
|
+
</option>
|
73
|
+
</component>
|
74
|
+
</module>
|
@@ -1,12 +1,10 @@
|
|
1
1
|
require_relative 'locator/scroll_actions'
|
2
2
|
|
3
|
-
|
4
3
|
module ::TestaAppiumDriver
|
5
4
|
#noinspection RubyTooManyInstanceVariablesInspection,RubyTooManyMethodsInspection
|
6
5
|
class Locator
|
7
6
|
include Helpers
|
8
7
|
|
9
|
-
|
10
8
|
attr_accessor :xpath_selector
|
11
9
|
attr_accessor :single
|
12
10
|
|
@@ -30,7 +28,6 @@ module ::TestaAppiumDriver
|
|
30
28
|
|
31
29
|
attr_accessor :index_for_multiple
|
32
30
|
|
33
|
-
|
34
31
|
# locator parameters are:
|
35
32
|
# single: true or false
|
36
33
|
# scrollable_locator: [TestaAppiumDriver::Locator, nil] for scrolling if needed later
|
@@ -67,12 +64,10 @@ module ::TestaAppiumDriver
|
|
67
64
|
@xpath_selector = hash_to_xpath(@driver.device, selectors, single)
|
68
65
|
end
|
69
66
|
|
70
|
-
|
71
67
|
@from_element = from_element
|
72
68
|
@default_find_strategy = params[:default_find_strategy]
|
73
69
|
@default_scroll_strategy = params[:default_scroll_strategy]
|
74
70
|
|
75
|
-
|
76
71
|
@can_use_id_strategy = is_only_id_selector?(selectors)
|
77
72
|
if @can_use_id_strategy
|
78
73
|
if @driver.device == :android
|
@@ -82,7 +77,6 @@ module ::TestaAppiumDriver
|
|
82
77
|
end
|
83
78
|
end
|
84
79
|
|
85
|
-
|
86
80
|
@strategy = params[:strategy]
|
87
81
|
@strategy_reason = params[:strategy_reason]
|
88
82
|
|
@@ -91,9 +85,6 @@ module ::TestaAppiumDriver
|
|
91
85
|
init(params, selectors, single)
|
92
86
|
end
|
93
87
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
88
|
def is_only_id_selector?(selectors)
|
98
89
|
# since, name and id is the same thing for iOS,
|
99
90
|
if @driver.device == :android
|
@@ -104,7 +95,6 @@ module ::TestaAppiumDriver
|
|
104
95
|
end
|
105
96
|
end
|
106
97
|
|
107
|
-
|
108
98
|
# method missing is used to fetch the element before executing additional commands like click, send_key, count
|
109
99
|
def method_missing(method, *args, &block)
|
110
100
|
r = execute.send(method, *args, &block)
|
@@ -112,7 +102,6 @@ module ::TestaAppiumDriver
|
|
112
102
|
r
|
113
103
|
end
|
114
104
|
|
115
|
-
|
116
105
|
# @param [Boolean] skip_cache if true it will skip cache check and store
|
117
106
|
# @param [Selenium::WebDriver::Element] force_cache_element, for internal use where we have already the element, and want to execute custom locator methods on it
|
118
107
|
# @return [Selenium::WebDriver::Element, Array]
|
@@ -129,11 +118,6 @@ module ::TestaAppiumDriver
|
|
129
118
|
return @from_element
|
130
119
|
end
|
131
120
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
121
|
r = @driver.execute(@from_element, @single, strategies_and_selectors, skip_cache: skip_cache, ignore_implicit_wait: ignore_implicit_wait)
|
138
122
|
r = r[@index_for_multiple] if !@index_for_multiple.nil? && !@single
|
139
123
|
r
|
@@ -150,30 +134,28 @@ module ::TestaAppiumDriver
|
|
150
134
|
if found
|
151
135
|
if block_given? # block is given
|
152
136
|
block.call(self) # use call to execute the block
|
153
|
-
else
|
137
|
+
else
|
138
|
+
# the value of block_argument becomes nil if you didn't give a block
|
154
139
|
# block was not given
|
155
140
|
end
|
156
141
|
end
|
157
142
|
self
|
158
143
|
end
|
159
144
|
|
160
|
-
|
161
145
|
# @param [Integer] timeout in seconds
|
162
146
|
# @return [TestaAppiumDriver::Locator]
|
163
147
|
def wait_until_exists(timeout = nil)
|
164
|
-
args = {timeout: timeout}
|
148
|
+
args = { timeout: timeout }
|
165
149
|
_wait(:until, args)
|
166
150
|
end
|
167
151
|
|
168
|
-
|
169
152
|
# @param [Integer] timeout in seconds
|
170
153
|
# @return [TestaAppiumDriver::Locator]
|
171
154
|
def wait_while_exists(timeout = nil)
|
172
|
-
args = {timeout: timeout}
|
155
|
+
args = { timeout: timeout }
|
173
156
|
_wait(:while, args)
|
174
157
|
end
|
175
158
|
|
176
|
-
|
177
159
|
def wait_while(timeout = nil, args = {})
|
178
160
|
args[:timeout] = timeout
|
179
161
|
_wait(:while, args)
|
@@ -236,7 +218,7 @@ module ::TestaAppiumDriver
|
|
236
218
|
else
|
237
219
|
from_element = self.dup
|
238
220
|
from_element.index_for_multiple = instance
|
239
|
-
params = {}.merge({single: true, scrollable_locator: @scrollable_locator})
|
221
|
+
params = {}.merge({ single: true, scrollable_locator: @scrollable_locator })
|
240
222
|
#params[:strategy] = FIND_STRATEGY_XPATH
|
241
223
|
#params[:strategy_reason] = "retrieved instance of a array"
|
242
224
|
params[:default_find_strategy] = @default_find_strategy
|
@@ -245,33 +227,32 @@ module ::TestaAppiumDriver
|
|
245
227
|
end
|
246
228
|
end
|
247
229
|
|
248
|
-
|
249
230
|
# @param [TestaAppiumDriver::Locator, Selenium::WebDriver::Element, Array] other
|
250
231
|
#noinspection RubyNilAnalysis,RubyUnnecessaryReturnStatement
|
251
232
|
def ==(other)
|
252
233
|
elements = execute
|
253
|
-
other = other.execute if other.
|
234
|
+
other = other.execute if other.is_a?(TestaAppiumDriver::Locator)
|
254
235
|
|
255
|
-
if elements.
|
256
|
-
return false unless other.
|
236
|
+
if elements.is_a?(Array)
|
237
|
+
return false unless other.is_a?(Array)
|
257
238
|
return false if other.count != elements.count
|
258
239
|
return (elements - other).empty?
|
259
240
|
else
|
260
|
-
return false if other.
|
241
|
+
return false if other.is_a?(Array)
|
261
242
|
return elements == other
|
262
243
|
end
|
263
244
|
end
|
264
245
|
|
265
246
|
def as_json
|
266
247
|
{
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
248
|
+
strategy: @strategy,
|
249
|
+
default_strategy: @default_find_strategy,
|
250
|
+
single: @single,
|
251
|
+
uiautomator: defined?(self.ui_selector) ? ui_selector : nil,
|
252
|
+
xpath: @xpath_selector,
|
253
|
+
scroll_orientation: @scroll_orientation,
|
254
|
+
resolved: strategies_and_selectors,
|
255
|
+
index_for_multiple: @index_for_multiple
|
275
256
|
}
|
276
257
|
end
|
277
258
|
|
@@ -283,7 +264,6 @@ module ::TestaAppiumDriver
|
|
283
264
|
[self.to_s]
|
284
265
|
end
|
285
266
|
|
286
|
-
|
287
267
|
# @return [TestaAppiumDriver::Locator]
|
288
268
|
def as_scrollable(orientation: :vertical, top: nil, bottom: nil, right: nil, left: nil)
|
289
269
|
@scroll_orientation = orientation
|
@@ -298,7 +278,6 @@ module ::TestaAppiumDriver
|
|
298
278
|
self
|
299
279
|
end
|
300
280
|
|
301
|
-
|
302
281
|
def first_and_last_leaf
|
303
282
|
@driver.first_and_last_leaf(execute)
|
304
283
|
end
|
@@ -308,41 +287,39 @@ module ::TestaAppiumDriver
|
|
308
287
|
end
|
309
288
|
|
310
289
|
def double_click(x = nil, y = nil)
|
311
|
-
click(x,y, double: true)
|
290
|
+
click(x, y, double: true)
|
312
291
|
end
|
313
292
|
|
314
|
-
|
315
|
-
|
316
293
|
# if both x or y, or both are not given, will click in the center of the element
|
317
294
|
# @param x If positive integer, will offset the click from the left side, if negative integer, will offset the click from the right. If float value is given, it will threat it as percentage offset, giving it 0.5 will click in the middle
|
318
295
|
# @param y If positive integer, will offset the click from the bottom side, if negative integer, will offset the click from the top. If float value is given, it will threat it as percentage offset, giving it 0.5 will click in the middle
|
319
|
-
def click(x = nil, y = nil, double: false)
|
320
|
-
if !x.nil? && !y.nil? || double
|
296
|
+
def click(x = nil, y = nil, double: false, by_coords: false)
|
297
|
+
if !x.nil? && !y.nil? || double || by_coords
|
321
298
|
|
322
|
-
x=0.5 if x.nil?
|
323
|
-
y=0.5 if y.nil?
|
299
|
+
x = 0.5 if x.nil?
|
300
|
+
y = 0.5 if y.nil?
|
324
301
|
|
325
302
|
b = self.bounds
|
326
|
-
if x.
|
303
|
+
if x.is_a?(Integer)
|
327
304
|
if x >= 0
|
328
305
|
x = b.top_left.x + x
|
329
306
|
else
|
330
307
|
x = b.bottom_right.x + x
|
331
308
|
end
|
332
|
-
elsif x.
|
333
|
-
x = b.top_left.x + b.width*x
|
309
|
+
elsif x.is_a?(Float) && x <= 1.0 && x >= 0
|
310
|
+
x = b.top_left.x + b.width * x
|
334
311
|
else
|
335
312
|
raise "x value #{x} not supported. Use integer as pixel or float (0..1) as percentage of element width"
|
336
313
|
end
|
337
314
|
|
338
|
-
if y.
|
315
|
+
if y.is_a?(Integer)
|
339
316
|
if y >= 0
|
340
317
|
y = b.top_left.y + y
|
341
318
|
else
|
342
319
|
y = b.bottom_right + y
|
343
320
|
end
|
344
|
-
elsif y.
|
345
|
-
y = b.top_left.y + b.height*y
|
321
|
+
elsif y.is_a?(Float) && y <= 1.0 && y >= 0
|
322
|
+
y = b.top_left.y + b.height * y
|
346
323
|
else
|
347
324
|
raise "y value #{x} not supported. Use integer as pixel or float (0..1) as percentage of element height"
|
348
325
|
end
|
@@ -364,18 +341,16 @@ module ::TestaAppiumDriver
|
|
364
341
|
else
|
365
342
|
# on ios, if element is not visible, first click will scroll to it
|
366
343
|
# then on second click actually perform the click
|
367
|
-
visible = visible?
|
344
|
+
#visible = visible?
|
368
345
|
perform_driver_method(:click)
|
369
|
-
perform_driver_method(:click) unless visible rescue nil
|
346
|
+
#perform_driver_method(:click) unless visible rescue nil
|
370
347
|
end
|
371
348
|
end
|
372
349
|
end
|
373
350
|
|
374
|
-
|
375
351
|
alias_method :tap, :click
|
376
352
|
alias_method :double_tap, :double_click
|
377
353
|
|
378
|
-
|
379
354
|
def send_key(*args)
|
380
355
|
perform_driver_method(:send_keys, *args)
|
381
356
|
end
|
@@ -384,12 +359,11 @@ module ::TestaAppiumDriver
|
|
384
359
|
perform_driver_method(:clear)
|
385
360
|
end
|
386
361
|
|
387
|
-
|
388
362
|
# Return parent element
|
389
363
|
# @return [TestaAppiumDriver::Locator]
|
390
364
|
def parent
|
391
365
|
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "parent") if @strategy != FIND_STRATEGY_XPATH && !@strategy.nil?
|
392
|
-
raise "Cannot add parent selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]")
|
366
|
+
raise "Cannot add parent selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]") && !@from_element.nil?
|
393
367
|
|
394
368
|
locator = self.dup
|
395
369
|
locator.strategy = FIND_STRATEGY_XPATH
|
@@ -403,7 +377,7 @@ module ::TestaAppiumDriver
|
|
403
377
|
# @return [TestaAppiumDriver::Locator]
|
404
378
|
def children
|
405
379
|
raise "Cannot add children selector to array" unless @single
|
406
|
-
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "children") if @strategy != FIND_STRATEGY_XPATH &&
|
380
|
+
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "children") if @strategy != FIND_STRATEGY_XPATH && @strategy != FIND_STRATEGY_CLASS_CHAIN && !@strategy.nil?
|
407
381
|
|
408
382
|
locator = self.dup
|
409
383
|
locator.strategy_reason = "children"
|
@@ -420,7 +394,6 @@ module ::TestaAppiumDriver
|
|
420
394
|
locator
|
421
395
|
end
|
422
396
|
|
423
|
-
|
424
397
|
# Return first child element
|
425
398
|
# @return [TestaAppiumDriver::Locator]
|
426
399
|
def child
|
@@ -442,12 +415,11 @@ module ::TestaAppiumDriver
|
|
442
415
|
locator
|
443
416
|
end
|
444
417
|
|
445
|
-
|
446
418
|
# @return [TestaAppiumDriver::Locator]
|
447
419
|
def siblings
|
448
420
|
raise "Cannot add siblings selector to array" unless @single
|
449
421
|
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "siblings") if @strategy != FIND_STRATEGY_XPATH && !@strategy.nil?
|
450
|
-
raise "Cannot add siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]")
|
422
|
+
raise "Cannot add siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]") && !@from_element.nil?
|
451
423
|
|
452
424
|
locator = self.dup
|
453
425
|
locator.strategy = FIND_STRATEGY_XPATH
|
@@ -463,7 +435,7 @@ module ::TestaAppiumDriver
|
|
463
435
|
def preceding_siblings
|
464
436
|
raise "Cannot add preceding_siblings selector to array" unless @single
|
465
437
|
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "preceding_siblings") if @strategy != FIND_STRATEGY_XPATH && !@strategy.nil?
|
466
|
-
raise "Cannot add preceding_siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]")
|
438
|
+
raise "Cannot add preceding_siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]") && !@from_element.nil?
|
467
439
|
|
468
440
|
locator = self.dup
|
469
441
|
locator.strategy = FIND_STRATEGY_XPATH
|
@@ -479,7 +451,7 @@ module ::TestaAppiumDriver
|
|
479
451
|
def preceding_sibling
|
480
452
|
raise "Cannot add preceding_sibling selector to array" unless @single
|
481
453
|
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "preceding_sibling") if @strategy != FIND_STRATEGY_XPATH && !@strategy.nil?
|
482
|
-
raise "Cannot add preceding siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]")
|
454
|
+
raise "Cannot add preceding siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]") && !@from_element.nil?
|
483
455
|
|
484
456
|
locator = self.dup
|
485
457
|
locator.strategy = FIND_STRATEGY_XPATH
|
@@ -493,12 +465,11 @@ module ::TestaAppiumDriver
|
|
493
465
|
locator
|
494
466
|
end
|
495
467
|
|
496
|
-
|
497
468
|
# @return [TestaAppiumDriver::Locator]
|
498
469
|
def following_siblings
|
499
470
|
raise "Cannot add following_siblings selector to array" unless @single
|
500
471
|
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "following_siblings") if @strategy != FIND_STRATEGY_XPATH && !@strategy.nil?
|
501
|
-
raise "Cannot add following_siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]")
|
472
|
+
raise "Cannot add following_siblings selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]") && !@from_element.nil?
|
502
473
|
|
503
474
|
locator = self.dup
|
504
475
|
locator.strategy = FIND_STRATEGY_XPATH
|
@@ -514,7 +485,7 @@ module ::TestaAppiumDriver
|
|
514
485
|
def following_sibling
|
515
486
|
raise "Cannot add following_sibling selector to array" unless @single
|
516
487
|
raise StrategyMixException.new(@strategy, @strategy_reason, FIND_STRATEGY_XPATH, "following_sibling") if @strategy != FIND_STRATEGY_XPATH && !@strategy.nil?
|
517
|
-
raise "Cannot add following_sibling selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]")
|
488
|
+
raise "Cannot add following_sibling selector to a retrieved instance of a class array" if (@xpath_selector == ".//*" || @xpath_selector == ".//*[1]") && !@from_element.nil?
|
518
489
|
|
519
490
|
locator = self.dup
|
520
491
|
locator.strategy = FIND_STRATEGY_XPATH
|
@@ -528,7 +499,6 @@ module ::TestaAppiumDriver
|
|
528
499
|
locator
|
529
500
|
end
|
530
501
|
|
531
|
-
|
532
502
|
private
|
533
503
|
|
534
504
|
def _wait(type, args)
|
@@ -549,10 +519,8 @@ module ::TestaAppiumDriver
|
|
549
519
|
args.delete(:interval)
|
550
520
|
args.delete(:timeout)
|
551
521
|
|
552
|
-
|
553
|
-
|
554
522
|
start_time = Time.now.to_f
|
555
|
-
if type ==
|
523
|
+
if type == :while
|
556
524
|
while exists? && _attributes_match(args)
|
557
525
|
raise message if start_time + timeout < Time.now.to_f
|
558
526
|
sleep interval
|
@@ -580,7 +548,7 @@ module ::TestaAppiumDriver
|
|
580
548
|
#noinspection RubyNilAnalysis
|
581
549
|
def perform_driver_method(name, *args)
|
582
550
|
elements = execute
|
583
|
-
if elements.
|
551
|
+
if elements.is_a?(Array)
|
584
552
|
elements.map { |e| e.send(name, *args) }
|
585
553
|
else
|
586
554
|
elements.send(name, *args)
|
@@ -592,7 +560,6 @@ module ::TestaAppiumDriver
|
|
592
560
|
locator.xpath_selector += hash_to_xpath(@driver.device, selectors, single)
|
593
561
|
end
|
594
562
|
|
595
|
-
|
596
563
|
def handle_image_selector(selectors, params)
|
597
564
|
image_match_threshold = 0.4
|
598
565
|
image_match_threshold = params[:imageMatchThreshold] unless params[:imageMatchThreshold].nil?
|
data/testa_appium_driver.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.add_runtime_dependency "appium_lib_core", ["~> 5.
|
33
|
+
spec.add_runtime_dependency "appium_lib_core", ["~> 5.4.0"]
|
34
34
|
spec.add_runtime_dependency "json", ["~> 2.3"]
|
35
35
|
|
36
36
|
spec.add_development_dependency "rubocop", ["= 1.19.0"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testa_appium_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- karlo.razumovic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appium_lib_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: 5.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: 5.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- LICENSE.txt
|
87
87
|
- README.md
|
88
88
|
- Rakefile
|
89
|
+
- appium-driver.iml
|
89
90
|
- bin/console
|
90
91
|
- bin/setup
|
91
92
|
- lib/testa_appium_driver.rb
|