calabash 1.9.9.pre3 → 2.0.0.prelegacy

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -33
  3. data/bin/calabash +45 -36
  4. data/lib/calabash.rb +137 -13
  5. data/lib/calabash/android.rb +6 -0
  6. data/lib/calabash/android/adb.rb +25 -1
  7. data/lib/calabash/android/application.rb +14 -3
  8. data/lib/calabash/android/build/builder.rb +16 -3
  9. data/lib/calabash/android/build/java_keystore.rb +10 -0
  10. data/lib/calabash/android/build/resigner.rb +23 -1
  11. data/lib/calabash/android/build/test_server.rb +2 -0
  12. data/lib/calabash/android/defaults.rb +1 -0
  13. data/lib/calabash/android/device.rb +55 -3
  14. data/lib/calabash/android/environment.rb +10 -0
  15. data/lib/calabash/android/interactions.rb +106 -3
  16. data/lib/calabash/android/legacy.rb +143 -0
  17. data/lib/calabash/android/lib/TestServer.apk +0 -0
  18. data/lib/calabash/android/life_cycle.rb +6 -4
  19. data/lib/calabash/android/physical_buttons.rb +12 -1
  20. data/lib/calabash/android/screenshot.rb +1 -0
  21. data/lib/calabash/android/scroll.rb +115 -0
  22. data/lib/calabash/android/server.rb +3 -1
  23. data/lib/calabash/android/text.rb +16 -25
  24. data/lib/calabash/application.rb +29 -0
  25. data/lib/calabash/cli/build.rb +15 -1
  26. data/lib/calabash/cli/console.rb +9 -5
  27. data/lib/calabash/cli/generate.rb +5 -0
  28. data/lib/calabash/cli/helpers.rb +7 -1
  29. data/lib/calabash/cli/resign.rb +1 -0
  30. data/lib/calabash/cli/run.rb +10 -6
  31. data/lib/calabash/cli/setup_keystore.rb +2 -0
  32. data/lib/calabash/color.rb +7 -0
  33. data/lib/calabash/console_helpers.rb +4 -2
  34. data/lib/calabash/defaults.rb +1 -0
  35. data/lib/calabash/device.rb +8 -9
  36. data/lib/calabash/environment.rb +5 -0
  37. data/lib/calabash/gestures.rb +159 -66
  38. data/lib/calabash/http/retriable_client.rb +3 -1
  39. data/lib/calabash/interactions.rb +68 -5
  40. data/lib/calabash/ios.rb +4 -0
  41. data/lib/calabash/ios/application.rb +8 -1
  42. data/lib/calabash/ios/conditions.rb +3 -1
  43. data/lib/calabash/ios/date_picker.rb +412 -0
  44. data/lib/calabash/ios/defaults.rb +1 -0
  45. data/lib/calabash/ios/device.rb +1 -0
  46. data/lib/calabash/ios/device/device_implementation.rb +33 -16
  47. data/lib/calabash/ios/device/gestures_mixin.rb +202 -48
  48. data/lib/calabash/ios/device/ipad_1x_2x_mixin.rb +253 -0
  49. data/lib/calabash/ios/device/keyboard_mixin.rb +2 -0
  50. data/lib/calabash/ios/device/rotation_mixin.rb +11 -8
  51. data/lib/calabash/ios/device/routes/condition_route_mixin.rb +1 -0
  52. data/lib/calabash/ios/device/routes/handle_route_mixin.rb +5 -1
  53. data/lib/calabash/ios/device/routes/map_route_mixin.rb +1 -0
  54. data/lib/calabash/ios/device/routes/response_parser.rb +1 -0
  55. data/lib/calabash/ios/device/routes/uia_route_mixin.rb +44 -6
  56. data/lib/calabash/ios/device/runtime_attributes.rb +4 -5
  57. data/lib/calabash/ios/device/text_mixin.rb +2 -0
  58. data/lib/calabash/ios/device/uia_keyboard_mixin.rb +9 -0
  59. data/lib/calabash/ios/device/uia_mixin.rb +1 -0
  60. data/lib/calabash/ios/gestures.rb +82 -8
  61. data/lib/calabash/ios/interactions.rb +30 -1
  62. data/lib/calabash/ios/orientation.rb +21 -21
  63. data/lib/calabash/ios/runtime.rb +154 -2
  64. data/lib/calabash/ios/slider.rb +70 -0
  65. data/lib/calabash/ios/text.rb +11 -47
  66. data/lib/calabash/ios/uia.rb +24 -2
  67. data/lib/calabash/legacy.rb +7 -0
  68. data/lib/calabash/lib/skeleton/config/cucumber.yml +1 -3
  69. data/lib/calabash/lib/skeleton/features/support/dry_run.rb +8 -0
  70. data/lib/calabash/lib/skeleton/features/support/env.rb +15 -1
  71. data/lib/calabash/life_cycle.rb +78 -32
  72. data/lib/calabash/location.rb +2 -1
  73. data/lib/calabash/orientation.rb +0 -1
  74. data/lib/calabash/page.rb +51 -5
  75. data/lib/calabash/patch.rb +1 -0
  76. data/lib/calabash/patch/array.rb +7 -7
  77. data/lib/calabash/query.rb +17 -2
  78. data/lib/calabash/query_result.rb +14 -0
  79. data/lib/calabash/screenshot.rb +28 -8
  80. data/lib/calabash/text.rb +105 -8
  81. data/lib/calabash/utility.rb +6 -6
  82. data/lib/calabash/version.rb +1 -1
  83. data/lib/calabash/wait.rb +37 -11
  84. metadata +14 -7
