testa_appium_driver 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '091ff22c4f74ee0e70238adf6d044b93d7b989954c8080b8d7e289d917fe6986'
4
- data.tar.gz: ce33cac99f7631febd8c362e0b74160e29180a4271ab0218c6932757736601e8
3
+ metadata.gz: ae8c1d10792a04508f11afa6d0b58380d60ba4f079eba2caed9707a5ae036e95
4
+ data.tar.gz: 47b0ca0facbc1cccaddc5a5efd4c2bcadd53f4ac4e8a66f6b4c2f89334cca8ee
5
5
  SHA512:
6
- metadata.gz: b5981dc66c90872097718763169e90e717edeafaae3f551785be38e01dc0594d81f771269873042ed998ad5733267db6d0ac74749e00287fd275895a7dab84f5
7
- data.tar.gz: 62cb8fa7ed7405a8c0a36fbefab4c304520316286428e61ae3380b918ac65e189aa71cb7ab67552a2798b099f75771ecde55f32b1587ee082f33f9a30a3c6bf8
6
+ metadata.gz: 62cf8d80a49626ffc88709afde4f408c535e53a25352058a36476c3b9791792b0f5cf17d45e3ac52c228b10909c4e67093c94d5dd6347147e3dce398b7cc18f4
7
+ data.tar.gz: 265b1b055eec368481790df7c50c78b9f803dbd64286d50b60e37fbe1b8bba6a004f9dadf0c07a6fa688f3ce19c0ba190b914aff97296c19214cbfa10b9be0c0
data/.idea/deployment.xml CHANGED
@@ -5,7 +5,7 @@
5
5
  <paths name="supertesta.com">
6
6
  <serverdata>
7
7
  <mappings>
8
- <mapping local="$PROJECT_DIR$" web="/" />
8
+ <mapping deploy="/testa_docker/path_data/testa_appium_driver" local="$PROJECT_DIR$" web="/" />
9
9
  </mappings>
10
10
  </serverdata>
11
11
  </paths>
@@ -20,12 +20,14 @@ module TestaAppiumDriver
20
20
  end
21
21
  end
22
22
 
23
+ # first element that match given selectors
23
24
  # @param selectors [Hash]
24
25
  # @return [TestaAppiumDriver::Locator] first element
25
26
  def element(selectors = {})
26
27
  add_selector(selectors)
27
28
  end
28
29
 
30
+ # all elements that match given selectors
29
31
  # @param params [Hash]
30
32
  # @return [TestaAppiumDriver::Locator] all elements that match given selectors
31
33
  def elements(params = {})
@@ -34,6 +36,7 @@ module TestaAppiumDriver
34
36
  end
35
37
 
36
38
 
39
+ # first element that has scrollable: true
37
40
  # @param selectors [Hash]
38
41
  # @return [TestaAppiumDriver::Locator] first scrollable element
39
42
  def scrollable(selectors = {})
@@ -41,6 +44,7 @@ module TestaAppiumDriver
41
44
  add_selector(selectors)
42
45
  end
43
46
 
47
+ # all elements that have scrollable: true
44
48
  # @param params [Hash]
45
49
  # @return [TestaAppiumDriver::Locator] first scrollable element
46
50
  def scrollables(params = {})
@@ -50,12 +54,14 @@ module TestaAppiumDriver
50
54
  end
51
55
 
52
56
 
57
+ # first android.widget.ImageView element that match given selectors
53
58
  # @return [TestaAppiumDriver::Locator]
54
59
  def image_view(params = {})
55
60
  params[:class] = "android.widget.ImageView"
56
61
  add_selector(params)
57
62
  end
58
63
 
64
+ # all android.widget.ImageView elements that match given selectors
59
65
  # @return [TestaAppiumDriver::Locator]
60
66
  def image_views(params = {})
61
67
  params[:class] = "android.widget.ImageView"
@@ -63,12 +69,14 @@ module TestaAppiumDriver
63
69
  add_selector(params)
64
70
  end
65
71
 
72
+ # first android.widget.FrameLayout element that match given selectors
66
73
  # @return [TestaAppiumDriver::Locator]
67
74
  def frame_layout(params = {})
68
75
  params[:class] = "android.widget.FrameLayout"
69
76
  add_selector(params)
70
77
  end
71
78
 
79
+ # all android.widget.FrameLayout elements that match given selectors
72
80
  # @return [TestaAppiumDriver::Locator]
73
81
  def frame_layouts(params = {})
74
82
  params[:class] = "android.widget.FrameLayout"
@@ -76,12 +84,14 @@ module TestaAppiumDriver
76
84
  add_selector(params)
77
85
  end
78
86
 
87
+ # first android.widget.LinearLayout element that match given selectors
79
88
  # @return [TestaAppiumDriver::Locator]
80
89
  def linear_layout(params = {})
81
90
  params[:class] = "android.widget.LinearLayout"
82
91
  add_selector(params)
83
92
  end
84
93
 
94
+ # all android.widget.LinearLayout elements that match given selectors
85
95
  # @return [TestaAppiumDriver::Locator]
86
96
  def linear_layouts(params = {})
87
97
  params[:class] = "android.widget.LinearLayout"
@@ -89,12 +99,14 @@ module TestaAppiumDriver
89
99
  add_selector(params)
90
100
  end
91
101
 
102
+ # first android.view.View element that match given selectors
92
103
  # @return [TestaAppiumDriver::Locator]
93
104
  def view(params = {})
94
105
  params[:class] = "android.view.View"
95
106
  add_selector(params)
96
107
  end
97
108
 
109
+ # all android.view.View elements that match given selectors
98
110
  # @return [TestaAppiumDriver::Locator]
