calabash 1.9.9.pre3 → 2.0.0.pre1

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -0
  3. data/bin/calabash +45 -36
  4. data/lib/calabash/android/build/builder.rb +1 -1
  5. data/lib/calabash/android/build/resigner.rb +19 -1
  6. data/lib/calabash/android/device.rb +13 -2
  7. data/lib/calabash/android/interactions.rb +104 -3
  8. data/lib/calabash/android/lib/TestServer.apk +0 -0
  9. data/lib/calabash/android/life_cycle.rb +5 -4
  10. data/lib/calabash/android/physical_buttons.rb +4 -1
  11. data/lib/calabash/android/scroll.rb +5 -0
  12. data/lib/calabash/android/text.rb +10 -25
  13. data/lib/calabash/android.rb +3 -0
  14. data/lib/calabash/cli/generate.rb +2 -0
  15. data/lib/calabash/console_helpers.rb +4 -2
  16. data/lib/calabash/device.rb +1 -9
  17. data/lib/calabash/environment.rb +4 -0
  18. data/lib/calabash/gestures.rb +159 -66
  19. data/lib/calabash/http/retriable_client.rb +1 -1
  20. data/lib/calabash/interactions.rb +67 -5
  21. data/lib/calabash/ios/conditions.rb +0 -1
  22. data/lib/calabash/ios/device/device_implementation.rb +17 -5
  23. data/lib/calabash/ios/device/gestures_mixin.rb +202 -48
  24. data/lib/calabash/ios/device/rotation_mixin.rb +10 -8
  25. data/lib/calabash/ios/device/routes/handle_route_mixin.rb +5 -1
  26. data/lib/calabash/ios/device/runtime_attributes.rb +4 -5
  27. data/lib/calabash/ios/gestures.rb +82 -8
  28. data/lib/calabash/ios/orientation.rb +21 -21
  29. data/lib/calabash/ios/runtime.rb +146 -2
  30. data/lib/calabash/ios/slider.rb +70 -0
  31. data/lib/calabash/ios/text.rb +6 -2
  32. data/lib/calabash/ios/uia.rb +24 -2
  33. data/lib/calabash/ios.rb +2 -0
  34. data/lib/calabash/lib/skeleton/features/support/dry_run.rb +8 -0
  35. data/lib/calabash/life_cycle.rb +59 -30
  36. data/lib/calabash/location.rb +0 -1
  37. data/lib/calabash/orientation.rb +0 -1
  38. data/lib/calabash/page.rb +38 -5
  39. data/lib/calabash/patch/array.rb +7 -7
  40. data/lib/calabash/query.rb +17 -2
  41. data/lib/calabash/query_result.rb +10 -0
  42. data/lib/calabash/screenshot.rb +28 -8
  43. data/lib/calabash/text.rb +52 -8
  44. data/lib/calabash/utility.rb +3 -3
  45. data/lib/calabash/version.rb +1 -1
  46. data/lib/calabash/wait.rb +33 -11
  47. data/lib/calabash.rb +124 -13
  48. metadata +114 -111
@@ -1,16 +1,20 @@
1
1
  module Calabash
2
- # Methods for performing gestures. Gestures are taps, flicks,
3
- # and pans.
2
+ # Methods for performing gestures. Gestures are taps, flicks, and pans.
4
3
  #
5
4
  # Many gestures take an optional :duration. On iOS, the duration must be
6
5
  # between 0.5 and 60 (seconds). This is a limitation of the UIAutomation API.
6
+ #
7
+ # @note All gestures have _undefined return values._ This is intentional.
8
+ # Please do not rely on return values of gestures in your tests. For
9
+ # convenience when working in the console, some gestures return sensible
10
+ # values. However, these values are subject to change.
7
11
  module Gestures
8
12
 
9
13
  # How long do we wait for a view to appear by default when performing a
10
14
  # gesture.
11
15
  DEFAULT_GESTURE_WAIT_TIMEOUT = 3