@@ -5,7 +5,7 @@ module Calabash
5
5
 
6
6
  end
7
7
 
8
- # @!visibility private
8
+ # Utility methods for testing.
9
9
  module Utility
10
10
 
11
11
  # @!visibility private
@@ -27,8 +27,8 @@ module Calabash
27
27
  #
28
28
  # @example
29
29
  # # These are equivalent.
30
- # pan(percent(20, 50), percent(20, 100))
31
- # pan({x: 20, y: 50}, {x: 20, y: 100})
30
+ # pan("*", percent(20, 50), percent(20, 100))
31
+ # pan("*", {x: 20, y: 50}, {x: 20, y: 100})
32
32
  #
33
33
  # @param [Number] x The value of the x percent.
34
34
  # @param [Number] y The value of the y percent.
@@ -40,12 +40,12 @@ module Calabash
40
40
  alias_method :pct, :percent
41
41
 
42
42
  # A convenience method for creating a coordinate hash that that can be
43
- # passed to gestures.
43
+ # passed to the tap_coordinate gesture.
44
44
  #
45
45
  # @example
46
46
  # # These are equivalent.
47
- # tap(query, offset: coordinate(20, 50))
48
- # tap(query, offset: {x: 20, y: 50})
47
+ # tap_coordinate(coordinate(20, 50)
48
+ # tap_coordinate({x: 20, y: 50})
49
49
  #
50
50
  # @param [Number] x The value of the x.
51
51
  # @param [Number] y The value of the y.
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
 
3
3
  # @!visibility private
4
- VERSION = '1.9.9.pre3'
4
+ VERSION = "2.0.0.prelegacy"
5
5
  end
data/lib/calabash/wait.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module Calabash
2
2
 
3
3
  # A public API for waiting for things to happen.
4
- # @!visibility private
5
4
  module Wait
6
5
  # @!visibility private
7
6
  class TimeoutError < RuntimeError
@@ -28,10 +27,14 @@ module Calabash
28
27
  screenshot_on_error: true
29
28
  }
30
29
 
30
+ # Returns the default wait options.
31
+ # @return [Hash] Key/value pairs describing the wait options.
31
32
  def self.default_options
32
33
  @@default_options
33
34
  end
34
35
 
36
+ # Sets the default wait options.
37
+ # @param [Hash] value The new default wait options.
35
38
  def self.default_options=(value)
36
39
  @@default_options = value
37
40
  end
@@ -141,9 +144,15 @@ module Calabash
141
144
 
142
145
  # Waits for `query` to match one or more views.
143
146
  #
144
- # @param [String] query Query to match view
147
+ # @example
148
+ # wait_for_view({marked: 'mark'})
149
+ #
150
+ # @example
151
+ # text = wait_for_view("myview")['text']
152
+ #
153
+ # @param [String, Hash, Calabash::Query] query Query to match view
145
154
  # @see Calabash::Wait#with_timeout for options
146
- # @return [Object] The first view matching `query`.
155
+ # @return [Hash] The first view matching `query`.
147
156
  def wait_for_view(query, options={})
148
157
  if query.nil?
149
158
  raise ArgumentError, 'Query cannot be nil'
@@ -169,7 +178,9 @@ module Calabash
169
178
 
170
179
  # Waits for all `queries` to simultaneously match at least one view.
171
180
  #
172
- # @param [Array<String>, String] queries List of queries or a query.
181
+ # @param [String, Hash, Calabash::Query] queries List of queries or a
182
+ # query.
183
+ #
173
184
  # @see Calabash::Wait#with_timeout for options