99
111
  def views(params = {})
100
112
  params[:class] = "android.view.View"
@@ -102,12 +114,14 @@ module TestaAppiumDriver
102
114
  add_selector(params)
103
115
  end
104
116
 
117
+ # first android.widget.EditText element that match given selectors
105
118
  # @return [TestaAppiumDriver::Locator]
106
119
  def edit_text(params = {})
107
120
  params[:class] = "android.widget.EditText"
108
121
  add_selector(params)
109
122
  end
110
123
 
124
+ # all android.widget.EditText elements that match given selectors
111
125
  # @return [TestaAppiumDriver::Locator]
112
126
  def edit_texts(params = {})
113
127
  params[:class] = "android.widget.EditText"
@@ -115,12 +129,14 @@ module TestaAppiumDriver
115
129
  add_selector(params)
116
130
  end
117
131
 
132
+ # first android.widget.ViewGroup element that match given selectors
118
133
  # @return [TestaAppiumDriver::Locator]
119
134
  def view_group(params = {})
120
135
  params[:class] = "android.widget.ViewGroup"
121
136
  add_selector(params)
122
137
  end
123
138
 
139
+ # all android.widget.ViewGroup elements that match given selectors
124
140
  # @return [TestaAppiumDriver::Locator]
125
141
  def view_groups(params = {})
126
142
  params[:class] = "android.widget.ViewGroup"
@@ -128,12 +144,14 @@ module TestaAppiumDriver
128
144
  add_selector(params)
129
145
  end
130
146
 
147
+ # first android.widget.RelativeLayout element that match given selecotrs
131
148
  # @return [TestaAppiumDriver::Locator]
132
149
  def relative_layout(params = {})
133
150
  params[:class] = "android.widget.RelativeLayout"
134
151
  add_selector(params)
135
152
  end
136
153
 
154
+ # all android.widget.RelativeLayout elements that match given selectors
137
155
  # @return [TestaAppiumDriver::Locator]
138
156
  def relative_layouts(params = {})
139
157
  params[:class] = "android.widget.RelativeLayout"
@@ -141,12 +159,14 @@ module TestaAppiumDriver
141
159
  add_selector(params)
142
160
  end
143
161
 
162
+ # first androidx.recyclerview.widget.RecyclerView element that match given selectors
144
163
  # @return [TestaAppiumDriver::Locator]
145
164
  def recycler_view(params = {})
146
165
  params[:class] = "androidx.recyclerview.widget.RecyclerView"
147
166
  add_selector(params)
148
167
  end
149
168
 
169
+ # all androidx.recyclerview.widget.RecyclerView elements that match given selectors
150
170
  # @return [TestaAppiumDriver::Locator]
151
171
  def recycler_views(params = {})
152
172
  params[:class] = "androidx.recyclerview.widget.RecyclerView"
@@ -154,12 +174,14 @@ module TestaAppiumDriver
154
174
  add_selector(params)
155
175
  end
156
176
 
177
+ # first android.widget.Button element that match given selectors
157
178
  # @return [TestaAppiumDriver::Locator]
158
179
  def button(params = {})
159
180
  params[:class] = "android.widget.Button"
160
181
  add_selector(params)
161
182
  end
162
183
 
184
+ # all android.widget.Button elements that match given selectors
163
185
  # @return [TestaAppiumDriver::Locator]
164
186
  def buttons(params = {})
165
187
  params[:class] = "android.widget.Button"
@@ -167,12 +189,14 @@ module TestaAppiumDriver
167
189
  add_selector(params)
168
190
  end
169
191
 
192
+ # first android.widget.ImageButton element that match given selectors
170
193
  # @return [TestaAppiumDriver::Locator]
171
194
  def image_button(params = {})
172
195
  params[:class] = "android.widget.ImageButton"
173
196
  add_selector(params)
174
197
  end
175
198
 
199
+ # all android.widget.ImageButton elements that match given selectors
176
200
  # @return [TestaAppiumDriver::Locator]
177
201
  def image_buttons(params = {})
178
202
  params[:class] = "android.widget.ImageButton"
@@ -180,12 +204,14 @@ module TestaAppiumDriver
180
204
  add_selector(params)
181
205
  end
182
206
 
207
+ # first android.widget.HorizontalScrollView element that match given selectors
183
208
  # @return [TestaAppiumDriver::Locator]
184
209
  def horizontal_scroll_view(params = {})
185
210
  params[:class] = "android.widget.HorizontalScrollView"
186
211
  add_selector(params)
187
212
  end
188
213
 
214
+ # all android.widget.HorizontalScrollView elements that match given selectors
189
215
  # @return [TestaAppiumDriver::Locator]
190
216
  def horizontal_scroll_views(params = {})
191
217
  params[:class] = "android.widget.HorizontalScrollView"
@@ -193,12 +219,14 @@ module TestaAppiumDriver
193
219
  add_selector(params)
194
220
  end
195
221
 
222
+ # first android.widget.ScrollView element that match given selectors
196
223
  # @return [TestaAppiumDriver::Locator]
197
224
  def scroll_view(params = {})
198
225
  params[:class] = "android.widget.ScrollView"
199
226
  add_selector(params)
200
227
  end
201
228
 
229
+ # all android.widget.ScrollView elements that match given selectors
202
230
  # @return [TestaAppiumDriver::Locator]
203
231
  def scroll_views(params = {})
204
232
  params[:class] = "android.widget.ScrollView"
@@ -206,12 +234,14 @@ module TestaAppiumDriver
206
234
  add_selector(params)
207
235
  end
208
236
 
