calabash-cucumber 0.15.0 → 0.16.1

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: 1162678765d96a589e12bdf06d092d2f0eba972a
4
- data.tar.gz: 4c68a868778d5fac3f875a2c709c1329e4330791
3
+ metadata.gz: f501008ee0e1a3152d8b681c2a6ccc5463a14057
4
+ data.tar.gz: 09c4bf7340eeb0f0b4ea96f1db3f477f829a68e0
5
5
  SHA512:
6
- metadata.gz: da411ca25785cad3d76cbc52745708a9af974d1aed3d9d855e0231afb6d21486ec71a9ff9f980bf25c2bdad61742d244695c9f799e763f42f12328c3f82a8335
7
- data.tar.gz: 0cca1e98616a717243bb4727e64ce41a2befaecc9f6fc6b54f5421723ff696c53435b42e986daa43a72bb55387f177058233119af367b80989d43cb62ac55c56
6
+ metadata.gz: 2bd0c0c774158fd2e8d3789b45a816ecf90b1073e17710c2f5869460fccc9ac8eb75e040c1d21ea84671cce24666467af8afc9e93c84f742a6e89f137ae7c6f0
7
+ data.tar.gz: 7b8e3efec441d1af9e46352c136b0ed95a7b875a29f04a1827ec6e62062a15e7d6ab08dac6709b0a930ca1f526236e5c0ec3098b793cfa927892bb3be8e7bd38
Binary file
Binary file
@@ -244,6 +244,12 @@ module Calabash
244
244
  version_hash(ios_version)[:major_version]
245
245
  end
246
246
 
247
+ # Is this device running iOS 9?
248
+ # @return [Boolean] true if the major version of the OS is 9
249
+ def ios9?
250
+ ios_major_version == '9'
251
+ end
252
+
247
253
  # Is this device running iOS 8?
248
254
  # @return [Boolean] true if the major version of the OS is 8
249
255
  def ios8?
@@ -123,6 +123,18 @@ module Calabash
123
123
  _default_device_or_create.iphone_35in?
124
124
  end
125
125
 
126
+ # The iOS version on the device under test.
127
+ #
128
+ # @note
129
+ # **WARNING:** The `OS` env variable has been deprecated and should
130
+ # never be set.
131
+ #
132
+ # @raise [RuntimeError] If the server cannot be reached.
133
+ # @return [RunLoop::Version] The version of the iOS running on the device.
134
+ def ios_version
135
+ RunLoop::Version.new(_default_device_or_create.ios_version)
136
+ end
137
+
126
138
  # Is the device under test running iOS 5?
127
139
  #
128
140
  # @note
@@ -180,6 +192,18 @@ module Calabash
180
192
  _default_device_or_create.ios8?
181
193
  end
182
194
 
195
+ # Is the device under test running iOS 9?
196
+ #
197
+ # @note
198
+ # **WARNING:** The `OS` env variable has been deprecated and should
199
+ # never be set.
200
+ #
201
+ # @raise [RuntimeError] if the server cannot be reached
202
+ # @return [Boolean] true if device under test is running iOS 9
203
+ def ios9?
204
+ _default_device_or_create.ios9?
205
+ end
206
+
183
207
  # Is the app that is being tested an iPhone app emulated on an iPad?
184
208
  #
185
209
  # @see Calabash::Cucumber::IPad
@@ -122,8 +122,7 @@ class Calabash::Cucumber::Launcher
122
122
  # Sets the device attribute.
123
123
  ensure_connectivity(merged_options[:max_retry], merged_options[:timeout])
124
124
 
125
- # The default strategy for iOS 8 devices is :host.
126
- if strategy_from_options.nil? && self.device.ios_major_version > '8'
125
+ if strategy_from_options.nil? && xcode.version_gte_7?
127
126
  self.run_loop = RunLoop::HostCache.default.read
128
127
  return self
129
128
  end
@@ -666,36 +665,40 @@ class Calabash::Cucumber::Launcher
666
665
  # @param [RunLoop::SimControl] sim_control Used to find simulators.
667
666
  # @param [RunLoop::Instruments] instruments Used to find physical devices.
668
667
  def default_uia_strategy(launch_args, sim_control, instruments)
669
- # Preferences strategy works on Xcode iOS Simulators.
670
- if RunLoop::Core.simulator_target?(launch_args, sim_control)
671
- :preferences
668
+
669
+ xcode = sim_control.xcode
670
+ if xcode.version_gte_7?
671
+ :host
672
672
  else
673
- target_udid = launch_args[:device_target]
674
- target_device = nil
675
- devices_connected = instruments.physical_devices
676
- devices_connected.each do |device|
677
- if device.udid == target_udid
678
- target_device = device
679
- break
680
- end
681
- end
673
+ udid_or_name = launch_args[:device_target]
682
674
 
