testa_appium_driver 0.1.11 → 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 +16 -16
- 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/Gemfile.lock +74 -0
- data/LICENSE.txt +21 -21
- data/README.md +402 -378
- data/Rakefile +12 -12
- data/{testa_appium_driver.iml → appium-driver.iml} +71 -78
- data/bin/console +17 -17
- data/bin/setup +8 -8
- data/lib/testa_appium_driver/android/class_selectors.rb +437 -437
- data/lib/testa_appium_driver/android/driver.rb +70 -69
- data/lib/testa_appium_driver/android/locator/attributes.rb +117 -113
- data/lib/testa_appium_driver/android/locator.rb +141 -141
- data/lib/testa_appium_driver/android/scroll_actions/uiautomator_scroll_actions.rb +61 -61
- data/lib/testa_appium_driver/android/selenium_element.rb +11 -7
- data/lib/testa_appium_driver/common/bounds.rb +149 -149
- data/lib/testa_appium_driver/common/constants.rb +37 -36
- data/lib/testa_appium_driver/common/exceptions/strategy_mix_exception.rb +11 -11
- data/lib/testa_appium_driver/common/helpers.rb +270 -270
- data/lib/testa_appium_driver/common/locator/scroll_actions.rb +397 -397
- data/lib/testa_appium_driver/common/locator.rb +627 -610
- data/lib/testa_appium_driver/common/scroll_actions/json_wire_scroll_actions.rb +3 -3
- data/lib/testa_appium_driver/common/scroll_actions/w3c_scroll_actions.rb +304 -237
- data/lib/testa_appium_driver/common/scroll_actions.rb +253 -246
- data/lib/testa_appium_driver/common/selenium_element.rb +19 -19
- data/lib/testa_appium_driver/driver.rb +328 -312
- data/lib/testa_appium_driver/ios/driver.rb +48 -48
- data/lib/testa_appium_driver/ios/locator/attributes.rb +84 -80
- data/lib/testa_appium_driver/ios/locator.rb +71 -70
- data/lib/testa_appium_driver/ios/selenium_element.rb +6 -6
- data/lib/testa_appium_driver/ios/type_selectors.rb +187 -187
- data/lib/testa_appium_driver/version.rb +5 -5
- data/lib/testa_appium_driver.rb +6 -6
- data/testa_appium_driver.gemspec +41 -41
- metadata +9 -16
- 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
@@ -1,312 +1,328 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'em/pure_ruby'
|
4
|
-
require 'appium_lib_core'
|
5
|
-
|
6
|
-
require_relative 'common/bounds'
|
7
|
-
require_relative 'common/exceptions/strategy_mix_exception'
|
8
|
-
require_relative 'common/helpers'
|
9
|
-
require_relative 'common/locator'
|
10
|
-
require_relative 'common/scroll_actions'
|
11
|
-
require_relative 'common/selenium_element'
|
12
|
-
|
13
|
-
module TestaAppiumDriver
|
14
|
-
class Driver
|
15
|
-
include Helpers
|
16
|
-
|
17
|
-
# @return [::Appium::Core::Base::Driver] the ruby_lib_core appium driver
|
18
|
-
attr_accessor :driver
|
19
|
-
|
20
|
-
# @return [String] iOS or Android
|
21
|
-
attr_reader :device
|
22
|
-
|
23
|
-
# @return [String] driver automation name (uiautomator2 or xcuitest)
|
24
|
-
attr_reader :automation_name
|
25
|
-
|
26
|
-
# custom options
|
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
|
29
|
-
def initialize(opts = {})
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@
|
35
|
-
@automation_name =
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
# last
|
67
|
-
#
|
68
|
-
# @param [
|
69
|
-
# @param [
|
70
|
-
# @param [
|
71
|
-
# @
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
execute_result = from_element.
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
@default_find_image_settings
|
175
|
-
|
176
|
-
@default_find_image_settings[:
|
177
|
-
@default_find_image_settings[:
|
178
|
-
@default_find_image_settings[:
|
179
|
-
@default_find_image_settings[:
|
180
|
-
|
181
|
-
@
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
def
|
196
|
-
@driver.
|
197
|
-
end
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
def
|
205
|
-
@driver.
|
206
|
-
end
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#require 'em/pure_ruby'
|
4
|
+
require 'appium_lib_core'
|
5
|
+
|
6
|
+
require_relative 'common/bounds'
|
7
|
+
require_relative 'common/exceptions/strategy_mix_exception'
|
8
|
+
require_relative 'common/helpers'
|
9
|
+
require_relative 'common/locator'
|
10
|
+
require_relative 'common/scroll_actions'
|
11
|
+
require_relative 'common/selenium_element'
|
12
|
+
|
13
|
+
module TestaAppiumDriver
|
14
|
+
class Driver
|
15
|
+
include Helpers
|
16
|
+
|
17
|
+
# @return [::Appium::Core::Base::Driver] the ruby_lib_core appium driver
|
18
|
+
attr_accessor :driver
|
19
|
+
|
20
|
+
# @return [String] iOS or Android
|
21
|
+
attr_reader :device
|
22
|
+
|
23
|
+
# @return [String] driver automation name (uiautomator2 or xcuitest)
|
24
|
+
attr_reader :automation_name
|
25
|
+
|
26
|
+
# custom options
|
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
|
29
|
+
def initialize(opts = {})
|
30
|
+
|
31
|
+
@testa_opts = opts[:testa_appium_driver] || {}
|
32
|
+
|
33
|
+
core = Appium::Core.for(opts)
|
34
|
+
@driver = core.start_driver
|
35
|
+
@automation_name = @driver.capabilities["automationName"].downcase.to_sym
|
36
|
+
@device = @driver.capabilities.platform_name.downcase.to_sym
|
37
|
+
|
38
|
+
extend_for(@device, @automation_name)
|
39
|
+
|
40
|
+
handle_testa_opts
|
41
|
+
|
42
|
+
invalidate_cache
|
43
|
+
|
44
|
+
#disable_wait_for_idle
|
45
|
+
#disable_implicit_wait
|
46
|
+
|
47
|
+
::Appium::Core::Element.set_driver(self, @driver.capabilities["udid"])
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
# invalidates current find_element cache
|
52
|
+
def invalidate_cache
|
53
|
+
@cache = {
|
54
|
+
strategy: nil,
|
55
|
+
selector: nil,
|
56
|
+
element: nil,
|
57
|
+
from_element: nil,
|
58
|
+
time: Time.at(0)
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
# Executes the find_element with the resolved locator strategy and selector. Find_element might be skipped if cache is hit.
|
66
|
+
# Cache stores last executed find_element with given selector, strategy and from_element. If given values are the same within
|
67
|
+
# last 5 seconds element is retrieved from cache.
|
68
|
+
# @param [TestaAppiumDriver::Locator, TestaAppiumDriver::Driver] from_element element from which start the search
|
69
|
+
# @param [Boolean] single fetch single or multiple results
|
70
|
+
# @param [Array<Hash>] strategies_and_selectors array of usable strategies and selectors
|
71
|
+
# @param [Boolean] skip_cache to skip checking and storing cache
|
72
|
+
# @return [Selenium::WebDriver::Element, Array] element is returned if single is true, array otherwise
|
73
|
+
def execute(from_element, single, strategies_and_selectors, skip_cache: false, ignore_implicit_wait: false)
|
74
|
+
|
75
|
+
# if user wants to wait for element to exist, he can use wait_until_present
|
76
|
+
start_time = Time.now.to_f
|
77
|
+
ss_index = 0
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
# resolve from_element unique id, so that we can cache it properly
|
83
|
+
from_element_id = from_element.instance_of?(TestaAppiumDriver::Locator) ? from_element.strategies_and_selectors : nil
|
84
|
+
|
85
|
+
begin
|
86
|
+
begin
|
87
|
+
ss = strategies_and_selectors[ss_index % strategies_and_selectors.count]
|
88
|
+
rescue ZeroDivisionError
|
89
|
+
puts "aa"
|
90
|
+
end
|
91
|
+
ss_index +=1
|
92
|
+
|
93
|
+
puts "Executing #{from_element_id ? "from #{from_element.strategy}: #{from_element.strategies_and_selectors} => " : ""}#{ss.keys[0]}: #{ss.values[0]}"
|
94
|
+
|
95
|
+
if @cache[:selector] != ss.values[0] || # cache miss, selector is different
|
96
|
+
@cache[:time] + 5 <= Time.now || # cache miss, older than 5 seconds
|
97
|
+
@cache[:strategy] != ss.keys[0] || # cache miss, different find strategy
|
98
|
+
@cache[:from_element_id] != from_element_id || # cache miss, search is started from different element
|
99
|
+
skip_cache # cache is skipped
|
100
|
+
|
101
|
+
if ss.keys[0] == FIND_STRATEGY_IMAGE
|
102
|
+
set_find_by_image_settings(ss.values[0].dup)
|
103
|
+
if single
|
104
|
+
execute_result = from_element.find_element_by_image(ss.values[0][:image])
|
105
|
+
else
|
106
|
+
execute_result = from_element.find_elements_by_image(ss.values[0][:image])
|
107
|
+
end
|
108
|
+
restore_set_by_image_settings
|
109
|
+
else
|
110
|
+
if single
|
111
|
+
execute_result = from_element.find_element(ss)
|
112
|
+
else
|
113
|
+
execute_result = from_element.find_elements(ss)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
unless skip_cache
|
120
|
+
@cache[:selector] = ss.values[0]
|
121
|
+
@cache[:strategy] = ss.keys[0]
|
122
|
+
@cache[:time] = Time.now
|
123
|
+
@cache[:from_element_id] = from_element_id
|
124
|
+
@cache[:element] = execute_result
|
125
|
+
end
|
126
|
+
else
|
127
|
+
# this is a cache hit, use the element from cache
|
128
|
+
execute_result = @cache[:element]
|
129
|
+
puts "Using cache from #{@cache[:time].strftime("%H:%M:%S.%L")}, strategy: #{@cache[:strategy]}"
|
130
|
+
end
|
131
|
+
rescue => e
|
132
|
+
#if (start_time + @implicit_wait_ms/1000 < Time.now.to_f && !ignore_implicit_wait) || ss_index < strategies_and_selectors.count
|
133
|
+
if ss_index < strategies_and_selectors.count
|
134
|
+
sleep EXISTS_WAIT if ss_index >= strategies_and_selectors.count
|
135
|
+
retry
|
136
|
+
else
|
137
|
+
raise e
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
execute_result
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
# method missing is used to forward methods to the actual appium driver
|
146
|
+
# after the method is executed, find element cache is invalidated
|
147
|
+
def method_missing(method, *args, &block)
|
148
|
+
r = @driver.send(method, *args, &block)
|
149
|
+
invalidate_cache
|
150
|
+
r
|
151
|
+
end
|
152
|
+
|
153
|
+
# disables implicit wait
|
154
|
+
def disable_implicit_wait
|
155
|
+
@implicit_wait_ms = @driver.get_timeouts["implicit"].to_i
|
156
|
+
@implicit_wait_ms = @implicit_wait_ms/1000 if @implicit_wait_ms > 100000
|
157
|
+
@implicit_wait_uiautomator_ms = @driver.get_settings["waitForSelectorTimeout"]
|
158
|
+
@driver.manage.timeouts.implicit_wait = 0
|
159
|
+
@driver.update_settings({waitForSelectorTimeout: 0})
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
# disables wait for idle, only executed for android devices
|
164
|
+
def disable_wait_for_idle
|
165
|
+
if @device == :android
|
166
|
+
@wait_for_idle_timeout = @driver.settings.get["waitForIdleTimeout"]
|
167
|
+
@driver.update_settings({waitForIdleTimeout: 0})
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
def set_find_by_image_settings(settings)
|
173
|
+
settings.delete(:image)
|
174
|
+
@default_find_image_settings = {}
|
175
|
+
old_settings = @driver.get_settings
|
176
|
+
@default_find_image_settings[:imageMatchThreshold] = old_settings["imageMatchThreshold"]
|
177
|
+
@default_find_image_settings[:fixImageFindScreenshotDims] = old_settings["fixImageFindScreenshotDims"]
|
178
|
+
@default_find_image_settings[:fixImageTemplateSize] = old_settings["fixImageTemplateSize"]
|
179
|
+
@default_find_image_settings[:fixImageTemplateScale] = old_settings["fixImageTemplateScale"]
|
180
|
+
@default_find_image_settings[:defaultImageTemplateScale] = old_settings["defaultImageTemplateScale"]
|
181
|
+
@default_find_image_settings[:checkForImageElementStaleness] = old_settings["checkForImageElementStaleness"]
|
182
|
+
@default_find_image_settings[:autoUpdateImageElementPosition] = old_settings["autoUpdateImageElementPosition"]
|
183
|
+
@default_find_image_settings[:imageElementTapStrategy] = old_settings["imageElementTapStrategy"]
|
184
|
+
@default_find_image_settings[:getMatchedImageResult] = old_settings["getMatchedImageResult"]
|
185
|
+
|
186
|
+
@driver.update_settings(settings)
|
187
|
+
end
|
188
|
+
|
189
|
+
def restore_set_by_image_settings
|
190
|
+
@driver.update_settings(@default_find_image_settings) if @default_find_image_settings
|
191
|
+
end
|
192
|
+
|
193
|
+
|
194
|
+
# @@return [String] current package under test
|
195
|
+
def current_package
|
196
|
+
@driver.current_package
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
def window_size
|
201
|
+
@driver.window_size
|
202
|
+
end
|
203
|
+
|
204
|
+
def back
|
205
|
+
@driver.back
|
206
|
+
end
|
207
|
+
|
208
|
+
|
209
|
+
def is_keyboard_shown?
|
210
|
+
@driver.is_keyboard_shown
|
211
|
+
end
|
212
|
+
|
213
|
+
def hide_keyboard
|
214
|
+
@driver.hide_keyboard
|
215
|
+
end
|
216
|
+
|
217
|
+
def home_key
|
218
|
+
@driver.press_keycode(3)
|
219
|
+
end
|
220
|
+
def tab_key
|
221
|
+
@driver.press_keycode(61)
|
222
|
+
end
|
223
|
+
|
224
|
+
def dpad_up_key
|
225
|
+
@driver.press_keycode(19)
|
226
|
+
end
|
227
|
+
|
228
|
+
def dpad_down_key
|
229
|
+
@driver.press_keycode(20)
|
230
|
+
end
|
231
|
+
|
232
|
+
def dpad_right_key
|
233
|
+
@driver.press_keycode(22)
|
234
|
+
end
|
235
|
+
|
236
|
+
def dpad_left_key
|
237
|
+
@driver.press_keycode(23)
|
238
|
+
end
|
239
|
+
|
240
|
+
def enter_key
|
241
|
+
@driver.press_keycode(66)
|
242
|
+
end
|
243
|
+
|
244
|
+
def press_keycode(code)
|
245
|
+
@driver.press_keycode(code)
|
246
|
+
end
|
247
|
+
|
248
|
+
def long_press_keycode(code)
|
249
|
+
@driver.long_press_keycode(code)
|
250
|
+
end
|
251
|
+
|
252
|
+
def click(x, y, double: false)
|
253
|
+
ws = driver.window_size
|
254
|
+
window_width = ws.width.to_i
|
255
|
+
window_height = ws.height.to_i
|
256
|
+
if x.kind_of?(Integer)
|
257
|
+
if x < 0
|
258
|
+
x = window_width + x
|
259
|
+
end
|
260
|
+
elsif x.kind_of?(Float) && x <= 1.0 && x >= 0
|
261
|
+
x = window_width*x
|
262
|
+
else
|
263
|
+
raise "x value #{x} not supported. Use integer as pixel or float (0..1) as percentage of screen"
|
264
|
+
end
|
265
|
+
|
266
|
+
if y.kind_of?(Integer)
|
267
|
+
if y < 0
|
268
|
+
y = window_height + y
|
269
|
+
end
|
270
|
+
elsif y.kind_of?(Float) && y <= 1.0 && y >= 0
|
271
|
+
y = window_height*y
|
272
|
+
else
|
273
|
+
raise "y value #{x} not supported. Use integer as pixel or float (0..1) as percentage of screen"
|
274
|
+
end
|
275
|
+
|
276
|
+
|
277
|
+
action_builder = @driver.action
|
278
|
+
f1 = action_builder.add_pointer_input(:touch, "finger1")
|
279
|
+
f1.create_pointer_move(duration: 0, x: x, y: y, origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
|
280
|
+
f1.create_pointer_down(:left)
|
281
|
+
f1.create_pointer_up(:left)
|
282
|
+
if double
|
283
|
+
f1.create_pause(0.1)
|
284
|
+
f1.create_pointer_down(:left)
|
285
|
+
f1.create_pointer_up(:left)
|
286
|
+
end
|
287
|
+
@driver.perform_actions [f1]
|
288
|
+
end
|
289
|
+
|
290
|
+
def double_click(x,y)
|
291
|
+
click(x,y, double: true)
|
292
|
+
end
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
# @return [Array<Selenium::WebDriver::Element] array of 2 elements, the first element without children and the last element without children in the current page
|
297
|
+
def first_and_last_leaf(from_element = @driver)
|
298
|
+
elements = from_element.find_elements(xpath: ".//*[not(*)]")
|
299
|
+
return nil if elements.count == 0
|
300
|
+
[elements[0], elements[-1]]
|
301
|
+
end
|
302
|
+
|
303
|
+
private
|
304
|
+
def extend_for(device, automation_name)
|
305
|
+
case device
|
306
|
+
when :android
|
307
|
+
case automation_name
|
308
|
+
when :uiautomator2, :espresso, :Espresso
|
309
|
+
require_relative 'android/driver'
|
310
|
+
else
|
311
|
+
raise "Testa appium driver not supported for #{automation_name} automation"
|
312
|
+
end
|
313
|
+
when :ios, :tvos
|
314
|
+
case automation_name
|
315
|
+
when :xcuitest
|
316
|
+
require_relative 'ios/driver'
|
317
|
+
else
|
318
|
+
raise "Testa appium driver not supported for #{automation_name} automation"
|
319
|
+
end
|
320
|
+
else
|
321
|
+
raise "Unknown device #{device}, should be either android, ios or tvos"
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
|
326
|
+
end
|
327
|
+
|
328
|
+
end
|