237
+ # first viewpager.widget.ViewPager element that match given selectors
209
238
  # @return [TestaAppiumDriver::Locator]
210
239
  def view_pager(params = {})
211
240
  params[:class] = "androidx.viewpager.widget.ViewPager"
212
241
  add_selector(params)
213
242
  end
214
243
 
244
+ # all viewpager.widget.ViewPager elements that match given selectors
215
245
  # @return [TestaAppiumDriver::Locator]
216
246
  def view_pagers(params = {})
217
247
  params[:class] = "androidx.viewpager.widget.ViewPager"
@@ -219,12 +249,14 @@ module TestaAppiumDriver
219
249
  add_selector(params)
220
250
  end
221
251
 
252
+ # first android.widget.CheckBox element that match given selectors
222
253
  # @return [TestaAppiumDriver::Locator]
223
254
  def check_box(params = {})
224
255
  params[:class] = "android.widget.CheckBox"
225
256
  add_selector(params)
226
257
  end
227
258
 
259
+ # all android.widget.CheckBox elements that match given selectors
228
260
  # @return [TestaAppiumDriver::Locator]
229
261
  def check_boxes(params = {})
230
262
  params[:class] = "android.widget.CheckBox"
@@ -232,12 +264,14 @@ module TestaAppiumDriver
232
264
  add_selector(params)
233
265
  end
234
266
 
267
+ # first android.widget.ListView element that match given selectors
235
268
  # @return [TestaAppiumDriver::Locator]
236
269
  def list_view(params = {})
237
270
  params[:class] = "android.widget.ListView"
238
271
  add_selector(params)
239
272
  end
240
273
 
274
+ # all android.widget.ListView elements that match given selectors
241
275
  # @return [TestaAppiumDriver::Locator]
242
276
  def list_views(params = {})
243
277
  params[:class] = "android.widget.ListView"
@@ -245,12 +279,14 @@ module TestaAppiumDriver
245
279
  add_selector(params)
246
280
  end
247
281
 
282
+ # first android.widget.ProgressBar element that match given selectors
248
283
  # @return [TestaAppiumDriver::Locator]
249
284
  def progress_bar(params = {})
250
285
  params[:class] = "android.widget.ProgressBar"
251
286
  add_selector(params)
252
287
  end
253
288
 
289
+ # all android.widget.ProgressBar elements that match given selectors
254
290
  # @return [TestaAppiumDriver::Locator]
255
291
  def progress_bars(params = {})
256
292
  params[:class] = "android.widget.ProgressBar"
@@ -258,12 +294,14 @@ module TestaAppiumDriver
258
294
  add_selector(params)
259
295
  end
260
296
 
297
+ # first android.widget.RadioButton element that match given selectors
261
298
  # @return [TestaAppiumDriver::Locator]
262
299
  def radio_button(params = {})
263
300
  params[:class] = "android.widget.RadioButton"
264
301
  add_selector(params)
265
302
  end
266
303
 
304
+ # all android.widget.RadioButton elements that match given selectors
267
305
  # @return [TestaAppiumDriver::Locator]
268
306
  def radio_buttons(params = {})
269
307
  params[:class] = "android.widget.RadioButton"
@@ -271,12 +309,14 @@ module TestaAppiumDriver
271
309
  add_selector(params)
272
310
  end
273
311
 
312
+ # first android.widget.RadioGroup element that match given selectors
274
313
  # @return [TestaAppiumDriver::Locator]
275
314
  def radio_group(params = {})
276
315
  params[:class] = "android.widget.RadioGroup"
277
316
  add_selector(params)
278
317
  end
279
318
 
319
+ # all android.widget.RadioGroup elements that match given selectors
280
320
  # @return [TestaAppiumDriver::Locator]
281
321
  def radio_groups(params = {})
282
322
  params[:class] = "android.widget.RadioGroup"
@@ -284,12 +324,14 @@ module TestaAppiumDriver
284
324
  add_selector(params)
285
325
  end
286
326
 
327
+ # first android.widget.SearchView element that match given selectors
287
328
  # @return [TestaAppiumDriver::Locator]
288
329
  def search_view(params = {})
289
330
  params[:class] = "android.widget.SearchView"
290
331
  add_selector(params)
291
332
  end
292
333
 
334
+ # all android.widget.SearchView elements that match given selectors
293
335
  # @return [TestaAppiumDriver::Locator]
294
336
  def search_views(params = {})
295
337
  params[:class] = "android.widget.SearchView"
@@ -297,12 +339,14 @@ module TestaAppiumDriver
297
339
  add_selector(params)
298
340
  end
299
341
 
342
+ # first android.widget.Spinner element that match given selectors
300
343
  # @return [TestaAppiumDriver::Locator]
301
344
  def spinner(params = {})
302
345
  params[:class] = "android.widget.Spinner"
303
346
  add_selector(params)
304
347
  end
305
348
 
349
+ # all android.widget.Spinner elements that match given selectors
306
350
  # @return [TestaAppiumDriver::Locator]
307
351
  def spinners(params = {})
308
352
  params[:class] = "android.widget.Spinner"
@@ -310,12 +354,14 @@ module TestaAppiumDriver
310
354
  add_selector(params)
311
355
  end
312
356
 
357
+ # first android.widget.Toast element that match given selectors
313
358
  # @return [TestaAppiumDriver::Locator]
314
359
  def toast(params = {})
315
360
  params[:class] = "android.widget.Toast"
316
361
  add_selector(params)
317
362
  end
318
363
 
364
+ # all android.widget.Toast elements that match given selectors
319
365
  # @return [TestaAppiumDriver::Locator]
320
366
  def toasts(params = {})