12
16
 
13
- # Performs a `tap` on the (first) view that matches `query`.
17
+ # Performs a **tap** on the first view that matches `query`.
14
18
  #
15
19
  # Taps the center of the view by default.
16
20
  #
@@ -19,33 +23,25 @@ module Calabash
19
23
  #
20
24
  # ┬ ┌─────────────────────────────────────┐
21
25
  # | │2 3│
22
- # | │ 4
26
+ # | │
23
27
  # | │ │
24
28
  # 200 px │ 1 │
25
29
  # | │ │
26
- # | │ 7 5 │ 6
27
30
  # | │ │
31
+ # | │ 4 │
28
32
  # ┴ └─────────────────────────────────────┘
29
33
  #
30
34
  # 1. tap("* marked:'email'")
31
35
  # 2. tap("* marked:'email'", at: {x: 0, y: 0})
32
36
  # 3. tap("* marked:'email'", at: {x: 100, y: 0})
33
- # 4. tap("* marked:'email'", offset: {y: -40})
34
- # 5. tap("* marked:'email'", offset: {x: 20, y: 40})
35
- # 6. tap("* marked:'email'", at: {x: 100, y: 75}, offset: {x: 80})
36
- # 7. tap("* marked:'email'", at: {x: 50, y: 100},
37
- # offset: {x: -80, y: -40})
37
+ # 4. tap("* marked:'email'", at: {x: 50, y: 100})
38
38
  #
39
- # @param [String] query A query describing the view to tap.
39
+ # @param [String, Hash, Calabash::Query] query A query describing the view
40
+ # to tap.
40
41
  # @param [Hash] options Options for modifying the details of the touch.
41
42
  # @option options [Hash] :at ({x: 50, y: 50}) The point at which the
42
43
  # gesture originates from. It is a percentage-based translation using
43
- # top-left `(0,0)` as the reference point. This translation is always
44
- # applied before any `:offset`.
45
- # @option options [Hash] :offset ({x: 0, y: 0}) Offset to touch point.
46
- # Offset supports an `:x` and `:y` key and causes the touch to be
47
- # offset with `(x,y)`. This offset is always applied _after_ any
48
- # translation performed by `:at`.
44
+ # top-left `(0,0)` as the reference point.
49
45
  # @raise [ViewNotFoundError] If the `query` returns no results.
50
46
  # @raise [ArgumentError] If `query` is invalid.
51
47
  def tap(query, options={})
@@ -54,8 +50,17 @@ module Calabash
54
50
  Device.default.tap(Query.new(query), options)
55
51
  end
56
52
 
57
- # Performs a `double_tap` on the (first) view that matches `query`.
58
- # @see tap
53
+ # Performs a **double_tap** on the first view that matches `query`.
54
+ #
55
+ # @see #tap
56
+ #
57
+ # @param [String, Hash, Calabash::Query] query A query describing the view
58
+ # to tap.
59
+ # @param [Hash] options Options for modifying the details of the touch.
60
+ # @option options [Hash] :at ({x: 50, y: 50}) The point at which the
61
+ # gesture originates from. It is a percentage-based translation using
62
+ # top-left `(0,0)` as the reference point.
63
+ #
59
64
  # @raise [ViewNotFoundError] If the `query` returns no results.
60
65
  # @raise [ArgumentError] If `query` is invalid.
61
66
  def double_tap(query, options={})
@@ -64,12 +69,14 @@ module Calabash
64
69
  Device.default.double_tap(Query.new(query), options)
65
70
  end
66
71
 
67
- # Performs a `long_press` on the (first) view that matches `query`.
72
+ # Performs a **long_press** on the first view that matches `query`.
73
+ #
68
74
  # On iOS this is often referred to as _touch-and-hold_. On Android this
69
75
  # is known variously as _press_, _long-push_, _press-and-hold_, or _hold_.
70
76
  #
71
- # @see tap
77
+ # @see #tap
72
78
  #
