calabash-cucumber 0.14.2.pre1 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3d24ef92d4b66bd13c1ceb292b84588c6adbc3e
4
- data.tar.gz: 9206b69d1c119c7d97d6a2820e656af3771e5731
3
+ metadata.gz: ccef20da034464aa0eb6747ea0f047731ad99528
4
+ data.tar.gz: 7aa938f5d8956a29aac66b410cf1b2b0aba34203
5
5
  SHA512:
6
- metadata.gz: 310f714054788df414ae01f55a3aec7cf1af8501bd3da89cae3e9b8bf771262eb53c9537319e6a89c8f2d14d6acb0bb8afd6c716d7bdc2e460a2c53f066a2269
7
- data.tar.gz: a820f3287a1aedbd678010cd53056e201691aef72d4484bafc50587f6c5817caf24427097dca06a4ea44a9b4f18b1e92eb5c38ba46e55f8ac7e417317196dfa4
6
+ metadata.gz: 16330bd75b391e907a4ba8eefcbf13f3f5f805c2f1959393747db63fb0f7b417d4f8ddbc82a5b0e3c65d5af6a4969068616b9cd2bc9f3881001ef77c207a89e2
7
+ data.tar.gz: 89da2e34073420b84db8dce75d8b7fcb6fe363d7e706d0d489399e52de0ca7619486e20d0476cb4c300a45b64983814a0647fbd47fdfa26263c89b1992a3875f
Binary file
Binary file
@@ -62,7 +62,7 @@ end
62
62
 
63
63
  Then /^I (?:press|touch) list item "([^\"]*)"$/ do |cell_name|
64
64
  if query("tableViewCell marked: '#{cell_name}'").empty?
65
- touch("tableViewCell text:' #{cell_name}'")
65
+ touch("tableViewCell text: '#{cell_name}'")
66
66
  else
67
67
  touch("tableViewCell marked: '#{cell_name}'")
68
68
  end
@@ -538,10 +538,10 @@ module Calabash
538
538
  # a custom error message to display if the scrolling fails - if not
539
539
  # specified, a generic failure will be displayed
540
540
  #
541
- # @raise [RuntimeException] if the scroll cannot be performed
542
- # @raise [RuntimeException] :query finds no collection view
543
- # @raise [RuntimeException] the collection view does not contain a cell at item/section
544
- # @raise [RuntimeException] :scroll_position is invalid
541
+ # @raise [RuntimeError] if the scroll cannot be performed
542
+ # @raise [RuntimeError] :query finds no collection view
543
+ # @raise [RuntimeError] the collection view does not contain a cell at item/section
544
+ # @raise [RuntimeError] :scroll_position is invalid
545
545
  def scroll_to_collection_view_item(item, section, opts={})