321
367
  params[:class] = "android.widget.Toast"
@@ -323,12 +369,14 @@ module TestaAppiumDriver
323
369
  add_selector(params)
324
370
  end
325
371
 
372
+ # first android.widget.Toolbar element that match given selectors
326
373
  # @return [TestaAppiumDriver::Locator]
327
374
  def toolbar(params = {})
328
375
  params[:class] = "android.widget.Toolbar"
329
376
  add_selector(params)
330
377
  end
331
378
 
379
+ # all android.widget.Toolbar elements that match given selectors
332
380
  # @return [TestaAppiumDriver::Locator]
333
381
  def toolbars(params = {})
334
382
  params[:class] = "android.widget.Toolbar"
@@ -336,12 +384,14 @@ module TestaAppiumDriver
336
384
  add_selector(params)
337
385
  end
338
386
 
387
+ # first android.widget.TextView element that match given selectors
339
388
  # @return [TestaAppiumDriver::Locator]
340
389
  def text_view(params = {})
341
390
  params[:class] = "android.widget.TextView"
342
391
  add_selector(params)
343
392
  end
344
393
 
394
+ # all android.widget.TextView elements that match given selectors
345
395
  # @return [TestaAppiumDriver::Locator]
346
396
  def text_views(params = {})
347
397
  params[:class] = "android.widget.TextView"
@@ -8,11 +8,11 @@ module TestaAppiumDriver
8
8
  include ClassSelectors
9
9
 
10
10
 
11
+ # executes shell command
11
12
  # @param [String] command Shell command name to execute for example echo or rm
12
13
  # @param [Array<String>] args Array of command arguments, example: ['-f', '/sdcard/my_file.txt']
13
14
  # @param [Integer] timeout Command timeout in milliseconds. If the command blocks for longer than this timeout then an exception is going to be thrown. The default timeout is 20000 ms
14
15
  # @param [Boolean] includeStderr Whether to include stderr stream into the returned result.
15
- #noinspection RubyParameterNamingConvention
16
16
  def shell(command, args: nil, timeout: nil, includeStderr: true)
17
17
  params = {
18
18
  command: command,
@@ -24,6 +24,7 @@ module TestaAppiumDriver
24
24
  end
25
25
 
26
26
 
27
+ private
27
28
  def handle_testa_opts
28
29
  if @testa_opts[:default_find_strategy].nil?
29
30
  @default_find_strategy = DEFAULT_ANDROID_FIND_STRATEGY
@@ -75,7 +75,7 @@ module TestaAppiumDriver
75
75
  end
76
76
 
77
77
 
78
- # @return [Locator] existing locator element
78
+ # @return [Locator] new child locator element
79
79
  def add_child_selector(params)
80
80
  params, selectors = extract_selectors_from_params(params)
81
81
  single = params[:single]
@@ -2,6 +2,7 @@ module TestaAppiumDriver
2
2
  #noinspection RubyTooManyMethodsInspection
3
3
  class Locator
4
4
 
5
+ # performs a long tap on the retrieved element
5
6
  # @param [Float] duration in seconds
6
7
  def long_tap(duration = LONG_TAP_DURATION)
7
8
  action_builder = @driver.action
@@ -15,173 +16,238 @@ module TestaAppiumDriver
15
16
  @driver.perform_actions [f1]
16
17
  end
17
18
 
18
- # @return [Array] array of [Selenium::WebDriver::Element]
19
- def each(deadzone: nil, skip_scroll_to_start: false, &block)
19
+
20
+ # scrolls to the start of the scrollable containers and scrolls to the end,
21
+ # everytime a locator element is found the given block is executed
22
+ # @return [Array<Selenium::WebDriver::Element>]
23
+ def each(top: nil, bottom: nil, right: nil, left: nil, direction: nil, &block)
24
+ deadzone = _process_deadzone(top, bottom, right, left)
20
25
  raise "Each can only be performed on multiple elements locator" if @single
21
26
  deadzone = @scrollable_locator.scroll_deadzone if deadzone.nil? && !@scrollable_locator.nil?
22
27
  sa = ScrollActions.new(@scrollable_locator,
23
28
  locator: self,
24
29
  deadzone: deadzone,
25
30
  default_scroll_strategy: @default_scroll_strategy)
26
- sa.each(skip_scroll_to_start, &block)
31
+ if direction.nil?
32
+ sa.each(&block)
33
+ else
34
+ sa.send("each_#{direction}", &block)
35
+ end
36
+ end
37
+
38
+ # scrolls down from the current page view (without prior scrolling to the top) and
39
+ # everytime a locator element is found the given block is executed
40
+ # @return [Array<Selenium::WebDriver::Element>]
41
+ def each_down(top: nil, bottom: nil, right: nil, left: nil, &block)
42
+ each(top: top, bottom: bottom, right: right, left: left, direction: :down, &block)
43
+ end
44
+
45
+ # scrolls up from the current page view (without prior scrolling to the bottom) and
46
+ # everytime a locator element is found the given block is executed
47
+ # @return [Array<Selenium::WebDriver::Element>]
48
+ def each_up(top: nil, bottom: nil, right: nil, left: nil, &block)
49
+ each(top: top, bottom: bottom, right: right, left: left, direction: :up, &block)
50
+ end
51
+
52
+ # scrolls right from the current page view (without prior scrolling to the left) and
53
+ # everytime a locator element is found the given block is executed
54
+ # @return [Array<Selenium::WebDriver::Element>]
55
+ def each_right(top: nil, bottom: nil, right: nil, left: nil, &block)
56
+ each(top: top, bottom: bottom, right: right, left: left, direction: :right, &block)
57
+ end
58
+
59
+ # scrolls left from the current page view (without prior scrolling to the right) and
60
+ # everytime a locator element is found the given block is executed
61
+ # @return [Array<Selenium::WebDriver::Element>]
62
+ def each_left(top: nil, bottom: nil, right: nil, left: nil, &block)
63
+ each(top: top, bottom: bottom, right: right, left: left, direction: :left, &block)
27
64
  end
28
65
 
29
66
 
30
67
  # Aligns element (by default) on top of the scrollable container, if the element does not exists it will scroll to find it
68
+ # The element is aligned if the the distance from the top/bottom/right/left of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
69
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
70
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
31
71
  # @return [TestaAppiumDriver::Locator]
32
- def align(with = :top, deadzone: nil, raise: false)
72
+ def align(with = :top, top: nil, bottom: nil, right: nil, left: nil, scroll_to_find: false)
33
73
  deadzone = @scrollable_locator.scroll_deadzone if deadzone.nil? && !@scrollable_locator.nil?
34
74
  sa = ScrollActions.new(@scrollable_locator,
35
75
  locator: self,
36
76
  deadzone: deadzone,
37
- default_scroll_strategy: @default_scroll_strategy,
38
- raise: raise)
39
- sa.align(with)
77
+ default_scroll_strategy: @default_scroll_strategy)
78
+ sa.align(with, scroll_to_find)
40
79
  self