79
+ # @param [String] query A query describing the view to tap.
73
80
  # @param [Hash] options Options for modifying the details of the touch.
74
81
  # @option options [Number] :duration (1.0) The amount of time in seconds to
75
82
  # press. On iOS, the duration must be between 0.5 and 60.
@@ -82,11 +89,14 @@ module Calabash
82
89
  Device.default.long_press(Query.new(query), options)
83
90
  end
84
91
 
85
- # Performs a `pan` on the (first) view that matches `query`.
92
+ # Performs a **pan** on the first view that matches `query`.
93
+ #
86
94
  # A pan is a straight line swipe that pauses at the final point
87
95
  # before releasing the gesture. This is the general purpose pan method. For
88
96
  # standardized pans see `pan_left`, `pan_right`, `pan_up`, and `pan_down`.
89
97
  #
98
+ # Also known as **scroll** and **swipe**.
99
+ #
90
100
  # @example
91
101
  # Consider a pan on a scrollable view. When the finger is is released,
92
102
  # the velocity of the view is zero.
@@ -112,7 +122,8 @@ module Calabash
112
122
  # @see Calabash::IOS::Scroll#scroll_to_item
113
123
  # @see Calabash::IOS::Scroll#scroll_to_item_with_mark
114
124
  #
115
- # @param [String] query A query describing the view to pan inside.
125
+ # @param [String, Hash, Calabash::Query] query A query describing the view
126
+ # to pan inside.
116
127
  # @param [Hash] from `({:x, :y})` The point at which the gesture
117
128
  # originates from.
118
129
  # @param [Hash] to `({:x, :y})` The point at which the gesture
@@ -132,9 +143,11 @@ module Calabash
132
143
  Device.default.pan(Query.new(query), from, to, options)
133
144
  end
134
145
 
135
- # Performs a `pan` from the center of the first view that matches
146
+ # Performs a **pan** from the center of the first view that matches
136
147
  # `query_from` to the center of the first view that matches `query_to`.
137
148
  #
149
+ # Also known as **drag and drop**.
150
+ #
138
151
  # @example
139
152
  # Panning between two elements.
140
153
  # `pan_between("* id:'first'", "* id:'second'")`
@@ -171,56 +184,64 @@ module Calabash
171
184
  Device.default.pan_between(Query.new(query_from), Query.new(query_to), options)
172
185
  end
173
186
 
174
- # Performs a `pan` heading `left` on the (first) view that matches `query`.
175
- # @see pan
187
+ # Performs a **pan** heading _left_ on the first view that matches `query`.
188
+ #
189
+ # @see #pan
176
190
  def pan_left(query, options={})
177
191
  pan(query, {x: 90, y: 50}, {x: 10, y: 50}, options)
178
192
  end
179
193
 
180
- # Performs a `pan` heading `right` on the (first) view that matches
181
- # `query`.
182
- # @see pan
194
+ # Performs a **pan** heading _right_ on the first view that matches `query`.
195
+ #
196
+ # @see #pan
183
197
  def pan_right(query, options={})
184
198
  pan(query, {x: 10, y: 50}, {x: 90, y: 50}, options)
185
199
  end
186
200
 
187
- # Performs a `pan` heading `up` on the (first) view that matches `query`.
188
- # @see pan
201
+ # Performs a **pan** heading _up_ on the first view that matches `query`.
202
+ #
203
+ # @see #pan
189
204
  def pan_up(query, options={})
190
205
  pan(query, {x: 50, y: 90}, {x: 50, y: 10}, options)
191
206
  end
192
207
 
193
- # Performs a `pan` heading `down` on the (first) view that matches `query`.
194
- # @see pan
208
+ # Performs a **pan** heading _down_ on the first view that matches `query`.
209
+ #
210
+ # @see #pan
195
211
  def pan_down(query, options={})
196
212
  pan(query, {x: 50, y: 10}, {x: 50, y: 90}, options)
