testa_appium_driver 0.1.3 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.idea/deployment.xml +10 -2
- data/.idea/inspectionProfiles/Project_Default.xml +8 -8
- data/.idea/runConfigurations/Android_Test.xml +41 -41
- data/.idea/runConfigurations.xml +10 -0
- data/.idea/sshConfigs.xml +3 -0
- data/.idea/webServers.xml +7 -0
- data/.rspec +3 -3
- data/.rubocop.yml +13 -13
- data/CHANGELOG.md +5 -5
- data/CODE_OF_CONDUCT.md +102 -102
- data/Gemfile +12 -12
- data/LICENSE.txt +21 -21
- data/README.md +18 -5
- data/Rakefile +12 -12
- data/bin/console +17 -17
- data/bin/setup +8 -8
- data/lib/testa_appium_driver/android/class_selectors.rb +101 -16
- data/lib/testa_appium_driver/android/driver.rb +19 -1
- data/lib/testa_appium_driver/android/locator.rb +22 -7
- data/lib/testa_appium_driver/android/scroll_actions/uiautomator_scroll_actions.rb +0 -14
- data/lib/testa_appium_driver/common/constants.rb +1 -0
- data/lib/testa_appium_driver/common/helpers.rb +5 -1
- data/lib/testa_appium_driver/common/locator/scroll_actions.rb +152 -58
- data/lib/testa_appium_driver/common/locator.rb +160 -25
- data/lib/testa_appium_driver/common/scroll_actions/w3c_scroll_actions.rb +14 -36
- data/lib/testa_appium_driver/common/scroll_actions.rb +30 -8
- data/lib/testa_appium_driver/common/selenium_element.rb +2 -2
- data/lib/testa_appium_driver/driver.rb +99 -29
- data/lib/testa_appium_driver/ios/driver.rb +14 -0
- data/lib/testa_appium_driver/ios/locator.rb +10 -5
- data/lib/testa_appium_driver/ios/type_selectors.rb +0 -13
- data/lib/testa_appium_driver/version.rb +5 -5
- data/testa_appium_driver.gemspec +1 -1
- data/testa_appium_driver.iml +39 -5
- metadata +7 -6
@@ -3,17 +3,22 @@ module TestaAppiumDriver
|
|
3
3
|
|
4
4
|
private
|
5
5
|
# @return [Array]
|
6
|
-
def w3c_each(
|
6
|
+
def w3c_each(direction, &block)
|
7
7
|
elements = []
|
8
8
|
begin
|
9
|
-
@driver.disable_wait_for_idle
|
10
|
-
@driver.disable_implicit_wait
|
11
9
|
default_deadzone!
|
12
10
|
|
13
11
|
iterations = 0
|
14
12
|
|
15
13
|
|
16
|
-
|
14
|
+
if direction.nil?
|
15
|
+
scroll_to_start
|
16
|
+
if @scrollable.scroll_orientation == :vertical
|
17
|
+
direction = :down
|
18
|
+
else
|
19
|
+
direction = :right
|
20
|
+
end
|
21
|
+
end
|
17
22
|
|
18
23
|
until is_end_of_scroll?
|
19
24
|
matches = @locator.execute(skip_cache: true)
|
@@ -27,39 +32,23 @@ module TestaAppiumDriver
|
|
27
32
|
end
|
28
33
|
iterations += 1
|
29
34
|
break if !@max_scrolls.nil? && iterations == @max_scrolls
|
35
|
+
self.send("page_#{direction}")
|
30
36
|
end
|
31
37
|
rescue => e
|
32
38
|
raise e
|
33
|
-
|
34
|
-
@driver.enable_implicit_wait
|
35
|
-
@driver.enable_wait_for_idle
|
39
|
+
|
36
40
|
end
|
37
41
|
elements
|
38
42
|
end
|
39
43
|
|
40
|
-
def w3c_align(with)
|
41
|
-
@driver.disable_wait_for_idle
|
44
|
+
def w3c_align(with, scroll_to_find)
|
42
45
|
default_deadzone!
|
43
46
|
|
44
47
|
|
45
48
|
|
46
|
-
@locator.scroll_to
|
49
|
+
@locator.scroll_to if scroll_to_find
|
47
50
|
|
48
51
|
element = @locator.execute
|
49
|
-
@driver.disable_implicit_wait
|
50
|
-
|
51
|
-
case with
|
52
|
-
when :top
|
53
|
-
page_down if is_aligned?(with, element)
|
54
|
-
when :bottom
|
55
|
-
page_up if is_aligned?(with, element)
|
56
|
-
when :right
|
57
|
-
page_right if is_aligned?(with, element)
|
58
|
-
when :left
|
59
|
-
page_left if is_aligned?(with, element)
|
60
|
-
else
|
61
|
-
raise "Unsupported align with option: #{with}"
|
62
|
-
end
|
63
52
|
|
64
53
|
timeout = 0
|
65
54
|
until is_aligned?(with, element) || timeout == 3
|
@@ -67,8 +56,6 @@ module TestaAppiumDriver
|
|
67
56
|
timeout += 1
|
68
57
|
end
|
69
58
|
|
70
|
-
@driver.enable_implicit_wait
|
71
|
-
@driver.enable_wait_for_idle
|
72
59
|
end
|
73
60
|
|
74
61
|
|
@@ -142,8 +129,6 @@ module TestaAppiumDriver
|
|
142
129
|
end
|
143
130
|
|
144
131
|
def w3c_scroll_to_start_or_end(type)
|
145
|
-
@driver.disable_wait_for_idle
|
146
|
-
@driver.disable_implicit_wait
|
147
132
|
default_deadzone!
|
148
133
|
|
149
134
|
@previous_elements = nil
|
@@ -171,15 +156,10 @@ module TestaAppiumDriver
|
|
171
156
|
|
172
157
|
# reset the flag for end of scroll elements
|
173
158
|
@previous_elements = nil
|
174
|
-
|
175
|
-
@driver.enable_implicit_wait
|
176
|
-
@driver.enable_wait_for_idle
|
177
159
|
end
|
178
160
|
|
179
161
|
|
180
162
|
def w3c_page_or_fling(type, direction)
|
181
|
-
@driver.disable_wait_for_idle
|
182
|
-
@driver.disable_implicit_wait
|
183
163
|
default_deadzone!
|
184
164
|
|
185
165
|
if direction == :down || direction == :up
|
@@ -208,8 +188,6 @@ module TestaAppiumDriver
|
|
208
188
|
|
209
189
|
w3c_action(x0, y0, x1, y1, type)
|
210
190
|
|
211
|
-
@driver.enable_implicit_wait
|
212
|
-
@driver.enable_wait_for_idle
|
213
191
|
end
|
214
192
|
|
215
193
|
|
@@ -250,7 +228,7 @@ module TestaAppiumDriver
|
|
250
228
|
|
251
229
|
|
252
230
|
|
253
|
-
def
|
231
|
+
def w3c_drag_to(x, y)
|
254
232
|
x0 = @bounds.center.x
|
255
233
|
y0 = @bounds.center.y
|
256
234
|
w3c_action(x0, y0, x, y, SCROLL_ACTION_TYPE_DRAG)
|
@@ -3,19 +3,24 @@ require_relative 'scroll_actions/w3c_scroll_actions'
|
|
3
3
|
|
4
4
|
|
5
5
|
module TestaAppiumDriver
|
6
|
-
#noinspection RubyResolve,RubyTooManyInstanceVariablesInspection
|
7
|
-
class ScrollActions
|
8
6
|
|
7
|
+
# Class for handling scroll actions
|
8
|
+
class ScrollActions
|
9
|
+
# @param [TestaAppiumDriver::Locator, nil] scrollable container that will be used to determine the bounds for scrolling
|
10
|
+
# @param [Hash] params
|
11
|
+
# acceptable params
|
12
|
+
# - locator - element that should be found with scrolling actions
|
13
|
+
# - deadzone - [Hash] that stores top, bottom, left and right deadzone values. If deadzone[:top] is 200 then 200px from top of the scrollable container will not be used for scrolling
|
14
|
+
# - max_scrolls - [Integer] maximum number of scrolls before exception is thrown
|
15
|
+
# - default_scroll_strategy - defines which scroll strategy will be used if a scroll action is valid for multiple strategies
|
9
16
|
def initialize(scrollable, params = {})
|
10
17
|
@scrollable = scrollable
|
11
18
|
@locator = params[:locator]
|
12
19
|
@deadzone = params[:deadzone]
|
13
|
-
@direction = params[:direction]
|
14
20
|
@max_scrolls = params[:max_scrolls]
|
15
21
|
@default_scroll_strategy = params[:default_scroll_strategy]
|
16
22
|
@driver = @locator.driver
|
17
23
|
|
18
|
-
@raise = params[:raise]
|
19
24
|
|
20
25
|
if @scrollable.nil?
|
21
26
|
# if we dont have a scrollable element or if we do have it, but it is not compatible with uiautomator
|
@@ -35,16 +40,33 @@ module TestaAppiumDriver
|
|
35
40
|
end
|
36
41
|
|
37
42
|
|
38
|
-
def align(with)
|
39
|
-
w3c_align(with)
|
43
|
+
def align(with, scroll_to_find)
|
44
|
+
w3c_align(with, scroll_to_find)
|
40
45
|
@locator
|
41
46
|
end
|
42
47
|
|
43
48
|
# @return [Array]
|
44
|
-
def each(
|
45
|
-
w3c_each(
|
49
|
+
def each(&block)
|
50
|
+
w3c_each(nil, &block)
|
51
|
+
end
|
52
|
+
|
53
|
+
def each_down(&block)
|
54
|
+
w3c_each(:down, &block)
|
55
|
+
end
|
56
|
+
|
57
|
+
def each_up(&block)
|
58
|
+
w3c_each(:up, &block)
|
46
59
|
end
|
47
60
|
|
61
|
+
def each_right(&block)
|
62
|
+
w3c_each(:right, &block)
|
63
|
+
end
|
64
|
+
|
65
|
+
def each_left(&block)
|
66
|
+
w3c_each(:left, &block)
|
67
|
+
end
|
68
|
+
|
69
|
+
|
48
70
|
def resolve_strategy
|
49
71
|
if @strategy.nil?
|
50
72
|
@default_scroll_strategy
|
@@ -1,19 +1,19 @@
|
|
1
1
|
module Selenium
|
2
2
|
module WebDriver
|
3
|
-
#noinspection RubyClassVariableUsageInspection
|
4
3
|
class Element
|
4
|
+
# sets the testa appium driver instance for the current phone
|
5
5
|
def self.set_driver(driver, udid)
|
6
6
|
udid = "unknown" if udid.nil?
|
7
7
|
@@drivers ||= {}
|
8
8
|
@@drivers[udid] = driver
|
9
9
|
end
|
10
10
|
|
11
|
+
# @return [TestaAppiumDriver::Driver] testa appium driver instance for the current phone
|
11
12
|
def get_driver
|
12
13
|
udid = @bridge.capabilities.instance_variable_get(:@capabilities)["udid"]
|
13
14
|
udid = "unknown" if udid.nil?
|
14
15
|
@@drivers[udid]
|
15
16
|
end
|
16
|
-
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -24,11 +24,13 @@ module TestaAppiumDriver
|
|
24
24
|
attr_reader :automation_name
|
25
25
|
|
26
26
|
# custom options
|
27
|
-
# -
|
27
|
+
# - default_find_strategy: default strategy to be used for finding elements. Available strategies :uiautomator or :xpath
|
28
|
+
# - default_scroll_strategy: default strategy to be used for scrolling. Available strategies: :uiautomator(android only), :w3c
|
28
29
|
def initialize(opts = {})
|
29
30
|
@testa_opts = opts[:testa_appium_driver] || {}
|
30
31
|
|
31
|
-
|
32
|
+
@wait_for_idle_disabled = false
|
33
|
+
@implicit_wait_disabled = false
|
32
34
|
|
33
35
|
core = Appium::Core.for(opts)
|
34
36
|
extend_for(core.device, core.automation_name)
|
@@ -38,14 +40,15 @@ module TestaAppiumDriver
|
|
38
40
|
handle_testa_opts
|
39
41
|
|
40
42
|
@driver = core.start_driver
|
41
|
-
invalidate_cache
|
43
|
+
invalidate_cache
|
42
44
|
|
43
45
|
|
44
46
|
Selenium::WebDriver::Element.set_driver(self, opts[:caps][:udid])
|
45
47
|
end
|
46
48
|
|
47
49
|
|
48
|
-
|
50
|
+
# invalidates current find_element cache
|
51
|
+
def invalidate_cache
|
49
52
|
@cache = {
|
50
53
|
strategy: nil,
|
51
54
|
selector: nil,
|
@@ -58,44 +61,61 @@ module TestaAppiumDriver
|
|
58
61
|
|
59
62
|
|
60
63
|
|
61
|
-
#
|
64
|
+
# Executes the find_element with the resolved locator strategy and selector. Find_element might be skipped if cache is hit.
|
65
|
+
# Cache stores last executed find_element with given selector, strategy and from_element. If given values are the same within
|
66
|
+
# last 5 seconds element is retrieved from cache.
|
62
67
|
# @param [TestaAppiumDriver::Locator, TestaAppiumDriver::Driver] from_element element from which start the search
|
63
|
-
# @param [String] selector resolved string of a [TestaAppiumDriver::Locator] selector xpath for xpath strategy, java UiSelectors for uiautomator
|
64
68
|
# @param [Boolean] single fetch single or multiple results
|
65
|
-
# @param [
|
66
|
-
# @param [Symbol] default_strategy if strategy is not enforced, default can be used
|
69
|
+
# @param [Array<Hash>] strategies_and_selectors array of usable strategies and selectors
|
67
70
|
# @param [Boolean] skip_cache to skip checking and storing cache
|
68
71
|
# @return [Selenium::WebDriver::Element, Array] element is returned if single is true, array otherwise
|
69
|
-
def execute(from_element,
|
72
|
+
def execute(from_element, single, strategies_and_selectors, skip_cache = false, ignore_implicit_wait = false)
|
70
73
|
|
71
74
|
# if user wants to wait for element to exist, he can use wait_until_present
|
72
75
|
disable_wait_for_idle
|
76
|
+
disable_implicit_wait
|
77
|
+
start_time = Time.now.to_f
|
78
|
+
ss_index = 0
|
79
|
+
|
73
80
|
|
74
81
|
|
75
|
-
# if not restricted to a strategy, use the default one
|
76
|
-
strategy = default_strategy if strategy.nil?
|
77
82
|
|
78
83
|
# resolve from_element unique id, so that we can cache it properly
|
79
|
-
from_element_id = from_element.
|
84
|
+
from_element_id = from_element.instance_of?(TestaAppiumDriver::Locator) ? from_element.strategies_and_selectors : nil
|
80
85
|
|
81
|
-
puts "Executing #{from_element_id ? "from #{from_element.strategy}: #{from_element.strategy_and_selector} => " : ""}#{strategy}: #{selector}"
|
82
86
|
begin
|
83
|
-
|
87
|
+
ss = strategies_and_selectors[ss_index % strategies_and_selectors.count]
|
88
|
+
ss_index +=1
|
89
|
+
|
90
|
+
puts "Executing #{from_element_id ? "from #{from_element.strategy}: #{from_element.strategies_and_selectors} => " : ""}#{ss.keys[0]}: #{ss.values[0]}"
|
91
|
+
|
92
|
+
if @cache[:selector] != ss.values[0] || # cache miss, selector is different
|
84
93
|
@cache[:time] + 5 <= Time.now || # cache miss, older than 5 seconds
|
85
|
-
@cache[:strategy] !=
|
94
|
+
@cache[:strategy] != ss.keys[0] || # cache miss, different find strategy
|
86
95
|
@cache[:from_element_id] != from_element_id || # cache miss, search is started from different element
|
87
96
|
skip_cache # cache is skipped
|
88
97
|
|
89
|
-
if
|
90
|
-
|
98
|
+
if ss.keys[0] == FIND_STRATEGY_IMAGE
|
99
|
+
set_find_by_image_settings(ss.values[0].dup)
|
100
|
+
if single
|
101
|
+
execute_result = from_element.find_element_by_image(ss.values[0][:image])
|
102
|
+
else
|
103
|
+
execute_result = from_element.find_elements_by_image(ss.values[0][:image])
|
104
|
+
end
|
105
|
+
restore_set_by_image_settings
|
91
106
|
else
|
92
|
-
|
107
|
+
if single
|
108
|
+
execute_result = from_element.find_element(ss)
|
109
|
+
else
|
110
|
+
execute_result = from_element.find_elements(ss)
|
111
|
+
end
|
93
112
|
end
|
94
113
|
|
95
114
|
|
115
|
+
|
96
116
|
unless skip_cache
|
97
|
-
@cache[:selector] =
|
98
|
-
@cache[:strategy] =
|
117
|
+
@cache[:selector] = ss.values[0]
|
118
|
+
@cache[:strategy] = ss.keys[0]
|
99
119
|
@cache[:time] = Time.now
|
100
120
|
@cache[:from_element_id] = from_element_id
|
101
121
|
@cache[:element] = execute_result
|
@@ -106,8 +126,14 @@ module TestaAppiumDriver
|
|
106
126
|
puts "Using cache from #{@cache[:time].strftime("%H:%M:%S.%L")}, strategy: #{@cache[:strategy]}"
|
107
127
|
end
|
108
128
|
rescue => e
|
109
|
-
|
129
|
+
if (start_time + @implicit_wait_ms/1000 < Time.now.to_f && !ignore_implicit_wait) || ss_index < strategies_and_selectors.count
|
130
|
+
sleep EXISTS_WAIT if ss_index >= strategies_and_selectors.count
|
131
|
+
retry
|
132
|
+
else
|
133
|
+
raise e
|
134
|
+
end
|
110
135
|
ensure
|
136
|
+
enable_implicit_wait
|
111
137
|
enable_wait_for_idle
|
112
138
|
end
|
113
139
|
|
@@ -116,39 +142,80 @@ module TestaAppiumDriver
|
|
116
142
|
|
117
143
|
|
118
144
|
# method missing is used to forward methods to the actual appium driver
|
145
|
+
# after the method is executed, find element cache is invalidated
|
119
146
|
def method_missing(method, *args, &block)
|
120
|
-
@driver.send(method, *args, &block)
|
147
|
+
r = @driver.send(method, *args, &block)
|
148
|
+
invalidate_cache
|
149
|
+
r
|
121
150
|
end
|
122
151
|
|
152
|
+
# disables implicit wait
|
123
153
|
def disable_implicit_wait
|
124
|
-
|
125
|
-
|
154
|
+
unless @implicit_wait_disabled
|
155
|
+
@implicit_wait_ms = @driver.get_timeouts["implicit"]
|
156
|
+
@implicit_wait_uiautomator_ms = @driver.get_settings["waitForSelectorTimeout"]
|
157
|
+
@driver.manage.timeouts.implicit_wait = 0
|
158
|
+
@driver.update_settings({waitForSelectorTimeout: 0})
|
159
|
+
@implicit_wait_disabled = true
|
160
|
+
end
|
126
161
|
end
|
127
162
|
|
163
|
+
# enables implicit wait, can be called only after disabling implicit wait
|
128
164
|
def enable_implicit_wait
|
129
|
-
raise "Implicit wait is not disabled"
|
165
|
+
raise "Implicit wait is not disabled" unless @implicit_wait_disabled
|
130
166
|
# get_timeouts always returns in milliseconds, but we should set in seconds
|
131
167
|
@driver.manage.timeouts.implicit_wait = @implicit_wait_ms / 1000
|
168
|
+
@driver.update_settings({waitForSelectorTimeout: @implicit_wait_uiautomator_ms})
|
169
|
+
@implicit_wait_disabled = false
|
132
170
|
end
|
133
171
|
|
172
|
+
# disables wait for idle, only executed for android devices
|
134
173
|
def disable_wait_for_idle
|
135
|
-
|
136
|
-
@
|
137
|
-
|
174
|
+
unless @wait_for_idle_disabled
|
175
|
+
if @device == :android
|
176
|
+
@wait_for_idle_timeout = @driver.settings.get["waitForIdleTimeout"]
|
177
|
+
@driver.update_settings({waitForIdleTimeout: 0})
|
178
|
+
end
|
179
|
+
@wait_for_idle_disabled = true
|
138
180
|
end
|
139
181
|
end
|
140
182
|
|
183
|
+
# enables wait for idle, only executed for android devices
|
141
184
|
def enable_wait_for_idle
|
142
185
|
if @device == :android
|
143
|
-
raise "Wait for idle is not disabled"
|
186
|
+
raise "Wait for idle is not disabled" unless @wait_for_idle_disabled
|
144
187
|
@driver.update_settings({waitForIdleTimeout: @wait_for_idle_timeout})
|
145
188
|
end
|
146
189
|
end
|
147
190
|
|
191
|
+
def set_find_by_image_settings(settings)
|
192
|
+
settings.delete(:image)
|
193
|
+
@default_find_image_settings = {}
|
194
|
+
old_settings = @driver.get_settings
|
195
|
+
@default_find_image_settings[:imageMatchThreshold] = old_settings["imageMatchThreshold"]
|
196
|
+
@default_find_image_settings[:fixImageFindScreenshotDims] = old_settings["fixImageFindScreenshotDims"]
|
197
|
+
@default_find_image_settings[:fixImageTemplateSize] = old_settings["fixImageTemplateSize"]
|
198
|
+
@default_find_image_settings[:fixImageTemplateScale] = old_settings["fixImageTemplateScale"]
|
199
|
+
@default_find_image_settings[:defaultImageTemplateScale] = old_settings["defaultImageTemplateScale"]
|
200
|
+
@default_find_image_settings[:checkForImageElementStaleness] = old_settings["checkForImageElementStaleness"]
|
201
|
+
@default_find_image_settings[:autoUpdateImageElementPosition] = old_settings["autoUpdateImageElementPosition"]
|
202
|
+
@default_find_image_settings[:imageElementTapStrategy] = old_settings["imageElementTapStrategy"]
|
203
|
+
@default_find_image_settings[:getMatchedImageResult] = old_settings["getMatchedImageResult"]
|
204
|
+
|
205
|
+
@driver.update_settings(settings)
|
206
|
+
end
|
207
|
+
|
208
|
+
def restore_set_by_image_settings
|
209
|
+
@driver.update_settings(@default_find_image_settings) if @default_find_image_settings
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
# @@return [String] current package under test
|
148
214
|
def current_package
|
149
215
|
@driver.current_package
|
150
216
|
end
|
151
217
|
|
218
|
+
|
152
219
|
def window_size
|
153
220
|
@driver.window_size
|
154
221
|
end
|
@@ -175,6 +242,9 @@ module TestaAppiumDriver
|
|
175
242
|
end
|
176
243
|
|
177
244
|
|
245
|
+
|
246
|
+
|
247
|
+
# @return [Array<Selenium::WebDriver::Element] array of 2 elements, the first element without children and the last element without children in the current page
|
178
248
|
def first_and_last_leaf(from_element = @driver)
|
179
249
|
disable_wait_for_idle
|
180
250
|
disable_implicit_wait
|
@@ -7,6 +7,20 @@ module TestaAppiumDriver
|
|
7
7
|
include TypeSelectors
|
8
8
|
|
9
9
|
|
10
|
+
|
11
|
+
# @param params [Hash]
|
12
|
+
# @return [TestaAppiumDriver::Locator] first scrollable element
|
13
|
+
def scrollable(params = {})
|
14
|
+
scroll_view(params)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param params [Hash]
|
18
|
+
# @return [TestaAppiumDriver::Locator] first scrollable element
|
19
|
+
def scrollables(params = {})
|
20
|
+
scroll_views(params)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
10
24
|
def handle_testa_opts
|
11
25
|
if @testa_opts[:default_find_strategy].nil?
|
12
26
|
@default_find_strategy = DEFAULT_IOS_FIND_STRATEGY
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'locator/attributes'
|
2
2
|
|
3
3
|
module TestaAppiumDriver
|
4
|
-
#noinspection RubyTooManyInstanceVariablesInspection
|
5
4
|
class Locator
|
6
5
|
include TypeSelectors
|
7
6
|
|
@@ -24,15 +23,21 @@ module TestaAppiumDriver
|
|
24
23
|
end
|
25
24
|
|
26
25
|
|
27
|
-
|
26
|
+
# @return [Array] returns 2 elements. The first is the resolved find element strategy and the second is the resolved selector
|
27
|
+
def strategies_and_selectors
|
28
|
+
ss = []
|
28
29
|
if @can_use_id_strategy
|
29
|
-
|
30
|
+
ss.push({"#{FIND_STRATEGY_NAME}": @can_use_id_strategy})
|
30
31
|
end
|
31
|
-
|
32
|
+
|
33
|
+
ss.push({"#{FIND_STRATEGY_XPATH}": @xpath_selector}) if @strategy.nil? || @strategy == FIND_STRATEGY_XPATH
|
34
|
+
ss.push({"#{FIND_STRATEGY_IMAGE}": @image_selector}) if @strategy == FIND_STRATEGY_IMAGE
|
35
|
+
ss
|
32
36
|
end
|
33
37
|
|
34
38
|
|
35
|
-
|
39
|
+
|
40
|
+
# @return [Locator] new child locator element
|
36
41
|
def add_child_selector(params)
|
37
42
|
params, selectors = extract_selectors_from_params(params)
|
38
43
|
single = params[:single]
|
@@ -111,19 +111,6 @@ module TestaAppiumDriver
|
|
111
111
|
end
|
112
112
|
|
113
113
|
|
114
|
-
# @param params [Hash]
|
115
|
-
# @return [TestaAppiumDriver::Locator] first scrollable element
|
116
|
-
def scrollable(params = {})
|
117
|
-
scroll_view(params)
|
118
|
-
end
|
119
|
-
|
120
|
-
# @param params [Hash]
|
121
|
-
# @return [TestaAppiumDriver::Locator] first scrollable element
|
122
|
-
def scrollables(params = {})
|
123
|
-
scroll_views(params)
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
114
|
# @return [TestaAppiumDriver::Locator]
|
128
115
|
def scroll_view(params = {})
|
129
116
|
params[:type] = "XCUIElementTypeScrollView"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TestaAppiumDriver
|
4
|
-
VERSION = "0.1.
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TestaAppiumDriver
|
4
|
+
VERSION = "0.1.7"
|
5
|
+
end
|
data/testa_appium_driver.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
33
|
spec.add_runtime_dependency "appium_lib_core", ["= 4.7.0"]
|
34
|
-
spec.add_runtime_dependency "json", ["
|
34
|
+
spec.add_runtime_dependency "json", ["~> 2.3"]
|
35
35
|
|
36
36
|
spec.add_development_dependency "rubocop", ["= 1.19.0"]
|
37
37
|
spec.add_development_dependency "rake", ["~> 13.0"]
|
data/testa_appium_driver.iml
CHANGED
@@ -11,12 +11,12 @@
|
|
11
11
|
<orderEntry type="sourceFolder" forTests="false" />
|
12
12
|
<orderEntry type="library" scope="PROVIDED" name="appium_lib_core (v4.7.0, ruby-2.6.5-p114) [gem]" level="application" />
|
13
13
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, ruby-2.6.5-p114) [gem]" level="application" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.24, ruby-2.6.5-p114) [gem]" level="application" />
|
15
15
|
<orderEntry type="library" scope="PROVIDED" name="childprocess (v3.0.0, ruby-2.6.5-p114) [gem]" level="application" />
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, ruby-2.6.5-p114) [gem]" level="application" />
|
17
17
|
<orderEntry type="library" scope="PROVIDED" name="eventmachine (v1.2.7, ruby-2.6.5-p114) [gem]" level="application" />
|
18
18
|
<orderEntry type="library" scope="PROVIDED" name="faye-websocket (v0.11.1, ruby-2.6.5-p114) [gem]" level="application" />
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="json (v2.1
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.5.1, ruby-2.6.5-p114) [gem]" level="application" />
|
20
20
|
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.20.1, ruby-2.6.5-p114) [gem]" level="application" />
|
21
21
|
<orderEntry type="library" scope="PROVIDED" name="parser (v3.0.2.0, ruby-2.6.5-p114) [gem]" level="application" />
|
22
22
|
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, ruby-2.6.5-p114) [gem]" level="application" />
|
@@ -28,8 +28,8 @@
|
|
28
28
|
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, ruby-2.6.5-p114) [gem]" level="application" />
|
29
29
|
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, ruby-2.6.5-p114) [gem]" level="application" />
|
30
30
|
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, ruby-2.6.5-p114) [gem]" level="application" />
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.20.0, ruby-2.6.5-p114) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.11.0, ruby-2.6.5-p114) [gem]" level="application" />
|
33
33
|
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, ruby-2.6.5-p114) [gem]" level="application" />
|
34
34
|
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, ruby-2.6.5-p114) [gem]" level="application" />
|
35
35
|
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v3.142.7, ruby-2.6.5-p114) [gem]" level="application" />
|
@@ -39,7 +39,41 @@
|
|
39
39
|
</component>
|
40
40
|
<component name="RakeTasksCache">
|
41
41
|
<option name="myRootTask">
|
42
|
-
<RakeTaskImpl id="rake"
|
42
|
+
<RakeTaskImpl id="rake">
|
43
|
+
<subtasks>
|
44
|
+
<RakeTaskImpl description="Build testa_appium_driver-0.1.5.gem into the pkg directory" fullCommand="build" id="build" />
|
45
|
+
<RakeTaskImpl id="build">
|
46
|
+
<subtasks>
|
47
|
+
<RakeTaskImpl description="Generate SHA512 checksum if testa_appium_driver-0.1.5.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
48
|
+
</subtasks>
|
49
|
+
</RakeTaskImpl>
|
50
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
51
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
52
|
+
<RakeTaskImpl description="Build and install testa_appium_driver-0.1.5.gem into system gems" fullCommand="install" id="install" />
|
53
|
+
<RakeTaskImpl id="install">
|
54
|
+
<subtasks>
|
55
|
+
<RakeTaskImpl description="Build and install testa_appium_driver-0.1.5.gem into system gems without network access" fullCommand="install:local" id="local" />
|
56
|
+
</subtasks>
|
57
|
+
</RakeTaskImpl>
|
58
|
+
<RakeTaskImpl description="Create tag v0.1.5 and build and push testa_appium_driver-0.1.5.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
59
|
+
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
60
|
+
<RakeTaskImpl id="rubocop">
|
61
|
+
<subtasks>
|
62
|
+
<RakeTaskImpl description="Auto-correct RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
|
63
|
+
</subtasks>
|
64
|
+
</RakeTaskImpl>
|
65
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
66
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
67
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
68
|
+
<RakeTaskImpl id="release">
|
69
|
+
<subtasks>
|
70
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
71
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
72
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
73
|
+
</subtasks>
|
74
|
+
</RakeTaskImpl>
|
75
|
+
</subtasks>
|
76
|
+
</RakeTaskImpl>
|
43
77
|
</option>
|
44
78
|
</component>
|
45
79
|
</module>
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- karlo.razumovic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appium_lib_core
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.3
|
33
|
+
version: '2.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.3
|
40
|
+
version: '2.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- ".idea/inspectionProfiles/Project_Default.xml"
|
81
81
|
- ".idea/misc.xml"
|
82
82
|
- ".idea/modules.xml"
|
83
|
+
- ".idea/runConfigurations.xml"
|
83
84
|
- ".idea/runConfigurations/Android_Test.xml"
|
84
85
|
- ".idea/sshConfigs.xml"
|
85
86
|
- ".idea/vcs.xml"
|