calabash-cucumber 0.11.1 → 0.11.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: c9c2af2c421cc8b5591f4f53788ca95ec30c0d8d
4
- data.tar.gz: 175d3508a423c054439efccb4f348c55bacacfbc
3
+ metadata.gz: f4e1515ec07504b838591d799f0882cc36b2c2f9
4
+ data.tar.gz: 5a4b7ef139d00377932957cdc3fb65ca30e04730
5
5
  SHA512:
6
- metadata.gz: 4e1d08001d117164b4a8ecb0502b33c1095fdd959b59c262aae6a7f3ca4b53351a04b408f2ca0321a67bc14a034624997cbe2f8d0213f227a3f3e629411865b3
7
- data.tar.gz: 0f1c5499d7ecaffb32739e338c031d218d90c28750a7767771c54474587fb41af394b4afe87b7c30d5e22311fcce8c1fa16874f8e5c4eb84f27712c9c792ae59
6
+ metadata.gz: 807106d6b80c97daa0a92e99732eb21b910b238a94eec7849414a046fd65035772e5f724bae20cf31258e727fdc4e370312a03c9e4bad7405121e32520d53336
7
+ data.tar.gz: d2a41bca839974a8d143164649b9144f1fd4fa0a669a2ed9a36b4b99d108774bc74fc7d053ff6930d3caaf2fc1ae8fd8a15378567d764cc3ebde550e15a75a5d
Binary file
Binary file
@@ -121,17 +121,25 @@ class Calabash::Cucumber::InstrumentsActions
121
121
  def normalize_rect_for_orientation!(orientation, rect)
122
122
  orientation = orientation.to_sym
123
123
  launcher = Calabash::Cucumber::Launcher.launcher
124
+
125
+ # Coordinate translations for orientation is handled in the server for iOS 8+
126
+ # https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICoordinateSpace_protocol/index.html
124
127
  if launcher.ios_major_version.to_i >= 8
125
- return ## Orientation management changed in iOS 8:
126
- # ## https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICoordinateSpace_protocol/index.html
128
+ return
127
129
  end
128
- dimensions = launcher.device.screen_dimensions
129
- if dimensions
130
- screen_size = {width: dimensions[:width]*dimensions[:sample]/dimensions[:scale],
131
- height: dimensions[:height]*dimensions[:sample]/dimensions[:scale]}
130
+
131
+ # We cannot use Device#screen_dimensions here because on iPads the height
132
+ # and width are the opposite of what we expect.
133
+ # @todo Move all coordinate/orientation translation into the server.
134
+ device = launcher.device
135
+ if device.ipad?
136
+ screen_size = { :width => 768, :height => 1024 }
137
+ elsif device.iphone_4in?
138
+ screen_size = { :width => 320, :height => 568 }
132
139
  else
133
- screen_size = launcher.device.screen_size
140
+ screen_size = { :width => 320, :height => 480 }
134
141
  end
142
+
135
143
  case orientation
136
144
  when :right
137
145
  cx = rect['center_x']
@@ -150,5 +158,4 @@ class Calabash::Cucumber::InstrumentsActions
150
158
  # no-op by design.
151
159
  end
152
160
  end
153
-
154
- end
161
+ end
@@ -220,6 +220,12 @@ module Calabash
220
220
  version_hash(ios_version)[:major_version]
221
221
  end
222
222
 
223
+ # Is this device running iOS 8?
224
+ # @return [Boolean] true if the major version of the OS is 8
225
+ def ios8?
226
+ ios_major_version.eql?('8')
227
+ end
228
+
223
229
  # Is this device running iOS 7?
224
230
  # @return [Boolean] true if the major version of the OS is 7
225
231
  def ios7?
@@ -238,15 +244,13 @@ module Calabash
238
244
  ios_major_version.eql?('5')
239
245
  end
240
246
 
241
- # The screen size of the device.
247
+ # @deprecated 0.11.2 Replaced with screen_dimensions.
242
248
  #
243
- # @note These values are not dynamically computed; they are constants.
244
- #
245
- # @note These values are for portrait or upside orientations
249
+ # The screen size of the device.
246
250
  #
247
- # @return [Hash] representation of the screen size as a hash with keys
248
- # `:width` and `:height`
251
+ # @return [Hash] representation of the screen size
249
252
  def screen_size
253
+ _deprecated('0.11.2', 'Replaced with screen_dimensions', :warn)
250
254
  return screen_dimensions if screen_dimensions
251
255
  return { :width => 768, :height => 1024 } if ipad?
252
256
  return { :width => 320, :height => 568 } if iphone_4in?