546
546
  default_options = {:query => 'collectionView',
547
547
  :scroll_position => :top,
@@ -596,12 +596,12 @@ module Calabash
596
596
  # a custom error message to display if the scrolling fails - if not
597
597
  # specified, a generic failure will be displayed
598
598
  #
599
- # @raise [RuntimeException] if the scroll cannot be performed
600
- # @raise [RuntimeException] if the mark is nil
601
- # @raise [RuntimeException] :query finds no collection view
602
- # @raise [RuntimeException] the collection view does not contain a cell
599
+ # @raise [RuntimeError] if the scroll cannot be performed
600
+ # @raise [RuntimeError] if the mark is nil
601
+ # @raise [RuntimeError] :query finds no collection view
602
+ # @raise [RuntimeError] the collection view does not contain a cell
603
603
  # with the mark
604
- # @raise [RuntimeException] :scroll_position is invalid
604
+ # @raise [RuntimeError] :scroll_position is invalid
605
605
  def scroll_to_collection_view_item_with_mark(mark, opts={})
606
606
  default_options = {:query => 'collectionView',
607
607
  :scroll_position => :top,
@@ -48,7 +48,6 @@ module Calabash
48
48
  def make_http_request(options)
49
49
  retryable_errors = options[:retryable_errors] || RETRYABLE_ERRORS
50
50
  CAL_HTTP_RETRY_COUNT.times do |count|
51
- previous_debug_dev = nil
52
51
  begin
53
52
  if not @http
54
53
  @http = init_request(options)
@@ -63,7 +62,7 @@ module Calabash
63
62
  raise Errno::ECONNREFUSED if response.status_code == 502
64
63
 
65
64
  return response.body
66
- rescue Exception => e
65
+ rescue => e
67
66
 
68
67
  if retryable_errors.include?(e) || retryable_errors.any? { |c| e.is_a?(c) }
69
68
 
@@ -102,4 +101,4 @@ module Calabash
102
101
 
103
102
  end
104
103
  end
105
- end
104
+ end
@@ -155,7 +155,7 @@ module Calabash
155
155
  #
156
156
  # @param [Hash] opts controls the `wait_for` behavior
157
157
  # @option opts [String] :timeout_message ('keyboard did not appear')
158
- # Controls the message that appears in the exception.
158
+ # Controls the message that appears in the error.
159
159
  # @option opts [Number] :post_timeout (0.3) Controls how long to wait
160
160
  # _after_ the keyboard has appeared.
161
161
  #
@@ -29,8 +29,14 @@ module Calabash
29
29
  # @param [Hash] options
30
30
  # @raise [RuntimeError] if http request does not report success
31
31
  def _keychain_get(options={})
32
- res = http({:method => :get, :raw => true, :path => 'keychain'}, options)
33
- res = JSON.parse(res)
32
+ raw = http({:method => :get, :raw => true, :path => 'keychain'}, options)
33
+
34
+ begin
35
+ res = JSON.parse(raw)
36
+ rescue TypeError, JSON::ParserError => _
37
+ raise "Could not parse response '#{res}'; the app might have crashed or the server responded with invalid JSON."
38
+ end
39
+
34
40
  if res['outcome'] != 'SUCCESS'
35
41
  raise "get keychain with options '#{options}' failed because: '#{res['reason']}'\n'#{res['details']}'"
36
42
  end
@@ -105,11 +111,15 @@ module Calabash
105
111
  # @raise [RuntimeError] if http request does not report success
106
112
  def _keychain_post(options={})
107
113
  raw = http({:method => :post, :path => 'keychain'}, options)
108
- res = JSON.parse(raw)
114
+ begin
115
+ res = JSON.parse(raw)
116
+ rescue TypeError, JSON::ParserError => _
117
+ raise "Could not parse response '#{res}'; the app might have crashed or the server responded with invalid JSON."
118
+ end
109
119
  if res['outcome'] != 'SUCCESS'
110
120
  raise "post keychain with options '#{options}' failed because: #{res['reason']}\n#{res['details']}"
111
121
  end
112
- nil
122
+ res['results']
113
123
  end
114
124
 
115
125
  # On the iOS Simulator this clears *all* keychain entries for *all*
@@ -26,7 +26,7 @@ module Calabash
26
26
 
27
27
  # Custom error indicating a timeout in launching and connecting to the
28
28
  # embedded calabash server.
29
- # @todo This is duplicated in Launcher class - consider exceptions.rb module.
29
+ # @todo This is duplicated in Launcher class - consider errors.rb module.
30
30
  class TimeoutErr < RuntimeError
31
31
  end
32
32
 
@@ -459,8 +459,6 @@ module Calabash
459
459
  begin
460
460
  connected = (ping_app == '200')
461
461
  break if connected
462
- rescue Exception => e
463
- # nop
464
462
  ensure
465
463
  sleep 1 unless connected
466
464
  end
@@ -787,9 +787,6 @@ class Calabash::Cucumber::Launcher
787
787
  begin
788
788
  connected = (ping_app == '200')
789
789
  break if connected
790
- rescue Exception => e
791
- #p e
792
- #retry
793
790
  ensure
794
791
  sleep 1 unless connected
795
792
  end
@@ -819,11 +816,8 @@ class Calabash::Cucumber::Launcher
819
816
  sess.request Net::HTTP::Get.new(ENV['CALABASH_VERSION_PATH'] || "version")
820
817
  end
821
818
  status = res.code
822
- begin
823
- http.finish if http and http.started?
824
- rescue Exception => e
825
819
 
826
- end
820
+ http.finish if http and http.started?
827
821
 
828
822
  if status == '200'
829
823
  version_body = JSON.parse(res.body)
@@ -76,7 +76,7 @@ module Calabash
76
76
  # @param [String] version indicates when the feature was deprecated
77
77
  # @param [String] msg deprecation message (possibly suggesting alternatives)
78
78
  # @param [Symbol] type { :warn | :pending } - :pending will raise a
79
- # cucumber pending exception
79
+ # cucumber pending error
80
80
  # @return [void]
81
81
  def _deprecated(version, msg, type)
82
82
  allowed = [:pending, :warn]
@@ -108,4 +108,4 @@ module Calabash
108
108
 
109
109
  end
110
110
  end
111
- end
111
+ end
@@ -3,10 +3,10 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = '0.14.2.pre1'
6
+ VERSION = '0.14.2'
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the Calabash embedded server.
10
- MIN_SERVER_VERSION = '0.14.2.pre1'
10
+ MIN_SERVER_VERSION = '0.14.2'
11
11
  end
12
12
  end
@@ -112,7 +112,7 @@ module Calabash
112
112
  else
113
113
  raise wait_error(msg)
114
114
  end
115
- rescue Exception => e
115
+ rescue => e
116
116
  handle_error_with_options(e, nil, screenshot_on_error)
117
117
  end
118
118
  end
@@ -212,16 +212,17 @@ module Calabash
212
212
  # The same options as {Calabash::Cucumber::WaitHelpers::DEFAULT_OPTS} apply.
213
213
  # @return [nil] when the condition is satisfied
214
214
  # @raise [Calabash::Cucumber::WaitHelpers::WaitError] when the timeout is exceeded
215
- def wait_for_element_does_not_exists(element_query, options={})
215
+ def wait_for_element_does_not_exist(element_query, options={})
216
216
  options[:timeout_message] = options[:timeout_message] || "Timeout waiting for element to not exist: #{element_query}"
217
217
  wait_for(options) { element_does_not_exist(element_query) }
218
218
  end
219
219
 
220
+ alias_method :wait_for_element_does_not_exists, :wait_for_element_does_not_exist
220
221
  # Waits for one or more Calabash queries to all return empty results (typically a UI elements to disappear).
221
222
  # Uses `wait_for`.
222
223
  # @see #wait_for
223
224
  # @see #wait_for_element_exists
224
- # @see #wait_for_element_does_not_exists
225
+ # @see #wait_for_element_does_not_exist
225
226
  # @see Calabash::Cucumber::WaitHelpers::DEFAULT_OPTS
226
227
  #
227
228
  # @param [Array<String>] elements_arr an Array of Calabash queries to be empty (i.e. `element_does_not_exist(element_query)`)
@@ -288,8 +289,8 @@ module Calabash
288
289
  else
289
290
  raise wait_error(msg)
290
291
  end
291
- rescue Exception => e
292
- handle_error_with_options(e,nil, screenshot_on_error)
292
+ rescue => e
293
+ handle_error_with_options(e, nil, screenshot_on_error)
293
294
  end
294
295
  end
295
296
 
@@ -406,23 +407,26 @@ module Calabash
406
407
  end
407
408
 
408
409
  # @!visibility private
409
- # raises an error by raising a exception and conditionally takes a
410
- # screenshot based on the value of +screenshot_on_error+.
411
- # @param [Exception,nil] ex an exception to raise
410
+ # Raises an error by raising a error and conditionally takes a screenshot
411
+ # based on the value of +screenshot_on_error+.
412
+ # @param [RuntimeError,nil] error an error to raise
412
413
  # @param [String,nil] timeout_message the message of the raise
413
414
  # @param [Boolean] screenshot_on_error if true takes a screenshot before
414
415
  # raising an error
415
416
  # @return [nil]
416
- # @raise RuntimeError based on +ex+ and +timeout_message+
417
- def handle_error_with_options(ex, timeout_message, screenshot_on_error)
418
- msg = (timeout_message || ex)
419
- if ex
420
- msg = "#{msg} (#{ex.class})"
417
+ # @raise [StandardError] If `error`, then that kind of error is raised.
418
+ # Otherwise raise a RuntimeError.
419
+ def handle_error_with_options(error, timeout_message, screenshot_on_error)
420
+ msg = (timeout_message || error)
421
+ if error
422
+ error_class = error.class
423
+ else
424
+ error_class = RuntimeError
421
425
  end
422
426
  if screenshot_on_error
423
427
  screenshot_and_raise msg
424
428
  else
425
- raise msg
429
+ raise error_class, msg
426
430
  end
427
431
  end
428
432
 
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2.pre1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ">="
148
148
  - !ruby/object:Gem::Version
149
- version: '1.3'
149
+ version: 1.3.3
150
150
  - - "<"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '2.0'
@@ -156,7 +156,7 @@ dependencies:
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '1.3'
159
+ version: 1.3.3
160
160
  - - "<"
161
161
  - !ruby/object:Gem::Version
162
162
  version: '2.0'
@@ -546,12 +546,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
546
546
  version: '1.9'
547
547
  required_rubygems_version: !ruby/object:Gem::Requirement
548
548
  requirements:
549
- - - ">"
549
+ - - ">="
550
550
  - !ruby/object:Gem::Version
551
- version: 1.3.1
551
+ version: '0'
552
552
  requirements: []
553
553
  rubyforge_project:
554
- rubygems_version: 2.2.2
554
+ rubygems_version: 2.4.5
555
555
  signing_key:
556
556
  specification_version: 4
557
557
  summary: Client for calabash-ios-server for automated functional testing on iOS