197
213
  end
198
214
 
199
- # Performs a `pan` heading `left` on the screen.
200
- # @see pan_left
215
+ # Performs a **pan** heading _left_ on the screen.
216
+ #
217
+ # @see #pan
201
218
  def pan_screen_left(options={})
202
219
  pan_left('*', options)
203
220
  end
204
221
 
205
- # Performs a `pan` heading `right` on the screen.
206
- # @see pan_right
222
+ # Performs a **pan** heading _right_ on the screen.
223
+ #
224
+ # @see #pan
207
225
  def pan_screen_right(options={})
208
226
  pan_right('*', options)
209
227
  end
210
228
 
211
- # Performs a `pan` heading `up` on the screen.
212
- # @see pan_up
229
+ # Performs a **pan** heading _up_ on the screen.
230
+ #
231
+ # @see #pan
213
232
  def pan_screen_up(options={})
214
233
  _pan_screen_up(options)
215
234
  end
216
235
 
217
- # Performs a `pan` heading `down` on the screen.
218
- # @see pan_down
236
+ # Performs a **pan** heading _down_ on the screen.
237
+ #
238
+ # @see #pan
219
239
  def pan_screen_down(options={})
220
240
  _pan_screen_down(options)
221
241
  end
222
242
 
223
- # Performs a `flick` on the (first) view that matches `query`.
243
+ # Performs a **flick** on the first view that matches `query`.
244
+ #
224
245
  # A flick is a straight line swipe that **lifts the finger while
225
246
  # the gesture is still in motion**. This will often cause scrollable
226
247
  # views to continue moving for some time after the gesture is released.
@@ -257,91 +278,163 @@ module Calabash
257
278
  Device.default.flick(Query.new(query), from, to, options)
258
279
  end
259
280
 
260
- # Performs a `flick` heading `left` on the (first) view that matches `query`.
261
- # @see flick
281
+ # Performs a **flick** heading _left_ on the first view that matches `query`.
282
+ # @see #flick
262
283
  def flick_left(query, options={})
263
284
  flick(query, {x: 90, y: 50}, {x: 10, y: 50}, options)
264
285
  end
265
286
 
266
- # Performs a `flick` heading `right` on the (first) view that matches
287
+ # Performs a **flick** heading _right_ on the first view that matches
267
288
  # `query`.
268
- # @see flick
289
+ # @see #flick
269
290
  def flick_right(query, options={})
270
291
  flick(query, {x: 10, y: 50}, {x: 90, y: 50}, options)
271
292
  end
272
293
 
273
- # Performs a `flick` heading `up` on the (first) view that matches `query`.
274
- # @see flick
294
+ # Performs a **flick** heading _up_ on the first view that matches `query`.
295
+ # @see #flick
275
296
  def flick_up(query, options={})
276
297
  flick(query, {x: 50, y: 90}, {x: 50, y: 10}, options)
277
298
  end
278
299
 
279
- # Performs a `flick` heading `down` on the (first) view that matches `query`.
280
- # @see flick
300
+ # Performs a **flick** heading _down_ on the first view that matches `query`.
301
+ # @see #flick
281
302
  def flick_down(query, options={})
282
303
  flick(query, {x: 50, y: 10}, {x: 50, y: 90}, options)
283
304
  end
284
305
 
285
- # Performs a `flick` heading `left` on the screen.
286
- # @see flick_left
306
+ # Performs a **flick** heading _left_ on the screen.
307
+ # @see #flick
287
308
  def flick_screen_left(options={})
288
309
  flick_left('*', options)
289
310
  end
290
311
 
291
- # Performs a `flick` heading `right` on the screen.
292
- # @see flick_right
312
+ # Performs a **flick** heading _right_ on the screen.
313
+ # @see #flick
293
314
  def flick_screen_right(options={})
294
315
  flick_right('*', options)
295
316
  end
296
317
 