683
- # -1 for manipulating the launch_args in this method!
684
- # This work should not be done here!
685
- # @todo Do not modify launch_args in default_uia_strategy method
686
- if target_device.nil?
687
- target_device = devices_connected.first
688
- if target_device
689
- launch_args[:device_target] = target_device.udid
690
- end
675
+ # Can't make a determination, so return :host because it works everywhere.
676
+ return :host if udid_or_name == nil || udid_or_name == ''
677
+
678
+ # The default.
679
+ # No DEVICE_TARGET is set and no option was passed to relaunch.
680
+ return :preferences if udid_or_name.downcase.include?('simulator')
681
+
682
+ simulator = sim_control.simulators.find do |sim|
683
+ sim.instruments_identifier(xcode) == udid_or_name ||
684
+ sim.udid == udid_or_name
691
685
  end
692
- unless target_device
693
- raise 'No device_target was specified and did not detect a connected device. Set a device_target option in the relaunch method.'
686
+
687
+ return :preferences if simulator
688
+
689
+ physical_device = instruments.physical_devices.find do |device|
690
+ device.name == udid_or_name ||
691
+ device.udid == udid_or_name
694
692
  end
695
- # Preferences strategy works for iOS < 8.0, but not for iOS >= 8.0.
696
- if target_device.version < RunLoop::Version.new('8.0')
697
- :preferences
693
+
694
+ if physical_device
695
+ if physical_device.version < RunLoop::Version.new('8.0')
696
+ :preferences
697
+ else
698
+ :host
699
+ end
698
700
  else
701
+ # Return host because it works everywhere.
699
702
  :host
700
703
  end
701
704
  end
@@ -888,11 +891,32 @@ class Calabash::Cucumber::Launcher
888
891
  (ENV['DEVICE_TARGET'] != nil) && (not simulator_target?)
889
892
  end
890
893
 
894
+ # @!visibility private
895
+ def discover_device_target(launch_args)
896
+ ENV['DEVICE_TARGET'] || launch_args[:device_target]
897
+ end
898
+
891
899
  # @!visibility private
892
900
  def simulator_target?(launch_args={})
893
- value = ENV['DEVICE_TARGET'] || launch_args[:device_target]
894
- return false if value.nil?
895
- value.downcase.include?('simulator')
901
+ udid_or_name = discover_device_target(launch_args)
902
+
903
+ return false if udid_or_name.nil? || udid_or_name == ''
904
+
905
+ return true if udid_or_name.downcase.include?('simulator')
906
+
907
+ return false if udid_or_name[RunLoop::Regex::DEVICE_UDID_REGEX, 0] != nil
908
+
909
+ if xcode.version_gte_6?
910
+ sim_control = launch_args[:sim_control] || RunLoop::SimControl.new
911
+ simulator = sim_control.simulators.find do |sim|
912
+ sim.instruments_identifier(xcode) == udid_or_name ||
913
+ sim.udid == udid_or_name
914
+ end
915
+
916
+ !simulator.nil?
917
+ else
918
+ false
919
+ end
896
920
  end
897
921
 
898
922
  # @!visibility private
@@ -55,8 +55,18 @@ module Calabash
55
55
 
56
56
  # @!visibility private
57
57
  def load_playback_data(recording_name, options={})
58
+
58
59
  device = options['DEVICE'] || ENV['DEVICE'] || 'iphone'
59
60
 
61
+ # Xcode 7/iOS 9 - Playback file not found for rotation #837
62
+ # As of iOS 7 and Xcode 5.1.1, the only part of the playback API that
63
+ # is being used is the rotation API. We've incorrectly been using
64
+ # iPhone recordings for iPad rotations. The iPhone recordings are
65
+ # working, so I am not inclined to make any dramatic changes.
66
+ if device != 'iphone' || device != 'ipad'
67
+ device = 'iphone'
68
+ end
69
+
60
70
  major = Calabash::Cucumber::Launcher.launcher.ios_major_version
61
71
 
62
72
  unless major
@@ -212,4 +222,4 @@ EOF
212
222
 
213
223
  end
214
224
  end
215
- end
225
+ end
@@ -3,10 +3,10 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = '0.15.0'
6
+ VERSION = '0.16.1'
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the Calabash embedded server.
10
- MIN_SERVER_VERSION = '0.15.0'
10
+ MIN_SERVER_VERSION = '0.16.1'
11
11
  end
12
12
  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.15.0
4
+ version: 0.16.1
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-09-07 00:00:00.000000000 Z
11
+ date: 2015-09-14 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.5.0
149
+ version: 1.5.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.5.0
159
+ version: 1.5.3
160
160
  - - "<"
161
161
  - !ruby/object:Gem::Version
162
162
  version: '2.0'