174
185
  # @return [void] The return value for this method is undefined.
175
186
  def wait_for_views(*queries, **options)
@@ -200,7 +211,7 @@ module Calabash
200
211
 
201
212
  # Waits for `query` not to match any views
202
213
  #
203
- # @param [String] query Query to match view
214
+ # @param [String, Hash, Calabash::Query] query Query to match view
204
215
  # @see Calabash::Wait#with_timeout for options
205
216
  def wait_for_no_view(query, options={})
206
217
  if query.nil?
@@ -226,7 +237,9 @@ module Calabash
226
237
 
227
238
  # Waits for all `queries` to simultaneously match no views
228
239
  #
229
- # @param [Array<String>, String] queries List of queries or a query.
240
+ # @param [String, Hash, Calabash::Query] queries List of queries or a
241
+ # query.
242
+ #
230
243
  # @see Calabash::Wait#with_timeout for options
231
244
  def wait_for_no_views(*queries, **options)
232
245
  if queries.nil? || queries.any?(&:nil?)
@@ -252,7 +265,7 @@ module Calabash
252
265
 
253
266
  # Does the given `query` match at least one view?
254
267
  #
255
- # @param [String] query Query to match view
268
+ # @param [String, Hash, Calabash::Query] query Query to match view
256
269
  # @return [Object] Returns truthy if the `query` matches at least one view
257
270
  # @raise [ArgumentError] If given an invalid `query`
258
271
  def view_exists?(query)
@@ -271,7 +284,9 @@ module Calabash
271
284
 
272
285
  # Does the given `queries` all match at least one view?
273
286
  #
274
- # @param [Array<String>, String] queries List of queries or a query
287
+ # @param [String, Hash, Calabash::Query] queries List of queries or a
288
+ # query
289
+ #
275
290
  # @return Returns truthy if the `queries` all match at least one view
276
291
  # @raise [ArgumentError] If given an invalid list of queries
277
292
  def views_exist?(*queries)
@@ -291,7 +306,7 @@ module Calabash
291
306
  # Expect `query` to match at least one view. Raise an exception if it does
292
307
  # not.
293
308
  #
294
- # @param [String] query Query to match view
309
+ # @param [String, Hash, Calabash::Query] query Query to match a view
295
310
  # @raise [ArgumentError] If given an invalid `query`
296
311
  # @raise [ViewNotFoundError] If `query` does not match at least one view
297
312
  def expect_view(query)
@@ -303,6 +318,8 @@ module Calabash
303
318
  raise ViewNotFoundError,
304
319
  "No view matched #{parse_query_list(query)}"
305
320
  end
321
+
322
+ true
306
323
  end
307
324
 
308
325
  alias_method :view_should_exist, :expect_view
@@ -310,7 +327,8 @@ module Calabash
310
327
  # Expect `queries` to each match at least one view. Raise an exception if
311
328
  # they do not.
312
329
  #
313
- # @param [String] queries List of queries or a query
330
+ # @param [String, Hash, Calabash::Query] queries List of queries or a
331
+ # query.
314
332
  # @raise [ArgumentError] If given an invalid list of queries
315
333
  # @raise [ViewNotFoundError] If `queries` do not all match at least one
316
334
  # view.
@@ -323,12 +341,15 @@ module Calabash
323
341
  raise ViewNotFoundError,
324
342
  "Not all queries #{parse_query_list(queries)} matched a view"
325
343
  end
344
+
345
+ true
326
346
  end
327
347
 
328
348
  alias_method :views_should_exist, :expect_views
329
349
 
330
350
  # Expect `query` to match no views. Raise an exception if it does.
331
351
  #
352
+ # @param [String, Hash, Calabash::Query] query Query to match a view
332
353
  # @raise [ArgumentError] If given an invalid `query`
333
354
  # @raise [ViewFoundError] If `query` matches any views.
334
355
  def do_not_expect_view(query)
@@ -339,13 +360,16 @@ module Calabash
339
360
  if view_exists?(query)
340
361
  raise ViewFoundError, "A view matched #{parse_query_list(query)}"
341
362
  end
363
+
364
+ true
342
365
  end
343
366
 
344
367
  alias_method :view_should_not_exist, :do_not_expect_view
345
368
 
346
369
  # Expect `queries` to each match no views. Raise an exception if they do.
347
370
  #