297
- # Performs a `flick` heading `up` on the screen.
298
- # @see flick_up
318
+ # Performs a **flick** heading _up_ on the screen.
319
+ # @see #flick
299
320
  def flick_screen_up(options={})
300
321
  _flick_screen_up(options)
301
322
  end
302
323
 
303
- # Performs a `flick` heading `down` on the screen.
304
- # @see flick_down
324
+ # Performs a **flick** heading _down_ on the screen.
325
+ # @see #flick
305
326
  def flick_screen_down(options={})
306
327
  _flick_screen_down(options)
307
328
  end
308
329
 
309
- # Performs a `pinch` outwards.
330
+ # Performs a **pinch** outwards on the first view match by `query`.
331
+ #
332
+ # @param [String, Hash, Calabash::Query] query A query describing the view
333
+ # to pinch.
334
+ # @param [Hash] options Options for controlling the pinch.
335
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
336
+ # the duration must be between 0.5 and 60.
337
+ #
338
+ # @raise [ViewNotFoundError] If the `query` returns no results.
339
+ # @raise [ArgumentError] If `query` is invalid.
340
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
310
341
  def pinch_out(query, options={})
311
342
  Device.default.pinch(:out, query, options)
312
343
  end
313
344
 
314
- # Performs a `pinch` inwards.
345
+ # Performs a **pinch** inwards on the first view match by `query`.
346
+ #
347
+ # @param [String, Hash, Calabash::Query] query A query describing the view
348
+ # to pinch.
349
+ # @param [Hash] options Options for controlling the pinch.
350
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
351
+ # the duration must be between 0.5 and 60.
352
+ #
353
+ # @raise [ViewNotFoundError] If the `query` returns no results.
354
+ # @raise [ArgumentError] If `query` is invalid.
355
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
315
356
  def pinch_in(query, options={})
316
357
  Device.default.pinch(:in, query, options)
317
358
  end
318
359
 
319
- # Performs a `pinch` outwards on the screen.
360
+ # Performs a **pinch** outwards on the screen.
361
+ #
362
+ # @param [Hash] options Options for controlling the pinch.
363
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
364
+ # the duration must be between 0.5 and 60.
365
+ #
366
+ # @raise [ViewNotFoundError] If the `query` returns no results.
367
+ # @raise [ArgumentError] If `query` is invalid.
368
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
320
369
  def pinch_screen_out(options={})
321
370
  _pinch_screen(:out, options)
322
371
  end
323
372
 
324
- # Performs a `pinch` inwards on the screen.
373
+ # Performs a **pinch** inwards on the screen.
374
+ #
375
+ # @param [Hash] options Options for controlling the pinch.
376
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
377
+ # the duration must be between 0.5 and 60.
378
+ #
379
+ # @raise [ViewNotFoundError] If the `query` returns no results.
380
+ # @raise [ArgumentError] If `query` is invalid.
381
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
325
382
  def pinch_screen_in(options={})
326
383
  _pinch_screen(:in, options)
327
384
  end
328
385
 
329
- # Performs a `pinch` to zoom out.
386
+ # Performs a **pinch** to zoom out.
387
+ #
388
+ # @param [String, Hash, Calabash::Query] query A query describing the view
389
+ # to pinch.
390
+ # @param [Hash] options Options for controlling the pinch.
391
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
392
+ # the duration must be between 0.5 and 60.
393
+ #
394
+ # @raise [ViewNotFoundError] If the `query` returns no results.
395
+ # @raise [ArgumentError] If `query` is invalid.
396
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
330
397
  def pinch_to_zoom_out(query, options={})
331
398
  _pinch_to_zoom(:out, query, options)
332
399
  end
333
400
 
334
- # Performs a `pinch` to zoom in.
401
+ # Performs a **pinch** to zoom in.
402
+ #
403
+ # @param [String, Hash, Calabash::Query] query A query describing the view
404
+ # to pinch.
405
+ # @param [Hash] options Options for controlling the pinch.
406
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
407
+ # the duration must be between 0.5 and 60.
408
+ #
409
+ # @raise [ViewNotFoundError] If the `query` returns no results.
410
+ # @raise [ArgumentError] If `query` is invalid.
411
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
335
412
  def pinch_to_zoom_in(query, options={})