@@ -155,6 +155,18 @@ module Calabash
155
155
  _OS_ENV.eql?(_canonical_os_version(:ios7)) || _default_device_or_create().ios7?
156
156
  end
157
157
 
158
+ # Is the device under test running iOS 8?
159
+ #
160
+ # @note
161
+ # **WARNING:** The `OS` env variable has been deprecated and should
162
+ # never be set.
163
+ #
164
+ # @raise [RuntimeError] if the server cannot be reached
165
+ # @return [Boolean] true if device under test is running iOS 8
166
+ def ios8?
167
+ _default_device_or_create.ios8?
168
+ end
169
+
158
170
  # Is the app that is being tested an iPhone app emulated on an iPad?
159
171
  #
160
172
  # @see Calabash::Cucumber::IPad
@@ -961,7 +961,7 @@ class Calabash::Cucumber::Launcher
961
961
 
962
962
  server_version = nil
963
963
  exe_paths.each do |path|
964
- server_version_string = `strings "#{path}" | grep -E 'CALABASH VERSION'`.chomp!
964
+ server_version_string = `xcrun strings "#{path}" | grep -E 'CALABASH VERSION'`.chomp!
965
965
  if server_version_string
966
966
  server_version = server_version_string.split(' ').last
967
967
  break
@@ -26,7 +26,13 @@ module Calabash
26
26
  case run_loop[:uia_strategy]
27
27
  when :preferences
28
28
  res = http({:method => :post, :path => 'uia'}, {:command => command}.merge(options))
29
- res = JSON.parse(res)
29
+
30
+ begin
31
+ res = JSON.parse(res)
32
+ rescue TypeError, JSON::ParserError => _
33
+ raise "Could not parse response '#{res}'; the app has probably crashed"
34
+ end
35
+
30
36
  if res['outcome'] != 'SUCCESS'
31
37
  raise "uia action failed because: #{res['reason']}\n#{res['details']}"
32
38
  end
@@ -234,13 +240,32 @@ module Calabash
234
240
  indexes = string.enum_for(:scan, /\\/).map { Regexp.last_match.begin(0) }
235
241
  indexes.reverse.each { |idx| string = string.insert(idx, '\\') }
236
242
  end
237
- res = uia_handle_command(:typeString, string, opt_text_before)
238
- status = res['status']
239
- if status.eql?('error')
240
- value = res['value']
241
- raise "could not type '#{string}' - '#{value}'"
243
+ result = uia_handle_command(:typeString, string, opt_text_before)
244
+
245
+ # When 'status' == 'success', we get back result['value']. Sometimes,
246
+ # the 'value' key is not present in the result - in which case we assume
247
+ # success without error.
248
+ return if result.nil?
249
+
250
+ # Typing on UIWebViews returns result['value'] => ':nil'. There might
251
+ # be other cases where result is _not_ a Hash.
252
+ return unless result.is_a? Hash
253
+
254
+ # If there is no 'status' key, then we assume success. Syntax errors
255
+ # should be caught upstream.
256
+ # https://github.com/calabash/calabash-ios/issues/374
257
+ return unless result.has_key? 'status'
258
+
259
+ status = result['status']
260
+
261
+ # If status is not 'error' we punt. Should never happen.
262
+ return if status != 'error'
263
+
264
+ if result.has_key? 'value'
265
+ raise "Could not type '#{string}' - UIAutomation returned an error: '#{result['value']}'"
266
+ else
267
+ raise "Could not type '#{string}' - UIAutomation returned '#{result}'"
242
268
  end
243
- status
244
269
  end
245
270
 
246
271
  # @!visibility private
@@ -385,8 +410,6 @@ module Calabash
385
410
  s
386
411
  end
387
412
  end
388
-
389
-
390
413
  end
391
414
  end
392
415
  end
@@ -3,11 +3,11 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = '0.11.1'
6
+ VERSION = '0.11.2'
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the calabash.framework or, for Xamarin
10
10
  # users, the Calabash component.
11
- MIN_SERVER_VERSION = '0.11.1'
11
+ MIN_SERVER_VERSION = '0.11.2'
12
12
  end
13
13
  end
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.11.1
4
+ version: 0.11.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: 2014-10-15 00:00:00.000000000 Z
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -430,7 +430,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
430
430
  version: '0'
431
431
  requirements: []
432
432
  rubyforge_project:
433
- rubygems_version: 2.4.2
433
+ rubygems_version: 2.2.2
434
434
  signing_key:
435
435
  specification_version: 4
436
436
  summary: Client for calabash-ios-server for automated functional testing on iOS