348
- # @param [Array<String>, String] queries List of queries or a query
371
+ # @param [String, Hash, Calabash::Query] queries List of queries or a
372
+ # query.
349
373
  # @raise [ArgumentError] If given an invalid list of queries
350
374
  # @raise [ViewFoundError] If one of `queries` matched any views
351
375
  def do_not_expect_views(*queries)
@@ -357,6 +381,8 @@ module Calabash
357
381
  raise ViewFoundError,
358
382
  "Some views matched #{parse_query_list(queries)}"
359
383
  end
384
+
385
+ true
360
386
  end
361
387
 
362
388
  alias_method :views_should_not_exist, :do_not_expect_views
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.9.pre3
4
+ version: 2.0.0.prelegacy
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Maturana Larsen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-08-04 00:00:00.000000000 Z
14
+ date: 2016-03-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: edn
@@ -93,20 +93,20 @@ dependencies:
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.4.1
96
+ version: 2.0.2
97
97
  - - "<"
98
98
  - !ruby/object:Gem::Version
99
- version: '2.0'
99
+ version: '3.0'
100
100
  type: :runtime
101
101
  prerelease: false
102
102
  version_requirements: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - ">="
105
105
  - !ruby/object:Gem::Version
106
- version: 1.4.1
106
+ version: 2.0.2
107
107
  - - "<"
108
108
  - !ruby/object:Gem::Version
109
- version: '2.0'
109
+ version: '3.0'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: clipboard
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -389,6 +389,7 @@ files:
389
389
  - lib/calabash/android/environment.rb
390
390
  - lib/calabash/android/gestures.rb
391
391
  - lib/calabash/android/interactions.rb
392
+ - lib/calabash/android/legacy.rb
392
393
  - lib/calabash/android/lib/.irbrc
393
394
  - lib/calabash/android/lib/AndroidManifest.xml
394
395
  - lib/calabash/android/lib/TestServer.apk
@@ -411,6 +412,7 @@ files:
411
412
  - lib/calabash/android/orientation.rb
412
413
  - lib/calabash/android/physical_buttons.rb
413
414
  - lib/calabash/android/screenshot.rb
415
+ - lib/calabash/android/scroll.rb
414
416
  - lib/calabash/android/server.rb
415
417
  - lib/calabash/android/text.rb
416
418
  - lib/calabash/application.rb
@@ -437,10 +439,12 @@ files:
437
439
  - lib/calabash/ios/application.rb
438
440
  - lib/calabash/ios/conditions.rb
439
441
  - lib/calabash/ios/console_helpers.rb
442
+ - lib/calabash/ios/date_picker.rb
440
443
  - lib/calabash/ios/defaults.rb
441
444
  - lib/calabash/ios/device.rb
442
445
  - lib/calabash/ios/device/device_implementation.rb
443
446
  - lib/calabash/ios/device/gestures_mixin.rb
447
+ - lib/calabash/ios/device/ipad_1x_2x_mixin.rb
444
448
  - lib/calabash/ios/device/keyboard_mixin.rb
445
449
  - lib/calabash/ios/device/physical_device_mixin.rb
446
450
  - lib/calabash/ios/device/rotation_mixin.rb
@@ -481,13 +485,16 @@ files:
481
485
  - lib/calabash/ios/runtime.rb
482
486
  - lib/calabash/ios/scroll.rb
483
487
  - lib/calabash/ios/server.rb
488
+ - lib/calabash/ios/slider.rb
484
489
  - lib/calabash/ios/text.rb
485
490
  - lib/calabash/ios/uia.rb
491
+ - lib/calabash/legacy.rb
486
492
  - lib/calabash/lib/skeleton/.gitignore
487
493
  - lib/calabash/lib/skeleton/Gemfile
488
494
  - lib/calabash/lib/skeleton/config/cucumber.yml
489
495
  - lib/calabash/lib/skeleton/features/sample.feature
490
496
  - lib/calabash/lib/skeleton/features/step_definitions/calabash_steps.rb
497
+ - lib/calabash/lib/skeleton/features/support/dry_run.rb
491
498
  - lib/calabash/lib/skeleton/features/support/env.rb
492
499
  - lib/calabash/lib/skeleton/features/support/hooks.rb
493
500
  - lib/calabash/life_cycle.rb
@@ -525,7 +532,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
525
532
  version: 1.3.1
526
533
  requirements: []
527
534
  rubyforge_project:
528
- rubygems_version: 2.4.8
535
+ rubygems_version: 2.4.5.1
529
536
  signing_key:
530
537
  specification_version: 4
531
538
  summary: Automated Acceptance Testing for Mobile Apps