336
413
  _pinch_to_zoom(:in, query, options)
337
414
  end
338
415
 
339
- # Performs a `pinch` to zoom in on the screen.
416
+ # Performs a **pinch** on the screen to zoom in.
417
+ #
418
+ # @param [Hash] options Options for controlling the pinch.
419
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
420
+ # the duration must be between 0.5 and 60.
421
+ #
422
+ # @raise [ViewNotFoundError] If the `query` returns no results.
423
+ # @raise [ArgumentError] If `query` is invalid.
424
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
340
425
  def pinch_screen_to_zoom_in(options={})
341
426
  _pinch_screen_to_zoom(:in, options)
342
427
  end
343
428
 
344
- # Performs a `pinch` to zoom in on the screen.
429
+ # Performs a **pinch** on the screen to zoom out.
430
+ #
431
+ # @param [Hash] options Options for controlling the pinch.
432
+ # @option options [Numeric] :duration The duration of the pinch. On iOS,
433
+ # the duration must be between 0.5 and 60.
434
+ #
435
+ # @raise [ViewNotFoundError] If the `query` returns no results.
436
+ # @raise [ArgumentError] If `query` is invalid.
437
+ # @raise [ArgumentError] iOS: if the `:duration` is not between 0.5 and 60.
345
438
  def pinch_screen_to_zoom_out(options={})
346
439
  _pinch_screen_to_zoom(:out, options)
347
440
  end
@@ -107,7 +107,7 @@ module Calabash
107
107
  interval = options.fetch(:interval, @interval)
108
108
  header = options.fetch(:header, HEADER)
109
109
 
110
- @logger.log "Getting: #{@server.endpoint + request.route}"
110
+ @logger.log "Getting: #{@server.endpoint + request.route} #{options}"
111
111
 
112
112
  start_time = Time.now
113
113
  last_error = nil
@@ -1,12 +1,74 @@
1
1
  module Calabash
2
- # @!visibility private
3
2
  module Interactions
4
- # @todo Needs docs!
3
+ # Queries the view hierarchy to find all views matching `query`.
4
+ # Optionally query takes a variable number of “invocation” arguments
5
+ # (args below).
6
+ # If called with an empty list of *args, query will find the views
7
+ # specified by `query` and return a QueryResult of serialized views.
8
+ #
9
+ # @note If this method is called with invocation arguments, it might allow
10
+ # the author of the test to do an interaction with app that a user would
11
+ # not be able to (for example changing the text of a view).
12
+ #
13
+ # @example
14
+ # query("* marked:'my view'")
15
+ # query("* id:'foo' descendant UIButton")
16
+ # query("android.widget.ProgressBar")
17
+ # query("* {text CONTAINS 'something'}")
18
+ # query("* {y > 200}")
19
+ #
20
+ # @example
21
+ # # Find all the elements, visible as well as invisible
22
+ # query("all *")
23
+ #
24
+ # @example
25
+ # query("editText", :setText => 'my text')
26
+ # query("scrollView", :scrollBy => [50, 10])
27
+ #
28
+ # @example
29
+ # irb(main):009:0> query("UITabBarButton index:0")
30
+ # [
31
+ # [0] {
32
+ # "class" => "UITabBarButton",
33
+ # "id" => nil,
34
+ # "rect" => {
35
+ # "center_x" => 40,
36
+ # "y" => 520,
37
+ # "width" => 76,
38
+ # "x" => 2,
39
+ # "center_y" => 544,
40
+ # "height" => 48
41
+ # },
42
+ # "frame" => {
43
+ # "y" => 1,
44
+ # "width" => 76,
45
+ # "x" => 2,
46
+ # "height" => 48
47
+ # },
48
+ # "label" => "Reader",
49
+ # "description" => "<UITabBarButton: 0xdabb510; frame = (2 1; 76 48); opaque = NO; layer = <CALayer: 0xdabd8e0>>"
50
+ # }
51
+ # ]
52
+ #
53
+ # @note Even if the query matches only one view, the QueryResult returned
54
+ # is still a list of elements.
55
+ #
56
+ # @param [String, Hash, Calabash::Query] query The query to match the
57
+ # view(s)
58
+ #
59
+ # @param args Optional var-args list describing a chain of method
60
+ # names (selectors).
61
+ #
62
+ # @return [Calabash::QueryResult] A result of the query
5
63
  def query(query, *args)
