testa_appium_driver 0.1.30 → 0.1.32
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/Gemfile +1 -1
- data/lib/testa_appium_driver/common/locator.rb +38 -42
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: add83f6c9df4e695d9c8869c37d15611e0b87a065c6f844828264784e6d333a5
|
|
4
|
+
data.tar.gz: fa96bc1504a4863534aa9557041ce611594e6267c75f8b6a2d300a42605652d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2fac94a46daef9a2782cc854f959434cc811ea3d853021c626c2b3eb12f9b80b8ce98e666472e916f0f2968524828c6635b9f52f5b0473a9a2f5ab92b230aef
|
|
7
|
+
data.tar.gz: 23f90e32e4c4bb11893a5140202b11a6c7d81681833cd3525539ae470144bce5f92611e57b6c0ac75c90cf6f357183e7c38791d123991d21728d2bdc86a0b4b3
|
data/Gemfile
CHANGED
|
@@ -187,7 +187,8 @@ module ::TestaAppiumDriver
|
|
|
187
187
|
begin
|
|
188
188
|
r = execute(skip_cache: true, ignore_implicit_wait: true)
|
|
189
189
|
return r.count.positive? if r.is_a?(Array)
|
|
190
|
-
|
|
190
|
+
# ios17 has phantom child elements that overlap parent so this returns false positive
|
|
191
|
+
# return r.displayed? if @driver.ios?
|
|
191
192
|
rescue StandardError
|
|
192
193
|
found = false
|
|
193
194
|
end
|
|
@@ -332,56 +333,51 @@ module ::TestaAppiumDriver
|
|
|
332
333
|
# if both x or y, or both are not given, will click in the center of the element
|
|
333
334
|
# @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
|
|
334
335
|
# @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
|
|
335
|
-
def click(x = nil, y = nil, double: false
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if x >= 0
|
|
344
|
-
x = b.top_left.x + x
|
|
345
|
-
else
|
|
346
|
-
x = b.bottom_right.x + x
|
|
347
|
-
end
|
|
348
|
-
elsif x.is_a?(Float) && x <= 1.0 && x >= 0
|
|
349
|
-
x = b.top_left.x + b.width * x
|
|
336
|
+
def click(x = nil, y = nil, double: false)
|
|
337
|
+
x = 0.5 if x.nil?
|
|
338
|
+
y = 0.5 if y.nil?
|
|
339
|
+
|
|
340
|
+
b = self.bounds
|
|
341
|
+
if x.is_a?(Integer)
|
|
342
|
+
if x >= 0
|
|
343
|
+
x = b.top_left.x + x
|
|
350
344
|
else
|
|
351
|
-
|
|
345
|
+
x = b.bottom_right.x + x
|
|
352
346
|
end
|
|
347
|
+
elsif x.is_a?(Float) && x <= 1.0 && x >= 0
|
|
348
|
+
x = b.top_left.x + b.width * x
|
|
349
|
+
else
|
|
350
|
+
raise "x value #{x} not supported. Use integer as pixel or float (0..1) as percentage of element width"
|
|
351
|
+
end
|
|
353
352
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
else
|
|
358
|
-
y = b.bottom_right + y
|
|
359
|
-
end
|
|
360
|
-
elsif y.is_a?(Float) && y <= 1.0 && y >= 0
|
|
361
|
-
y = b.top_left.y + b.height * y
|
|
353
|
+
if y.is_a?(Integer)
|
|
354
|
+
if y >= 0
|
|
355
|
+
y = b.top_left.y + y
|
|
362
356
|
else
|
|
363
|
-
|
|
357
|
+
y = b.bottom_right + y
|
|
364
358
|
end
|
|
359
|
+
elsif y.is_a?(Float) && y <= 1.0 && y >= 0
|
|
360
|
+
y = b.top_left.y + b.height * y
|
|
361
|
+
else
|
|
362
|
+
raise "y value #{x} not supported. Use integer as pixel or float (0..1) as percentage of element height"
|
|
363
|
+
end
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
action_builder = @driver.action
|
|
366
|
+
f1 = action_builder.add_pointer_input(:touch, "finger1")
|
|
367
|
+
f1.create_pointer_move(duration: 0.1, x: x, y: y, origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
|
368
|
+
f1.create_pointer_down(:left)
|
|
369
|
+
f1.create_pointer_up(:left)
|
|
370
|
+
if double
|
|
371
|
+
if @driver.ios?
|
|
372
|
+
# NOTE: ios is stupid, we have to do another move
|
|
373
|
+
# NOTE: ios is stupid, works very wierd if duration is 0
|
|
374
|
+
f1.create_pointer_move(duration: 0.1, x: x, y: y, origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
|
375
|
+
end
|
|
376
|
+
f1.create_pause(0.1)
|
|
369
377
|
f1.create_pointer_down(:left)
|
|
370
378
|
f1.create_pointer_up(:left)
|
|
371
|
-
if double
|
|
372
|
-
if @driver.ios?
|
|
373
|
-
# NOTE: ios is stupid, we have to do another move
|
|
374
|
-
# NOTE: ios is stupid, works very wierd if duration is 0
|
|
375
|
-
f1.create_pointer_move(duration: 0.1, x: x, y: y, origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
|
376
|
-
end
|
|
377
|
-
f1.create_pause(0.1)
|
|
378
|
-
f1.create_pointer_down(:left)
|
|
379
|
-
f1.create_pointer_up(:left)
|
|
380
|
-
end
|
|
381
|
-
@driver.perform_actions [f1]
|
|
382
|
-
else
|
|
383
|
-
perform_driver_method(:click)
|
|
384
379
|
end
|
|
380
|
+
@driver.perform_actions [f1]
|
|
385
381
|
end
|
|
386
382
|
|
|
387
383
|
alias_method :tap, :click
|
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.32
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- karlo.razumovic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-11-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: appium_lib_core
|