testa_appium_driver 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +23 -0
- data/.gitignore +0 -2
- data/.rubocop.yml +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +74 -0
- data/appium-driver.iml +72 -0
- data/lib/testa_appium_driver/android/class_selectors.rb +7 -7
- data/lib/testa_appium_driver/android/driver.rb +1 -0
- data/lib/testa_appium_driver/android/locator/attributes.rb +29 -25
- data/lib/testa_appium_driver/android/locator.rb +1 -1
- data/lib/testa_appium_driver/android/selenium_element.rb +6 -2
- data/lib/testa_appium_driver/common/constants.rb +2 -1
- data/lib/testa_appium_driver/common/locator/scroll_actions.rb +33 -33
- data/lib/testa_appium_driver/common/locator.rb +42 -25
- data/lib/testa_appium_driver/common/scroll_actions/json_wire_scroll_actions.rb +1 -1
- data/lib/testa_appium_driver/common/scroll_actions/w3c_scroll_actions.rb +87 -20
- data/lib/testa_appium_driver/common/scroll_actions.rb +26 -19
- data/lib/testa_appium_driver/common/selenium_element.rb +2 -2
- data/lib/testa_appium_driver/driver.rb +33 -19
- data/lib/testa_appium_driver/ios/locator/attributes.rb +24 -20
- data/lib/testa_appium_driver/ios/locator.rb +1 -0
- data/lib/testa_appium_driver/ios/selenium_element.rb +2 -2
- data/lib/testa_appium_driver/ios/type_selectors.rb +2 -2
- data/lib/testa_appium_driver/version.rb +1 -1
- data/testa_appium_driver.gemspec +1 -1
- metadata +7 -14
- data/.idea/deployment.xml +0 -22
- data/.idea/inspectionProfiles/Project_Default.xml +0 -9
- data/.idea/misc.xml +0 -6
- data/.idea/modules.xml +0 -8
- data/.idea/runConfigurations/Android_Test.xml +0 -42
- data/.idea/runConfigurations.xml +0 -10
- data/.idea/sshConfigs.xml +0 -13
- data/.idea/vcs.xml +0 -6
- data/.idea/webServers.xml +0 -21
- data/testa_appium_driver.iml +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42baeaf531486245427c9a3e2bc002e8c6bf659ec2f7e010cc7f46a56c863f2c
|
4
|
+
data.tar.gz: 31ea0d036c32405f744dfdbbce04d596ff3822cd54144270bed08fd4e7e6c90c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ac915f5a1036eb9c943c8770295aaa5def6268685f9db2f7b802d9ac19128d39348c4a3cc9010d45fd0fea5f0ced98327f94a124b0eac55cfaff7b310193aa
|
7
|
+
data.tar.gz: aec59ca33a54aed586c832e82a5aa11ca9d331759aea810a89e6e6e0bd9193f48af7b69d6323427413dffba1d3e5bd693d726db4bc88d4f6f3d7439e55bcc00d
|
data/.gitattributes
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Set the default behavior, in case people don't have core.autocrlf set.
|
2
|
+
* text=auto
|
3
|
+
|
4
|
+
# Declare files that will always have LF line endings on checkout.
|
5
|
+
*.rb text eol=lf
|
6
|
+
*.yml text eol=lf
|
7
|
+
*.sh text eol=lf
|
8
|
+
*.Dockerfile eol=lf
|
9
|
+
*.dockerfile eol=lf
|
10
|
+
*.conf eol=lf
|
11
|
+
*.ru eol=lf
|
12
|
+
*.json eol=lf
|
13
|
+
*.js eol=lf
|
14
|
+
*.css eol=lf
|
15
|
+
*.erb eol=lf
|
16
|
+
*.html eol=lf
|
17
|
+
*.map eol=lf
|
18
|
+
|
19
|
+
# Denote all files that are truly binary and should not be modified.
|
20
|
+
*.png binary
|
21
|
+
*.jpg binary
|
22
|
+
*.bin binary
|
23
|
+
*.zip binary
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
testa_appium_driver (0.1.131)
|
5
|
+
appium_lib_core (= 5.1.0)
|
6
|
+
json (~> 2.3)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
appium_lib_core (5.1.0)
|
12
|
+
faye-websocket (~> 0.11.0)
|
13
|
+
selenium-webdriver (~> 4.0)
|
14
|
+
ast (2.4.2)
|
15
|
+
childprocess (4.1.0)
|
16
|
+
diff-lcs (1.5.0)
|
17
|
+
eventmachine (1.2.7)
|
18
|
+
faye-websocket (0.11.1)
|
19
|
+
eventmachine (>= 0.12.0)
|
20
|
+
websocket-driver (>= 0.5.1)
|
21
|
+
json (2.6.2)
|
22
|
+
parallel (1.22.1)
|
23
|
+
parser (3.1.2.0)
|
24
|
+
ast (~> 2.4.1)
|
25
|
+
rainbow (3.1.1)
|
26
|
+
rake (13.0.6)
|
27
|
+
regexp_parser (2.4.0)
|
28
|
+
rexml (3.2.5)
|
29
|
+
rspec (3.11.0)
|
30
|
+
rspec-core (~> 3.11.0)
|
31
|
+
rspec-expectations (~> 3.11.0)
|
32
|
+
rspec-mocks (~> 3.11.0)
|
33
|
+
rspec-core (3.11.0)
|
34
|
+
rspec-support (~> 3.11.0)
|
35
|
+
rspec-expectations (3.11.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.11.0)
|
38
|
+
rspec-mocks (3.11.1)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.11.0)
|
41
|
+
rspec-support (3.11.0)
|
42
|
+
rubocop (1.26.0)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 3.1.0.0)
|
45
|
+
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
regexp_parser (>= 1.8, < 3.0)
|
47
|
+
rexml
|
48
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
49
|
+
ruby-progressbar (~> 1.7)
|
50
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
51
|
+
rubocop-ast (1.18.0)
|
52
|
+
parser (>= 3.1.1.0)
|
53
|
+
ruby-progressbar (1.11.0)
|
54
|
+
rubyzip (2.3.2)
|
55
|
+
selenium-webdriver (4.1.0)
|
56
|
+
childprocess (>= 0.5, < 5.0)
|
57
|
+
rexml (~> 3.2, >= 3.2.5)
|
58
|
+
rubyzip (>= 1.2.2)
|
59
|
+
unicode-display_width (2.1.0)
|
60
|
+
websocket-driver (0.7.5)
|
61
|
+
websocket-extensions (>= 0.1.0)
|
62
|
+
websocket-extensions (0.1.5)
|
63
|
+
|
64
|
+
PLATFORMS
|
65
|
+
ruby
|
66
|
+
|
67
|
+
DEPENDENCIES
|
68
|
+
rake (~> 13.0)
|
69
|
+
rspec (~> 3.0)
|
70
|
+
rubocop (~> 1.26.0)
|
71
|
+
testa_appium_driver!
|
72
|
+
|
73
|
+
BUNDLED WITH
|
74
|
+
2.1.2
|
data/appium-driver.iml
ADDED
@@ -0,0 +1,72 @@
|
|
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.1.0, 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="childprocess (v4.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="eventmachine (v1.2.7, RVM: ruby-2.7.6) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="faye-websocket (v0.11.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.6) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.4.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.26.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.18.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v4.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, RVM: ruby-2.7.6) [gem]" level="application" />
|
37
|
+
</component>
|
38
|
+
<component name="RakeTasksCache">
|
39
|
+
<option name="myRootTask">
|
40
|
+
<RakeTaskImpl id="rake">
|
41
|
+
<subtasks>
|
42
|
+
<RakeTaskImpl description="Build testa_appium_driver-0.1.131.gem into the pkg directory" fullCommand="build" id="build" />
|
43
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
44
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
45
|
+
<RakeTaskImpl description="Build and install testa_appium_driver-0.1.131.gem into system gems" fullCommand="install" id="install" />
|
46
|
+
<RakeTaskImpl id="install">
|
47
|
+
<subtasks>
|
48
|
+
<RakeTaskImpl description="Build and install testa_appium_driver-0.1.131.gem into system gems without network access" fullCommand="install:local" id="local" />
|
49
|
+
</subtasks>
|
50
|
+
</RakeTaskImpl>
|
51
|
+
<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]" />
|
52
|
+
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
53
|
+
<RakeTaskImpl id="rubocop">
|
54
|
+
<subtasks>
|
55
|
+
<RakeTaskImpl description="Auto-correct RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
|
56
|
+
</subtasks>
|
57
|
+
</RakeTaskImpl>
|
58
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
59
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
60
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
61
|
+
<RakeTaskImpl id="release">
|
62
|
+
<subtasks>
|
63
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
64
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
65
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
66
|
+
</subtasks>
|
67
|
+
</RakeTaskImpl>
|
68
|
+
</subtasks>
|
69
|
+
</RakeTaskImpl>
|
70
|
+
</option>
|
71
|
+
</component>
|
72
|
+
</module>
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module TestaAppiumDriver
|
1
|
+
module ::TestaAppiumDriver
|
2
2
|
#noinspection ALL
|
3
3
|
module ClassSelectors
|
4
4
|
|
5
5
|
# @return [TestaAppiumDriver::Locator]
|
6
6
|
def add_selector(*args, &block)
|
7
7
|
# if class selector is executed from driver, create new locator instance
|
8
|
-
if self.kind_of?(TestaAppiumDriver::Driver) || self.instance_of?(Selenium::WebDriver::Element)
|
8
|
+
if self.kind_of?(TestaAppiumDriver::Driver) || self.instance_of?(::Selenium::WebDriver::Element) || self.instance_of?(::Appium::Core::Element)
|
9
9
|
args.last[:default_find_strategy] = @default_find_strategy
|
10
10
|
args.last[:default_scroll_strategy] = @default_scroll_strategy
|
11
|
-
if self.instance_of?(Selenium::WebDriver::Element)
|
11
|
+
if self.instance_of?(::Selenium::WebDriver::Element) || self.instance_of?(::Appium::Core::Element)
|
12
12
|
driver = self.get_driver
|
13
13
|
else
|
14
14
|
driver = self
|
@@ -117,17 +117,17 @@ module TestaAppiumDriver
|
|
117
117
|
add_selector(params)
|
118
118
|
end
|
119
119
|
|
120
|
-
# first android.
|
120
|
+
# first android.view.ViewGroup element that match given selectors
|
121
121
|
# @return [TestaAppiumDriver::Locator]
|
122
122
|
def view_group(params = {})
|
123
|
-
params[:class] = "android.
|
123
|
+
params[:class] = "android.view.ViewGroup"
|
124
124
|
add_selector(params)
|
125
125
|
end
|
126
126
|
|
127
|
-
# all android.
|
127
|
+
# all android.view.ViewGroup elements that match given selectors
|
128
128
|
# @return [TestaAppiumDriver::Locator]
|
129
129
|
def view_groups(params = {})
|
130
|
-
params[:class] = "android.
|
130
|
+
params[:class] = "android.view.ViewGroup"
|
131
131
|
params[:single] = false
|
132
132
|
add_selector(params)
|
133
133
|
end
|
@@ -8,6 +8,7 @@ module TestaAppiumDriver
|
|
8
8
|
include ClassSelectors
|
9
9
|
|
10
10
|
|
11
|
+
|
11
12
|
# executes shell command
|
12
13
|
# @param [String] command Shell command name to execute for example echo or rm
|
13
14
|
# @param [Array<String>] args Array of command arguments, example: ['-f', '/sdcard/my_file.txt']
|
@@ -2,12 +2,18 @@ module TestaAppiumDriver
|
|
2
2
|
module Attributes
|
3
3
|
|
4
4
|
#noinspection RubyNilAnalysis
|
5
|
-
def
|
6
|
-
|
5
|
+
def testa_attribute(name, *args)
|
6
|
+
if self.instance_of?(::Selenium::WebDriver::Element) || self.instance_of?(::Appium::Core::Element)
|
7
|
+
@driver = get_driver # does not get correct driver
|
8
|
+
elements = self
|
9
|
+
else
|
10
|
+
elements = execute(*args)
|
11
|
+
raise "Element not found" if elements.nil?
|
12
|
+
end
|
7
13
|
|
8
|
-
@driver = get_driver if self.instance_of?(Selenium::WebDriver::Element)
|
9
14
|
|
10
|
-
|
15
|
+
|
16
|
+
if elements.kind_of?(::Selenium::WebDriver::Element) || elements.kind_of?(::Appium::Core::Element)
|
11
17
|
r = elements.send(:attribute, name.to_s)
|
12
18
|
r = TestaAppiumDriver::Bounds.from_android(r, @driver) if name.to_s == "bounds"
|
13
19
|
else
|
@@ -18,86 +24,84 @@ module TestaAppiumDriver
|
|
18
24
|
end
|
19
25
|
|
20
26
|
def text(*args)
|
21
|
-
|
27
|
+
testa_attribute("text", *args)
|
22
28
|
end
|
23
29
|
|
24
30
|
def package(*args)
|
25
|
-
|
31
|
+
testa_attribute("package", *args)
|
26
32
|
end
|
27
33
|
|
28
34
|
def class_name(*args)
|
29
|
-
|
35
|
+
testa_attribute("className", *args)
|
30
36
|
end
|
31
37
|
|
32
38
|
def checkable?(*args)
|
33
|
-
|
39
|
+
testa_attribute("checkable", *args).to_s == "true"
|
34
40
|
end
|
35
41
|
|
36
42
|
def checked?(*args)
|
37
|
-
|
43
|
+
testa_attribute("checked", *args).to_s == "true"
|
38
44
|
end
|
39
45
|
|
40
46
|
def clickable?(*args)
|
41
|
-
|
47
|
+
testa_attribute("clickable", *args).to_s == "true"
|
42
48
|
end
|
43
49
|
|
44
50
|
def desc(*args)
|
45
|
-
|
51
|
+
testa_attribute("contentDescription", *args)
|
46
52
|
end
|
47
53
|
|
48
54
|
def enabled?(*args)
|
49
|
-
|
55
|
+
testa_attribute("enabled", *args).to_s == "true"
|
50
56
|
end
|
51
57
|
|
52
58
|
def focusable?(*args)
|
53
|
-
|
59
|
+
testa_attribute("focusable", *args).to_s == "true"
|
54
60
|
end
|
55
61
|
|
56
62
|
def focused?(*args)
|
57
|
-
|
63
|
+
testa_attribute("focused", *args).to_s == "true"
|
58
64
|
end
|
59
65
|
|
60
66
|
def long_clickable?(*args)
|
61
|
-
|
67
|
+
testa_attribute("longClickable", *args).to_s == "true"
|
62
68
|
end
|
63
69
|
|
64
70
|
def password?(*args)
|
65
|
-
|
71
|
+
testa_attribute("password", *args).to_s == "true"
|
66
72
|
end
|
67
73
|
|
68
74
|
def id(*args)
|
69
|
-
|
75
|
+
testa_attribute("resourceId", *args)
|
70
76
|
end
|
71
77
|
|
72
78
|
def scrollable?(*args)
|
73
|
-
|
79
|
+
testa_attribute("scrollable", *args).to_s == "true"
|
74
80
|
end
|
75
81
|
|
76
82
|
def selected?(*args)
|
77
|
-
|
83
|
+
testa_attribute("selected", *args).to_s == "true"
|
78
84
|
end
|
79
85
|
|
80
86
|
def displayed?(*args)
|
81
|
-
|
87
|
+
testa_attribute("displayed", *args).to_s == "true"
|
82
88
|
end
|
83
89
|
|
84
90
|
def selection_start(*args)
|
85
|
-
|
91
|
+
testa_attribute("selection-start", *args)
|
86
92
|
end
|
87
93
|
|
88
94
|
def selection_end(*args)
|
89
|
-
|
95
|
+
testa_attribute("selection-end", *args)
|
90
96
|
end
|
91
97
|
|
92
98
|
def bounds(*args)
|
93
|
-
|
99
|
+
testa_attribute("bounds", *args)
|
94
100
|
end
|
95
101
|
|
96
102
|
end
|
97
103
|
|
98
104
|
class Locator
|
99
|
-
include TestaAppiumDriver::Attributes
|
100
|
-
|
101
105
|
|
102
106
|
# element index in parent element, starts from 0
|
103
107
|
#noinspection RubyNilAnalysis,RubyYardReturnMatch
|
@@ -5,6 +5,7 @@ module TestaAppiumDriver
|
|
5
5
|
class Locator
|
6
6
|
attr_accessor :closing_parenthesis
|
7
7
|
include ClassSelectors
|
8
|
+
include Attributes
|
8
9
|
|
9
10
|
def init(params, selectors, single)
|
10
11
|
@closing_parenthesis = 0
|
@@ -12,7 +13,6 @@ module TestaAppiumDriver
|
|
12
13
|
|
13
14
|
@ui_selector = hash_to_uiautomator(selectors, single)
|
14
15
|
|
15
|
-
|
16
16
|
if is_scrollable_selector?(selectors, single)
|
17
17
|
if selectors[:class] == "android.widget.HorizontalScrollView"
|
18
18
|
@scroll_orientation = :horizontal
|
@@ -24,7 +24,8 @@ module TestaAppiumDriver
|
|
24
24
|
DEFAULT_UIAUTOMATOR_MAX_SWIPES = 20
|
25
25
|
|
26
26
|
DEFAULT_ANDROID_FIND_STRATEGY = FIND_STRATEGY_UIAUTOMATOR
|
27
|
-
DEFAULT_ANDROID_SCROLL_STRATEGY = SCROLL_STRATEGY_UIAUTOMATOR
|
27
|
+
#DEFAULT_ANDROID_SCROLL_STRATEGY = SCROLL_STRATEGY_UIAUTOMATOR
|
28
|
+
DEFAULT_ANDROID_SCROLL_STRATEGY = SCROLL_STRATEGY_W3C
|
28
29
|
|
29
30
|
|
30
31
|
DEFAULT_IOS_FIND_STRATEGY = FIND_STRATEGY_XPATH
|
@@ -20,7 +20,7 @@ module TestaAppiumDriver
|
|
20
20
|
# scrolls to the start of the scrollable containers and scrolls to the end,
|
21
21
|
# everytime a locator element is found the given block is executed
|
22
22
|
# @return [Array<Selenium::WebDriver::Element>]
|
23
|
-
def
|
23
|
+
def scroll_each(top: nil, bottom: nil, right: nil, left: nil, direction: nil, &block)
|
24
24
|
deadzone = _process_deadzone(top, bottom, right, left)
|
25
25
|
raise "Each can only be performed on multiple elements locator" if @single
|
26
26
|
deadzone = @scrollable_locator.scroll_deadzone if deadzone.nil? && !@scrollable_locator.nil?
|
@@ -29,38 +29,38 @@ module TestaAppiumDriver
|
|
29
29
|
deadzone: deadzone,
|
30
30
|
default_scroll_strategy: @default_scroll_strategy)
|
31
31
|
if direction.nil?
|
32
|
-
sa.
|
32
|
+
sa.scroll_each(&block)
|
33
33
|
else
|
34
|
-
sa.send("
|
34
|
+
sa.send("scroll_each_#{direction}", &block)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
# scrolls down from the current page view (without prior scrolling to the top) and
|
39
39
|
# everytime a locator element is found the given block is executed
|
40
40
|
# @return [Array<Selenium::WebDriver::Element>]
|
41
|
-
def
|
42
|
-
|
41
|
+
def scroll_each_down(top: nil, bottom: nil, right: nil, left: nil, &block)
|
42
|
+
scroll_each(top: top, bottom: bottom, right: right, left: left, direction: :down, &block)
|
43
43
|
end
|
44
44
|
|
45
45
|
# scrolls up from the current page view (without prior scrolling to the bottom) and
|
46
46
|
# everytime a locator element is found the given block is executed
|
47
47
|
# @return [Array<Selenium::WebDriver::Element>]
|
48
|
-
def
|
49
|
-
|
48
|
+
def scroll_each_up(top: nil, bottom: nil, right: nil, left: nil, &block)
|
49
|
+
scroll_each(top: top, bottom: bottom, right: right, left: left, direction: :up, &block)
|
50
50
|
end
|
51
51
|
|
52
52
|
# scrolls right from the current page view (without prior scrolling to the left) and
|
53
53
|
# everytime a locator element is found the given block is executed
|
54
54
|
# @return [Array<Selenium::WebDriver::Element>]
|
55
|
-
def
|
56
|
-
|
55
|
+
def scroll_each_right(top: nil, bottom: nil, right: nil, left: nil, &block)
|
56
|
+
scroll_each(top: top, bottom: bottom, right: right, left: left, direction: :right, &block)
|
57
57
|
end
|
58
58
|
|
59
59
|
# scrolls left from the current page view (without prior scrolling to the right) and
|
60
60
|
# everytime a locator element is found the given block is executed
|
61
61
|
# @return [Array<Selenium::WebDriver::Element>]
|
62
|
-
def
|
63
|
-
|
62
|
+
def scroll_each_left(top: nil, bottom: nil, right: nil, left: nil, &block)
|
63
|
+
scroll_each(top: top, bottom: bottom, right: right, left: left, direction: :left, &block)
|
64
64
|
end
|
65
65
|
|
66
66
|
|
@@ -69,14 +69,14 @@ module TestaAppiumDriver
|
|
69
69
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
70
70
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
71
71
|
# @return [TestaAppiumDriver::Locator]
|
72
|
-
def align(with = :top, top: nil, bottom: nil, right: nil, left: nil, scroll_to_find: false)
|
72
|
+
def align(with = :top, top: nil, bottom: nil, right: nil, left: nil, scroll_to_find: false, max_attempts: 3)
|
73
73
|
deadzone = _process_deadzone(top, bottom, right, left)
|
74
74
|
deadzone = @scrollable_locator.scroll_deadzone if deadzone.nil? && !@scrollable_locator.nil?
|
75
75
|
sa = ScrollActions.new(@scrollable_locator,
|
76
76
|
locator: self,
|
77
77
|
deadzone: deadzone,
|
78
78
|
default_scroll_strategy: @default_scroll_strategy)
|
79
|
-
sa.align(with, scroll_to_find)
|
79
|
+
sa.align(with, scroll_to_find, max_attempts)
|
80
80
|
self
|
81
81
|
end
|
82
82
|
|
@@ -85,8 +85,8 @@ module TestaAppiumDriver
|
|
85
85
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
86
86
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
87
87
|
# @return [TestaAppiumDriver::Locator]
|
88
|
-
def align_top(top: nil, bottom: nil, right: nil, left: nil)
|
89
|
-
align(:top, top: top, bottom: bottom, right: right, left: left)
|
88
|
+
def align_top(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
89
|
+
align(:top, top: top, bottom: bottom, right: right, left: left, max_attempts: max_attempts)
|
90
90
|
end
|
91
91
|
|
92
92
|
# Aligns element on bottom of the scrollable container, if the element does not exists it will scroll to find it
|
@@ -94,8 +94,8 @@ module TestaAppiumDriver
|
|
94
94
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
95
95
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
96
96
|
# @return [TestaAppiumDriver::Locator]
|
97
|
-
def align_bottom(top: nil, bottom: nil, right: nil, left: nil)
|
98
|
-
align(:bottom, top: top, bottom: bottom, right: right, left: left)
|
97
|
+
def align_bottom(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
98
|
+
align(:bottom, top: top, bottom: bottom, right: right, left: left, max_attempts: max_attempts)
|
99
99
|
end
|
100
100
|
|
101
101
|
# Aligns element on left of the scrollable container, if the element does not exists it will scroll to find it
|
@@ -103,8 +103,8 @@ module TestaAppiumDriver
|
|
103
103
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
104
104
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
105
105
|
# @return [TestaAppiumDriver::Locator]
|
106
|
-
def align_left(top: nil, bottom: nil, right: nil, left: nil)
|
107
|
-
align(:left, top: top, bottom: bottom, right: right, left: left)
|
106
|
+
def align_left(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
107
|
+
align(:left, top: top, bottom: bottom, right: right, left: left, max_attempts: max_attempts)
|
108
108
|
end
|
109
109
|
|
110
110
|
# Aligns element on right of the scrollable container, if the element does not exists it will scroll to find it
|
@@ -112,8 +112,8 @@ module TestaAppiumDriver
|
|
112
112
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
113
113
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
114
114
|
# @return [TestaAppiumDriver::Locator]
|
115
|
-
def align_right(top: nil, bottom: nil, right: nil, left: nil)
|
116
|
-
align(:right, top: top, bottom: bottom, right: right, left: left)
|
115
|
+
def align_right(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
116
|
+
align(:right, top: top, bottom: bottom, right: right, left: left, max_attempts: max_attempts)
|
117
117
|
end
|
118
118
|
|
119
119
|
# Aligns element (by default) on top of the scrollable container, if the element does not exists it raise an exception
|
@@ -121,8 +121,8 @@ module TestaAppiumDriver
|
|
121
121
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
122
122
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
123
123
|
# @return [TestaAppiumDriver::Locator]
|
124
|
-
def align!(with = :top, top: nil, bottom: nil, right: nil, left: nil)
|
125
|
-
align(with, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
|
124
|
+
def align!(with = :top, top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
125
|
+
align(with, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true, max_attempts: max_attempts)
|
126
126
|
end
|
127
127
|
|
128
128
|
# Aligns element on top of the scrollable container, if the element does not exists it raise an exception
|
@@ -130,8 +130,8 @@ module TestaAppiumDriver
|
|
130
130
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
131
131
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
132
132
|
# @return [TestaAppiumDriver::Locator]
|
133
|
-
def align_top!(top: nil, bottom: nil, right: nil, left: nil)
|
134
|
-
align(:top, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
|
133
|
+
def align_top!(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
134
|
+
align(:top, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true, max_attempts: max_attempts)
|
135
135
|
end
|
136
136
|
|
137
137
|
# Aligns element on bottom of the scrollable container, if the element does not exists it raise an exception
|
@@ -139,8 +139,8 @@ module TestaAppiumDriver
|
|
139
139
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
140
140
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
141
141
|
# @return [TestaAppiumDriver::Locator]
|
142
|
-
def align_bottom!(top: nil, bottom: nil, right: nil, left: nil)
|
143
|
-
align(:bottom, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
|
142
|
+
def align_bottom!(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
143
|
+
align(:bottom, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true, max_attempts: max_attempts)
|
144
144
|
end
|
145
145
|
|
146
146
|
# Aligns element on left of the scrollable container, if the element does not exists it raise an exception
|
@@ -148,8 +148,8 @@ module TestaAppiumDriver
|
|
148
148
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
149
149
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
150
150
|
# @return [TestaAppiumDriver::Locator]
|
151
|
-
def align_left!(top: nil, bottom: nil, right: nil, left: nil)
|
152
|
-
align(:left, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
|
151
|
+
def align_left!(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
152
|
+
align(:left, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true, max_attempts: max_attempts)
|
153
153
|
end
|
154
154
|
|
155
155
|
# Aligns element on right of the scrollable container, if the element does not exists it raise an exception
|
@@ -157,8 +157,8 @@ module TestaAppiumDriver
|
|
157
157
|
# If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
|
158
158
|
# The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
|
159
159
|
# @return [TestaAppiumDriver::Locator]
|
160
|
-
def align_right!(top: nil, bottom: nil, right: nil, left: nil)
|
161
|
-
align(:right, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
|
160
|
+
def align_right!(top: nil, bottom: nil, right: nil, left: nil, max_attempts: 3)
|
161
|
+
align(:right, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true, max_attempts: max_attempts)
|
162
162
|
end
|
163
163
|
|
164
164
|
|
@@ -271,10 +271,10 @@ module TestaAppiumDriver
|
|
271
271
|
# @param [TestaAppiumDriver::Locator, Hash, Selenium::WebDriver::Element, String] to
|
272
272
|
#noinspection RubyYardParamTypeMatch,RubyScope
|
273
273
|
def drag_to(to)
|
274
|
-
if !to.kind_of?(Selenium::WebDriver::Element) && !to.kind_of?(TestaAppiumDriver::Locator) && !to.kind_of?(Hash)
|
274
|
+
if !to.kind_of?(::Selenium::WebDriver::Element) && !to.kind_of?(::Appium::Core::Element) && !to.kind_of?(TestaAppiumDriver::Locator) && !to.kind_of?(Hash)
|
275
275
|
raise "Parameter not accepted, acceptable instances of [TestaAppiumDriver::Locator, Hash, Selenium::WebDriver::Element]"
|
276
276
|
end
|
277
|
-
if to.kind_of?(Selenium::WebDriver::Element)
|
277
|
+
if to.kind_of?(::Selenium::WebDriver::Element) || to.kind_of?(::Appium::Core::Element)
|
278
278
|
bounds = TestaAppiumDriver::Bounds.from_android(to.bounds, @driver)
|
279
279
|
x = bounds.center.x
|
280
280
|
y = bounds.center.y
|