6
64
  Calabash::Device.default.map_route(Query.new(query), :query, *args)
7
65
  end
8
66
 
9
- # @todo Needs docs!
67
+ # Flashes any views matching `query`. Only one view is flashed at a time,
68
+ # in the order they are returned.
69
+ #
70
+ # @param [String, Hash, Calabash::Query] query The query to match the
71
+ # view(s)
10
72
  def flash(query)
11
73
  Calabash::Device.default.map_route(Query.new(query), :flash)
12
74
  end
@@ -18,7 +80,7 @@ module Calabash
18
80
  # # iOS
19
81
  # evaluate_javascript_in("UIWebView", "2+2")
20
82
  # # Android
21
- # evaluate_javascript_in("WebView", "return 2+2"
83
+ # evaluate_javascript_in("WebView", "return 2+2")
22
84
  #
23
85
  # @example
24
86
  # # iOS
@@ -79,7 +141,7 @@ module Calabash
79
141
  #
80
142
  # @example
81
143
  # # iOS
82
- # backdoor('calabashBackdoor:'', '')
144
+ # backdoor('calabashBackdoor:', '')
83
145
  #
84
146
  # @example
85
147
  # # iOS
@@ -1,6 +1,5 @@
1
1
  module Calabash
2
2
  module IOS
3
- # @!visibility private
4
3
  module Conditions
5
4
 
6
5
  # Waits for all elements to stop animating.
@@ -22,8 +22,6 @@ module Calabash
22
22
 
23
23
  include Calabash::IOS::GesturesMixin
24
24
 
25
- # @todo Should these be public?
26
- # @todo If public, document!
27
25
  attr_reader :run_loop
28
26
  attr_reader :uia_strategy
29
27
  attr_reader :start_options
@@ -292,6 +290,13 @@ module Calabash
292
290
  runtime_attributes.server_version
293
291
  end
294
292
 
293
+ # @!visibility private
294
+ # A dump of runtime details.
295
+ def runtime_details
296
+ expect_runtime_attributes_available(__method__)
297
+ @runtime_attributes.runtime_info
298
+ end
299
+
295
300
  # Is this device a simulator?
296
301
  # @return [Boolean] Returns true if this device is a simulator.
297
302
  def simulator?
@@ -729,11 +734,18 @@ module Calabash
729
734
 
730
735
  # @!visibility private
731
736
  def expect_runtime_attributes_available(method_name)
737
+
732
738
  if runtime_attributes.nil?
733
- logger.log("The method '#{method_name}' is not available to IOS::Device until", :info)
734
- logger.log('the app has been launched with Calabash start_app.', :info)
735
- raise "The method '#{method_name}' can only be called after the app has been launched"
739
+ begin
740
+ # Populates the @runtime_attributes
741
+ wait_for_server_to_start({:timeout => 1.0})
742
+ rescue Calabash::Device::EnsureTestServerReadyTimeoutError => _
743
+ logger.log("The method '#{method_name}' is not available to IOS::Device until", :info)
744
+ logger.log('the app has been launched with Calabash start_app.', :info)
745
+ raise "The method '#{method_name}' can only be called after the app has been launched"
746
+ end
736
747
  end
748
+
737
749
  true
738
750
  end
739
751