41
80
  end
42
81
 
43
82
  # Aligns element on top of the scrollable container, if the element does not exists it will scroll to find it
83
+ # The element is aligned if the the distance from the top of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
84
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
85
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
44
86
  # @return [TestaAppiumDriver::Locator]
45
- def align_top(deadzone: nil)
46
- align(:top, deadzone: deadzone)
87
+ def align_top(top: nil, bottom: nil, right: nil, left: nil)
88
+ align(:top, top: top, bottom: bottom, right: right, left: left)
47
89
  end
48
90
 
49
91
  # Aligns element on bottom of the scrollable container, if the element does not exists it will scroll to find it
92
+ # The element is aligned if the the distance from the bottom of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
93
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
94
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
50
95
  # @return [TestaAppiumDriver::Locator]
51
- def align_bottom(deadzone: nil)
52
- align(:bottom, deadzone: deadzone)
96
+ def align_bottom(top: nil, bottom: nil, right: nil, left: nil)
97
+ align(:bottom, top: top, bottom: bottom, right: right, left: left)
53
98
  end
54
99
 
55
100
  # Aligns element on left of the scrollable container, if the element does not exists it will scroll to find it
101
+ # The element is aligned if the the distance from the left of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
102
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
103
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
56
104
  # @return [TestaAppiumDriver::Locator]
57
- def align_left(deadzone: nil)
58
- align(:left, deadzone: deadzone)
105
+ def align_left(top: nil, bottom: nil, right: nil, left: nil)
106
+ align(:left, top: top, bottom: bottom, right: right, left: left)
59
107
  end
60
108
 
61
109
  # Aligns element on right of the scrollable container, if the element does not exists it will scroll to find it
110
+ # The element is aligned if the the distance from the right of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
111
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
112
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
62
113
  # @return [TestaAppiumDriver::Locator]
63
- def align_right(deadzone: nil)
64
- align(:right, deadzone: deadzone)
114
+ def align_right(top: nil, bottom: nil, right: nil, left: nil)
115
+ align(:right, top: top, bottom: bottom, right: right, left: left)
65
116
  end
66
117
 
67
118
  # Aligns element (by default) on top of the scrollable container, if the element does not exists it raise an exception
119
+ # The element is aligned if the the distance from the top/bottom/right/left of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
120
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
121
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
68
122
  # @return [TestaAppiumDriver::Locator]
