calabash-cucumber 0.10.2 → 0.11.0

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
  SHA1:
3
- metadata.gz: 897651c4a4fa6614afc67e03db8ef2e6765460f8
4
- data.tar.gz: a99ac89d631f74da261382d01be1280e09e28a8d
3
+ metadata.gz: 94acd1355fba54a970cdc7586117d81a3e69bbc6
4
+ data.tar.gz: 45cb7d87be59441af30710916bf5979294d578a2
5
5
  SHA512:
6
- metadata.gz: acbdeaff512e94a5dbf62756e684e3bec5cdca1f664c98aca2938dc937b1d03453c61afa8f9989aab30ba91efdea587cdcf088ded1f055d6aa8350d2112ea263
7
- data.tar.gz: b55621291aecd6e071f628509e1ffe75f878ac1bd222493bfb8e53bb4832bf38393473df00d4c2706234ae730023314dbbaf9e9ff7bc77d9dd8f60f6a447f2da
6
+ metadata.gz: 55b4aa00dbb8fa1ea0c9ab585b51166c8114a2e33f91c9ec8327aa8a8f733f5265229d5fbe6aacd85ee7773b138c60cf417d795f76311b32677555b5dac307f8
7
+ data.tar.gz: f0130e5b08f8ff98bd78a245ae6a85859678d80fa1707ff46ba620724721591ce71c9b4fffa2d098fc1831d48e9548dfb07ae9caeed721cf3f5166fb4cd65c99
Binary file
Binary file
@@ -121,7 +121,17 @@ 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
- screen_size = launcher.device.screen_size
124
+ 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
127
+ 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]}
132
+ else
133
+ screen_size = launcher.device.screen_size
134
+ end
125
135
  case orientation
126
136
  when :right
127
137
  cx = rect['center_x']
@@ -118,6 +118,22 @@ module Calabash
118
118
  # @return [String] The udid of this device.
119
119
  attr_accessor :udid
120
120
 
121
+ # For Calabash server version > 0.10.2 provides
122
+ # device specific screen information.
123
+ #
124
+ # This is a hash of form:
125
+ # {
126
+ # :sample => 1,
127
+ # :height => 1334,
128
+ # :width => 750,
129
+ # :scale" => 2
130
+ # }
131
+ #
132
+ #
133
+ # @attribute [r] screen_dimensions
134
+ # @return [Hash] screen dimensions, scale and down/up sampling fraction.
135
+ attr_reader :screen_dimensions
136
+
121
137
  # Creates a new instance of Device.
122
138
  #
123
139
  # @see Calabash::Cucumber::Core#server_version
@@ -135,6 +151,13 @@ module Calabash
135
151
  @server_version = version_data['version']
136
152
  @iphone_app_emulated_on_ipad = version_data['iphone_app_emulated_on_ipad']
137
153
  @iphone_4in = version_data['4inch']
154
+ screen_dimensions = version_data['screen_dimensions']
155
+ if screen_dimensions
156
+ @screen_dimensions = {}
157
+ screen_dimensions.each_pair do |key,val|
158
+ @screen_dimensions[key.to_sym] = val
159
+ end
160
+ end
138
161
  end
139
162
 
140
163
  # Is this device a simulator or physical device?
@@ -224,6 +247,7 @@ module Calabash
224
247
  # @return [Hash] representation of the screen size as a hash with keys
225
248
  # `:width` and `:height`
226
249
  def screen_size
250
+ return screen_dimensions if screen_dimensions
227
251
  return { :width => 768, :height => 1024 } if ipad?
228
252
  return { :width => 320, :height => 568 } if iphone_4in?
229
253
  { :width => 320, :height => 480 }
@@ -386,7 +386,12 @@ module Calabash
386
386
  # @raise [RuntimeError] if the text cannot be typed.
387
387
  def tap_keyboard_action_key
388
388
  if uia_available?
389
- uia_type_string '\n', '', false
389
+ run_loop = Calabash::Cucumber::Launcher.launcher.run_loop
390
+ if run_loop[:uia_strategy] == :host
391
+ uia_type_string "\\\\n", '', false
392
+ else
393
+ uia_type_string '\n', '', false
394
+ end
390
395
  else
391
396
  keyboard_enter_char 'Return'
392
397
  end
@@ -629,16 +629,22 @@ class Calabash::Cucumber::Launcher
629
629
  else
630
630
  target_udid = launch_args[:device_target]
631
631
  target_device = nil
632
- sim_control.xctools.instruments(:devices).each do |device|
632
+ devices_connected = sim_control.xctools.instruments(:devices)
633
+ devices_connected.each do |device|
633
634
  if device.udid == target_udid
634
635
  target_device = device
635
636
  break
636
637
  end
637
638
  end
638
-
639
- # Device could not be found; kick the problem down the road.
640
- return :preferences if target_device.nil?
641
-
639
+ if target_device.nil?
640
+ target_device = devices_connected.first
641
+ if target_device
642
+ launch_args[:device_target] = target_device.udid
643
+ end
644
+ end
645
+ unless target_device
646
+ raise 'No device_target was specified and did not detect a connected device. Set a device_target option in the relaunch method.'
647
+ end
642
648
  # Preferences strategy works for iOS < 8.0, but not for iOS >= 8.0.
643
649
  if target_device.version < RunLoop::Version.new('8.0')
644
650
  :preferences
@@ -3,11 +3,11 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = '0.10.2'
6
+ VERSION = '0.11.0'
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.10.2'
11
+ MIN_SERVER_VERSION = '0.11.0'
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.10.2
4
+ version: 0.11.0
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-01 00:00:00.000000000 Z
11
+ date: 2014-10-05 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.1
433
+ rubygems_version: 2.4.2
434
434
  signing_key:
435
435
  specification_version: 4
436
436
  summary: Client for calabash-ios-server for automated functional testing on iOS