69
- def align!(with = :top, deadzone: nil)
70
- align(with, deadzone: deadzone, raise: true)
123
+ def align!(with = :top, top: nil, bottom: nil, right: nil, left: nil)
124
+ align(with, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
71
125
  end
72
126
 
73
127
  # Aligns element on top of the scrollable container, if the element does not exists it raise an exception
128
+ # The element is aligned if the the distance from the top of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
129
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
130
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
74
131
  # @return [TestaAppiumDriver::Locator]
75
- def align_top!(deadzone: nil)
76
- align(:top, deadzone: deadzone, raise: true)
132
+ def align_top!(top: nil, bottom: nil, right: nil, left: nil)
133
+ align(:top, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
77
134
  end
78
135
 
79
136
  # Aligns element on bottom of the scrollable container, if the element does not exists it raise an exception
137
+ # The element is aligned if the the distance from the bottom of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
138
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
139
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
80
140
  # @return [TestaAppiumDriver::Locator]
81
- def align_bottom!(deadzone: nil)
82
- align(:bottom, deadzone: deadzone, raise: true)
141
+ def align_bottom!(top: nil, bottom: nil, right: nil, left: nil)
142
+ align(:bottom, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
83
143
  end
84
144
 
85
145
  # Aligns element on left of the scrollable container, if the element does not exists it raise an exception
146
+ # The element is aligned if the the distance from the left of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
147
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
148
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
86
149
  # @return [TestaAppiumDriver::Locator]
87
- def align_left!(deadzone: nil)
88
- align(:left, deadzone: deadzone, raise: true)
150
+ def align_left!(top: nil, bottom: nil, right: nil, left: nil)
151
+ align(:left, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
89
152
  end
90
153
 
91
154
  # Aligns element on right of the scrollable container, if the element does not exists it raise an exception
155
+ # The element is aligned if the the distance from the right of the scrollable container is less than [TestaAppiumDriver::SCROLL_ALIGNMENT_THRESHOLD]
156
+ # If the distance is greater than the threshold, it will attempt to realign it up to 2 more times.
157
+ # The retry mechanism allows alignment even for dynamic layouts when elements are hidden/show when scrolling to certain direction
92
158
  # @return [TestaAppiumDriver::Locator]
93
- def align_right!(deadzone: nil)
94
- align(:right, deadzone: deadzone, raise: true)
159
+ def align_right!(top: nil, bottom: nil, right: nil, left: nil)
160
+ align(:right, top: top, bottom: bottom, right: right, left: left, scroll_to_find: true)
95
161
  end
96
162
 
97
163
 
98
164
  # First scrolls to the beginning of the scrollable container and then scrolls down until element is found or end is reached
99
165
  # @return [TestaAppiumDriver::Locator]
100
- def scroll_to(deadzone: nil, max_scrolls: nil, direction: nil)
166
+ def scroll_to(top: nil, bottom: nil, right: nil, left: nil, max_scrolls: nil, direction: nil)
101
167
  if direction
102
- _scroll_dir_to(deadzone, max_scrolls, direction)
168
+ _scroll_dir_to(_process_deadzone(top, bottom, right, left), max_scrolls, direction)
103
169
  else
104
- _scroll_to(deadzone, max_scrolls)
170
+ _scroll_to(_process_deadzone(top, bottom, right, left), max_scrolls)
105
171
  end
106
172
  end
107
173
 
108
174
 
109
175
  # Scrolls down until element is found or end is reached
110
176
  # @return [TestaAppiumDriver::Locator]
111
- def scroll_down_to(deadzone: nil, max_scrolls: nil)
112
- _scroll_dir_to(deadzone, max_scrolls, :down)
177
+ def scroll_down_to(top: nil, bottom: nil, right: nil, left: nil, max_scrolls: nil)
178
+ _scroll_dir_to(_process_deadzone(top, bottom, right, left), max_scrolls, :down)
113
179
  end
114
180
 
115
181
  # Scrolls up until element is found or end is reached
116
182
  # @return [TestaAppiumDriver::Locator]
117
- def scroll_up_to(deadzone: nil, max_scrolls: nil)
118
- _scroll_dir_to(deadzone, max_scrolls, :up)
183
+ def scroll_up_to(top: nil, bottom: nil, right: nil, left: nil, max_scrolls: nil)
184
+ _scroll_dir_to(_process_deadzone(top, bottom, right, left), max_scrolls, :up)
119
185
  end
120
186
 
121
187
  # Scrolls right until element is found or end is reached
122
188
  # @return [TestaAppiumDriver::Locator]
123
- def scroll_right_to(deadzone: nil, max_scrolls: nil)
124
- _scroll_dir_to(deadzone, max_scrolls, :right)
189
+ def scroll_right_to(top: nil, bottom: nil, right: nil, left: nil, max_scrolls: nil)
190
+ _scroll_dir_to(_process_deadzone(top, bottom, right, left), max_scrolls, :right)
125
191
  end
126
192
 
127
193
 
128
194
  # Scrolls left until element is found or end is reached
129
195
  # @return [TestaAppiumDriver::Locator]
130
- def scroll_left_to(deadzone: nil, max_scrolls: nil)
131
- _scroll_dir_to(deadzone, max_scrolls, :left)
196
+ def scroll_left_to(top: nil, bottom: nil, right: nil, left: nil, max_scrolls: nil)
197
+ _scroll_dir_to(_process_deadzone(top, bottom, right, left), max_scrolls, :left)
132
198
  end
133
199
 
134
200
  # Scrolls to the start of the scrollable container (top on vertical container, left on horizontal)
135
201
  # @return [TestaAppiumDriver::Locator]
136
- def scroll_to_start(deadzone: nil)
137
- _scroll_to_start_or_end(:start, deadzone)
202
+ def scroll_to_start(top: nil, bottom: nil, right: nil, left: nil)
203
+ _scroll_to_start_or_end(:start, _process_deadzone(top, bottom, right, left))
138
204
  end
139
205
 
140
206
  # Scrolls to the end of the scrollable container (bottom on vertical container, right on horizontal)
141
207
  # @return [TestaAppiumDriver::Locator]
142
- def scroll_to_end(deadzone: nil)
143
- _scroll_to_start_or_end(:end, deadzone)
208
+ def scroll_to_end(top: nil, bottom: nil, right: nil, left: nil)
209
+ _scroll_to_start_or_end(:end, _process_deadzone(top, bottom, right, left))
144
210
  end
145
211
 
146
212
 
147
213
  # @return [TestaAppiumDriver::Locator]
148
- def page_down(deadzone: nil)
149
- _page(:down, deadzone)
214
+ def page_down(top: nil, bottom: nil, right: nil, left: nil)
215
+ _page(:down, _process_deadzone(top, bottom, right, left))
150
216
  end
151
217
 
152
218
  # @return [TestaAppiumDriver::Locator]
153
- def page_up(deadzone: nil)
154
- _page(:up, deadzone)
219
+ def page_up(top: nil, bottom: nil, right: nil, left: nil)
220
+ _page(:up, _process_deadzone(top, bottom, right, left))
155
221
  end
156
222
 
157
223
  # @return [TestaAppiumDriver::Locator]
158
- def page_left(deadzone: nil)
159
- _page(:left, deadzone)
224
+ def page_left(top: nil, bottom: nil, right: nil, left: nil)
225
+ _page(:left, _process_deadzone(top, bottom, right, left))
160
226
  end
161
227
 
162
228
  # @return [TestaAppiumDriver::Locator]
163
- def page_right(deadzone: nil)
164
- _page(:right, deadzone)
229
+ def page_right(top: nil, bottom: nil, right: nil, left: nil)
230
+ _page(:right, _process_deadzone(top, bottom, right, left))
165
231
  end
166
232
 
167
233
  # @return [TestaAppiumDriver::Locator]
168
- def fling_down(deadzone: nil)
169
- _fling(:down, deadzone)
234
+ def fling_down(top: nil, bottom: nil, right: nil, left: nil)
235
+ _fling(:down, _process_deadzone(top, bottom, right, left))
170
236
  end
171
237
 
172
238
  # @return [TestaAppiumDriver::Locator]
173
- def fling_up(deadzone: nil)
174
- _fling(:up, deadzone)
239
+ def fling_up(top: nil, bottom: nil, right: nil, left: nil)
240
+ _fling(:up, _process_deadzone(top, bottom, right, left))
175
241
  end
176
242
 
177
243
  # @return [TestaAppiumDriver::Locator]
178
- def fling_left(deadzone: nil)
179
- _fling(:left, deadzone)
244
+ def fling_left(top: nil, bottom: nil, right: nil, left: nil)
245
+ _fling(:left, _process_deadzone(top, bottom, right, left))
180
246
  end
181
247
 
182
248
  # @return [TestaAppiumDriver::Locator]
183
- def fling_right(deadzone: nil)
184
- _fling(:right, deadzone)
249
+ def fling_right(top: nil, bottom: nil, right: nil, left: nil)
250
+ _fling(:right, _process_deadzone(top, bottom, right, left))
185
251
  end
186
252
 
187
253
 
@@ -232,6 +298,18 @@ module TestaAppiumDriver
232
298
 
233
299
 
234
300
  private
301
+ def _process_deadzone(top, bottom, right, left)
302
+ deadzone = nil
303
+ if !top.nil? || !bottom.nil? || !right.nil? || !left.nil?
304
+ deadzone = {}
305
+ deadzone[:top] = top unless top.nil?
306
+ deadzone[:bottom] = bottom unless bottom.nil?
307
+ deadzone[:right] = right unless right.nil?
308
+ deadzone[:left] = left unless left.nil?
309
+ end
310
+ deadzone
311
+ end
312
+
235
313
  def _drag_to(x, y)
236
314
  sa = ScrollActions.new(@scrollable_locator,
237
315
  locator: self,
@@ -239,6 +317,8 @@ module TestaAppiumDriver
239
317
  sa.drag_to(x, y)
240
318
  self
241
319
  end
320
+
321
+
242
322
  def _page(direction, deadzone)
243
323
  deadzone = @scrollable_locator.scroll_deadzone if deadzone.nil? && !@scrollable_locator.nil?
244
324
  sa = ScrollActions.new(@scrollable_locator,
@@ -266,7 +346,6 @@ module TestaAppiumDriver
266
346
  sa = ScrollActions.new(@scrollable_locator,
267
347
  locator: self,
268
348
  deadzone: deadzone,
269
- direction: :left,
270
349
  default_scroll_strategy: @default_scroll_strategy)
271
350
  if type == :start
272
351
  sa.scroll_to_start
@@ -293,7 +372,6 @@ module TestaAppiumDriver
293
372
  locator: self,
294
373
  deadzone: deadzone,
295
374
  max_scrolls: max_scrolls,
296
- direction: direction,
297
375
  default_scroll_strategy: @default_scroll_strategy)
298
376
 
299
377
  sa.send("scroll_#{direction}_to")
@@ -79,6 +79,7 @@ module TestaAppiumDriver
79
79
  # method missing is used to fetch the element before executing additional commands like click, send_key, count
80
80
  def method_missing(method, *args, &block)
81
81
  execute.send(method, *args, &block)
82
+ @driver.invalidate_cache
82
83
  end
83
84
 
84
85
 
@@ -3,7 +3,7 @@ module TestaAppiumDriver
3
3
 
4
4
  private
5
5
  # @return [Array]
6
- def w3c_each(skip_scroll_to_start, &block)
6
+ def w3c_each(direction, &block)
7
7
  elements = []
8
8
  begin
9
9
  @driver.disable_wait_for_idle
@@ -13,7 +13,14 @@ module TestaAppiumDriver
13
13
  iterations = 0
14
14
 
15
15
 
16
- scroll_to_start unless skip_scroll_to_start
16
+ if direction.nil?
17
+ scroll_to_start
18
+ if @scrollable.scroll_orientation == :vertical
19
+ direction = :down
20
+ else
21
+ direction = :right
22
+ end
23
+ end
17
24
 
18
25
  until is_end_of_scroll?
19
26
  matches = @locator.execute(skip_cache: true)
@@ -27,6 +34,7 @@ module TestaAppiumDriver
27
34
  end
28
35
  iterations += 1
29
36
  break if !@max_scrolls.nil? && iterations == @max_scrolls
37
+ self.send("page_#{direction}")
30
38
  end
31
39
  rescue => e
32
40
  raise e
@@ -37,13 +45,13 @@ module TestaAppiumDriver
37
45
  elements
38
46
  end
39
47
 
40
- def w3c_align(with)
48
+ def w3c_align(with, scroll_to_find)
41
49
  @driver.disable_wait_for_idle
42
50
  default_deadzone!
43
51
 
44
52
 
45
53
 
46
- @locator.scroll_to unless @raise # called with !
54
+ @locator.scroll_to if scroll_to_find
47
55
 
48
56
  element = @locator.execute
49
57
  @driver.disable_implicit_wait
@@ -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(skip_scroll_to_start, &block)
45
- w3c_each(skip_scroll_to_start, &block)
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,12 +24,12 @@ module TestaAppiumDriver
24
24
  attr_reader :automation_name
25
25
 
26
26
  # custom options
27
- # - default_strategy: default strategy to be used for finding elements. Available strategies :uiautomator or :xpath
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
 
32
-
33
33
  core = Appium::Core.for(opts)
34
34
  extend_for(core.device, core.automation_name)
35
35
  @device = core.device
@@ -38,14 +38,15 @@ module TestaAppiumDriver
38
38
  handle_testa_opts
39
39
 
40
40
  @driver = core.start_driver
41
- invalidate_cache!
41
+ invalidate_cache
42
42
 
43
43
 
44
44
  Selenium::WebDriver::Element.set_driver(self, opts[:caps][:udid])
45
45
  end
46
46
 
47
47
 
48
- def invalidate_cache!
48
+ # invalidates current find_element cache
49
+ def invalidate_cache
49
50
  @cache = {
50
51
  strategy: nil,
51
52
  selector: nil,
@@ -58,11 +59,13 @@ module TestaAppiumDriver
58
59
 
59
60
 
60
61
 
61
- #noinspection RubyScope
62
+ # Executes the find_element with the resolved locator strategy and selector. Find_element might be skipped if cache is hit.
63
+ # Cache stores last executed find_element with given selector, strategy and from_element. If given values are the same within
64
+ # last 5 seconds element is retrieved from cache.
62
65
  # @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
66
+ # @param [String] selector resolved string of a [TestaAppiumDriver::Locator] selector xpath for xpath strategy, java UiSelectors for uiautomator or id for ID strategy
64
67
  # @param [Boolean] single fetch single or multiple results
65
- # @param [Symbol, nil] strategy [TestaAppiumDriver:FIND_STRATEGY_UIAUTOMATOR] or [FIND_STRATEGY_XPATH]
68
+ # @param [Symbol, nil] strategy [TestaAppiumDriver::FIND_STRATEGY_UIAUTOMATOR], [TestaAppiumDriver::FIND_STRATEGY_XPATH] or [TestaAppiumDriver::FIND_STRATEGY_ID]
66
69
  # @param [Symbol] default_strategy if strategy is not enforced, default can be used
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
@@ -116,21 +119,26 @@ module TestaAppiumDriver
116
119
 
117
120
 
118
121
  # method missing is used to forward methods to the actual appium driver
122
+ # after the method is executed, find element cache is invalidated
119
123
  def method_missing(method, *args, &block)
120
124
  @driver.send(method, *args, &block)
125
+ invalidate_cache
121
126
  end
122
127
 
128
+ # disables implicit wait
123
129
  def disable_implicit_wait
124
130
  @implicit_wait_ms = @driver.get_timeouts["implicit"]
125
131
  @driver.manage.timeouts.implicit_wait = 0
126
132
  end
127
133
 
134
+ # enables implicit wait, can be called only after disabling implicit wait
128
135
  def enable_implicit_wait
129
136
  raise "Implicit wait is not disabled" if @implicit_wait_ms.nil?
130
137
  # get_timeouts always returns in milliseconds, but we should set in seconds
131
138
  @driver.manage.timeouts.implicit_wait = @implicit_wait_ms / 1000
132
139
  end
133
140
 
141
+ # disables wait for idle, only executed for android devices
134
142
  def disable_wait_for_idle
135
143
  if @device == :android
136
144
  @wait_for_idle_timeout = @driver.settings.get["waitForIdleTimeout"]
@@ -138,6 +146,7 @@ module TestaAppiumDriver
138
146
  end
139
147
  end
140
148
 
149
+ # enables wait for idle, only executed for android devices
141
150
  def enable_wait_for_idle
142
151
  if @device == :android
143
152
  raise "Wait for idle is not disabled" if @wait_for_idle_timeout.nil?
@@ -145,10 +154,13 @@ module TestaAppiumDriver
145
154
  end
146
155
  end
147
156
 
157
+
158
+ # @@return [String] current package under test
148
159
  def current_package
149
160
  @driver.current_package
150
161
  end
151
162
 
163
+
152
164
  def window_size
153
165
  @driver.window_size
154
166
  end
@@ -175,6 +187,7 @@ module TestaAppiumDriver
175
187
  end
176
188
 
177
189
 
190
+ # @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
191
  def first_and_last_leaf(from_element = @driver)
179
192
  disable_wait_for_idle
180
193
  disable_implicit_wait
@@ -7,6 +7,7 @@ module TestaAppiumDriver
7
7
  include TypeSelectors
8
8
 
9
9
 
10
+ private
10
11
  def handle_testa_opts
11
12
  if @testa_opts[:default_find_strategy].nil?
12
13
  @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,6 +23,7 @@ module TestaAppiumDriver
24
23
  end
25
24
 
26
25
 
26
+ # @return [Array] returns 2 elements. The first is the resolved find element strategy and the second is the resolved selector
27
27
  def strategy_and_selector
28
28
  if @can_use_id_strategy
29
29
  return FIND_STRATEGY_NAME, @can_use_id_strategy
@@ -32,7 +32,8 @@ module TestaAppiumDriver
32
32
  end
33
33
 
34
34
 
35
- # @return [Locator] existing locator element
35
+
36
+ # @return [Locator] new child locator element
36
37
  def add_child_selector(params)
37
38
  params, selectors = extract_selectors_from_params(params)
38
39
  single = params[:single]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestaAppiumDriver
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
@@ -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", [">= 2.3.0"]
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testa_appium_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - karlo.razumovic
@@ -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.0
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.0
40
+ version: '2.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement