calabash-cucumber 0.10.0 → 0.10.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: 5c85d9115ce76a776bd6f092ae9096cdea9d0880
4
- data.tar.gz: 926a2acd95744bac3039630088b4348f13a074f4
3
+ metadata.gz: 796a5dc37f43d2e7d150bb8929c5e52d16176966
4
+ data.tar.gz: 851e40fd7aaea029233f34abccf91c9e7807fbfa
5
5
  SHA512:
6
- metadata.gz: 21f0e1cf1cbaa40681a878d22e772c45e5027679d9d11965a35c3ad77b3647867301fd897d25476e8f4bd13cabae593855e1a239998eb56b07c92be53665bd04
7
- data.tar.gz: 5958dc93df0f60224aa85be1fa87c0ceb1b0ec79834ed88fa1cd86950445432fa26c2b039ac252748ca995b8ab30dfb78583d1672c096b5f088562ec2a0da94d
6
+ metadata.gz: 0cbd4f06733e34268ba2ecbeec32c9b8cf8e50d61dc09520039b53778fec9dc0f9560107ba417a2c4dac3f29cf2ce47968e8223934f117545825b5a7454b980f
7
+ data.tar.gz: 7e744d481c1125fdedd329be21b14cc4363d5a8f3f6a95e623f76ee921477bf1d231c782efcb807e87bf18bf9136c5acc429b99812155862add9b08bd043a5db
Binary file
Binary file
@@ -6,7 +6,6 @@ require 'calabash-cucumber/actions/instruments_actions'
6
6
  require 'calabash-cucumber/actions/playback_actions'
7
7
  require 'run_loop'
8
8
  require 'cfpropertylist'
9
- require 'calabash-cucumber/version'
10
9
  require 'calabash-cucumber/utils/logging'
11
10
  require 'calabash/dylibs'
12
11
 
@@ -554,7 +553,20 @@ class Calabash::Cucumber::Launcher
554
553
  end
555
554
 
556
555
  if run_with_instruments?(args)
557
- args[:uia_strategy] ||= :preferences
556
+ # Patch for bug in Xcode 6 GM + iOS 8 device testing.
557
+ # http://openradar.appspot.com/radar?id=5891145586442240
558
+ #
559
+ # RunLoop::Core.run_with_options can reuse the SimControl instance. Many
560
+ # of the Xcode tool calls, like instruments -s templates, take a long time
561
+ # to execute. The SimControl instance has XCTool attribute which caches
562
+ # the results of many of these time-consuming calls so they only need to
563
+ # be called 1 time per launch.
564
+ # @todo Use SimControl in Launcher in place of methods like simulator_target?
565
+ args[:sim_control] = RunLoop::SimControl.new
566
+ uia_strategy = default_uia_strategy(args, args[:sim_control])
567
+ args[:uia_strategy] ||= uia_strategy
568
+ calabash_info "Using uia strategy: '#{args[:uia_strategy]}'" if debug_logging?
569
+
558
570
  self.run_loop = new_run_loop(args)
559
571
  self.actions= Calabash::Cucumber::InstrumentsActions.new
560
572
  else
@@ -574,6 +586,37 @@ class Calabash::Cucumber::Launcher
574
586
  end
575
587
  end
576
588
 
589
+ # @!visibility private
590
+ #
591
+ # Choose the appropriate default UIA strategy based on the test target.
592
+ #
593
+ # This is a temporary (I hope) fix for a UIAApplication bug in
594
+ # setPreferencesValueForKey on iOS 8 devices in Xcode 6 GM.
595
+ #
596
+ # rdar://18296714
597
+ # http://openradar.appspot.com/radar?id=5891145586442240
598
+ def default_uia_strategy(launch_args, sim_control)
599
+ # Preferences strategy works on Xcode iOS Simulators.
600
+ if RunLoop::Core.simulator_target?(launch_args, sim_control)
601
+ :preferences
602
+ else
603
+ target_udid = launch_args[:device_target]
604
+ target_device = nil
605
+ sim_control.xctools.instruments(:devices).each do |device|
606
+ if device.udid == target_udid
607
+ target_device = device
608
+ break
609
+ end
610
+ end
611
+ # Preferences strategy works for iOS < 8.0, but not for iOS >= 8.0.
612
+ if target_device.version < RunLoop::Version.new('8.0')
613
+ :preferences
614
+ else
615
+ :host
616
+ end
617
+ end
618
+ end
619
+
577
620
  # @!visibility private
578
621
  def detect_device_from_args(args)
579
622
  if args[:app] && File.directory?(args[:app])
@@ -911,13 +954,13 @@ class Calabash::Cucumber::Launcher
911
954
  @@server_version = self.device.server_version
912
955
  end
913
956
 
914
- # checks the server and gem version compatibility and generates a warning if
957
+ # @!visibility private
958
+ # Checks the server and gem version compatibility and generates a warning if
915
959
  # the server and gem are not compatible.
916
960
  #
917
- # WIP: this is a proof-of-concept implementation and requires _strict_
918
- # equality. in the future we should allow minimum framework compatibility.
961
+ # @note This is a proof-of-concept implementation and requires _strict_
962
+ # equality. in the future we should allow minimum framework compatibility.
919
963
  #
920
- # @!visibility private
921
964
  # @return [nil] nothing to return
922
965
  def check_server_gem_compatibility
923
966
  app_bundle_path = self.launch_args[:app]
@@ -932,18 +975,18 @@ class Calabash::Cucumber::Launcher
932
975
  return nil
933
976
  end
934
977
 
935
- server_version = Calabash::Cucumber::Version.new(server_version)
936
- gem_version = Calabash::Cucumber::Version.new(Calabash::Cucumber::VERSION)
937
- min_server_version = Calabash::Cucumber::Version.new(Calabash::Cucumber::MIN_SERVER_VERSION)
978
+ server_version = RunLoop::Version.new(server_version)
979
+ gem_version = RunLoop::Version.new(Calabash::Cucumber::VERSION)
980
+ min_server_version = RunLoop::Version.new(Calabash::Cucumber::MIN_SERVER_VERSION)
938
981
 
939
982
  if server_version < min_server_version
940
- msgs = []
941
- msgs << 'server version is not compatible with gem version'
942
- msgs << 'please update your server and gem'
943
- msgs << " gem version: '#{gem_version}'"
944
- msgs << "min server version: '#{min_server_version}'"
945
- msgs << " server version: '#{server_version}'"
946
-
983
+ msgs = [
984
+ 'The server version is not compatible with gem version.',
985
+ 'Please update your server.',
986
+ 'https://github.com/calabash/calabash-ios/wiki/B1-Updating-your-Calabash-iOS-version',
987
+ " gem version: '#{gem_version}'",
988
+ "min server version: '#{min_server_version}'",
989
+ " server version: '#{server_version}'"]
947
990
  calabash_warn("#{msgs.join("\n")}")
948
991
  else
949
992
  if full_console_logging?
@@ -1,4 +1,5 @@
1
1
  require 'open3'
2
+ require 'run_loop'
2
3
 
3
4
  module Calabash
4
5
  module Cucumber
@@ -21,10 +22,7 @@ module Calabash
21
22
  #
22
23
  # @return [String] path to current developer directory
23
24
  def xcode_developer_dir
24
- # respect DEVELOPER_DIR
25
- return ENV['DEVELOPER_DIR'] if ENV['DEVELOPER_DIR']
26
- # fall back to xcode-select
27
- `xcode-select --print-path`.chomp
25
+ RunLoop::XCTools.new.xcode_developer_dir
28
26
  end
29
27
 
30
28
  # @deprecated 0.10.0 not replaced
@@ -54,17 +52,11 @@ module Calabash
54
52
  def instruments(cmd=nil)
55
53
  instruments = 'xcrun instruments'
56
54
  return instruments if cmd == nil
57
-
58
55
  case cmd
59
56
  when :version
60
- # instruments, version 5.1.1 (55045)
61
- # noinspection RubyUnusedLocalVariable
62
- Open3.popen3("#{instruments}") do |stdin, stdout, stderr, wait_thr|
63
- stderr.read.chomp.split(' ')[2]
64
- end
57
+ RunLoop::XCTools.new.instruments(cmd).to_s
65
58
  when :sims
66
- devices = `#{instruments} -s devices`.chomp.split("\n")
67
- devices.select { |device| device.downcase.include?('simulator') }
59
+ RunLoop::XCTools.new.instruments(cmd)
68
60
  else
69
61
  candidates = [:version, :sims]
70
62
  raise(ArgumentError, "expected '#{cmd}' to be one of '#{candidates}'")
@@ -82,11 +74,8 @@ module Calabash
82
74
  # a major.minor[.patch] version string
83
75
  #
84
76
  # @return [Boolean] true if the version is >= 5.*
85
- def instruments_supports_hyphen_s?(version=instruments(:version))
86
- tokens = version.split('.')
87
- return false if tokens[0].to_i < 5
88
- return false if tokens[1].to_i < 1
89
- true
77
+ def instruments_supports_hyphen_s?(version)
78
+ RunLoop::XCTools.new.instruments_supports_hyphen_s?(version)
90
79
  end
91
80
 
92
81
  # Returns a list of installed simulators by calling `$ instruments -s devices`.
@@ -96,12 +85,8 @@ module Calabash
96
85
  # @raise [RuntimeError] if the currently active instruments version does
97
86
  # not support the -s flag
98
87
  def installed_simulators
99
- unless instruments_supports_hyphen_s?
100
- raise(RuntimeError, "instruments '#{instruments(:version)}' does not support '-s devices' arguments")
101
- end
102
88
  instruments(:sims)
103
89
  end
104
-
105
90
  end
106
91
  end
107
- end
92
+ end
@@ -1,16 +1,17 @@
1
1
  require 'calabash-cucumber/utils/logging'
2
+ require 'run_loop/version'
2
3
 
3
4
  module Calabash
4
5
  module Cucumber
5
6
 
6
7
  # @!visibility public
7
8
  # The Calabash iOS gem version.
8
- VERSION = '0.10.0'
9
+ VERSION = '0.10.1'
9
10
 
10
11
  # @!visibility public
11
12
  # The minimum required version of the calabash.framework or, for Xamarin
12
13
  # users, the Calabash component.
13
- MIN_SERVER_VERSION = '0.10.0'
14
+ MIN_SERVER_VERSION = '0.10.1'
14
15
 
15
16
  # @!visibility private
16
17
  def self.const_missing(const_name)
@@ -33,320 +34,8 @@ module Calabash
33
34
  #
34
35
  # @see http://semver.org/
35
36
  # @see http://gravitext.com/2012/07/22/versioning.html
36
- class Version
37
-
38
- # @!attribute [rw] major
39
- # @return [Integer] the major version
40
- attr_accessor :major
41
-
42
- # @!attribute [rw] minor
43
- # @return [Integer] the minor version
44
- attr_accessor :minor
45
-
46
- # @!attribute [rw] patch
47
- # @return [Integer] the patch version
48
- attr_accessor :patch
49
-
50
- # @!attribute [rw] pre
51
- # @return [Boolean] true if this is a pre-release version
52
- attr_accessor :pre
53
-
54
- # @!attribute [rw] pre_version
55
- # @return [Integer] if this is a pre-release version, returns the
56
- # pre-release version; otherwise this is nil
57
- attr_accessor :pre_version
58
-
59
- # Creates a new Version instance with all the attributes set.
60
- #
61
- # @example
62
- # version = Version.new(0.10.1)
63
- # version.major => 0
64
- # version.minor => 10
65
- # version.patch => 1
66
- # version.pre => false
67
- # version.pre_release => nil
68
- #
69
- # @example
70
- # version = Version.new(1.6.3.pre5)
71
- # version.major => 1
72
- # version.minor => 6
73
- # version.patch => 3
74
- # version.pre => true
75
- # version.pre_release => 5
76
- #
77
- # @param [String] version the version string to parse.
78
- # @raise [ArgumentError] if version is not in the form 5, 6.1, 7.1.2, 8.2.3.pre1
79
- def initialize(version)
80
- tokens = version.strip.split('.')
81
- count = tokens.count
82
- if tokens.empty?
83
- raise ArgumentError, "expected '#{version}' to be like 5, 6.1, 7.1.2, 8.2.3.pre1"
84
- end
85
-
86
- if count < 4 and tokens.any? { |elm| elm =~ /\D/ }
87
- raise ArgumentError, "expected '#{version}' to be like 5, 6.1, 7.1.2, 8.2.3.pre1"
88
- end
89
-
90
- if count == 4
91
- @pre = tokens[3]
92
- pre_tokens = @pre.scan(/\D+|\d+/)
93
- @pre_version = pre_tokens[1].to_i if pre_tokens.count == 2
94
- end
95
-
96
- @major, @minor, @patch = version.split('.').map(&:to_i)
97
- end
98
-
99
- # Returns an string representation of this version.
100
- # @return [String] a string in the form `<major>.<minor>.<patch>[.pre<N>]`
101
- def to_s
102
- str = [@major, @minor, @patch].compact.join('.')
103
- str = "#{str}.#{@pre}" if @pre
104
- str
105
- end
106
-
107
- # Compare this version to another for equality.
108
- # @param [Version] other the version to compare against
109
- # @return [Boolean] true if this Version is the same as `other`
110
- def == (other)
111
- Version.compare(self, other) == 0
112
- end
113
-
114
- # Compare this version to another for inequality.
115
- # @param [Version] other the version to compare against
116
- # @return [Boolean] true if this Version is not the same as `other`
117
- def != (other)
118
- Version.compare(self, other) != 0
119
- end
120
-
121
- # Is this version less-than another version?
122
- # @param [Version] other the version to compare against
123
- # @return [Boolean] true if this Version is less-than `other`
124
- def < (other)
125
- Version.compare(self, other) < 0
126
- end
127
-
128
- # Is this version greater-than another version?
129
- # @param [Version] other the version to compare against
130
- # @return [Boolean] true if this Version is greater-than `other`
131
- def > (other)
132
- Version.compare(self, other) > 0
133
- end
134
-
135
- # Is this version less-than or equal to another version?
136
- # @param [Version] other the version to compare against
137
- # @return [Boolean] true if this Version is less-than or equal `other`
138
- def <= (other)
139
- Version.compare(self, other) <= 0
140
- end
141
-
142
- # Is this version greater-than or equal to another version?
143
- # @param [Version] other the version to compare against
144
- # @return [Boolean] true if this Version is greater-than or equal `other`
145
- def >= (other)
146
- Version.compare(self, other) >= 0
147
- end
148
-
149
- # Compare version `a` to version `b`.
150
- #
151
- # @example
152
- # compare Version.new(0.10.0), Version.new(0.9.0) => 1
153
- # compare Version.new(0.9.0), Version.new(0.10.0) => -1
154
- # compare Version.new(0.9.0), Version.new(0.9.0) => 0
155
- #
156
- # @return [Integer] an integer `(-1, 1)`
157
- def self.compare(a, b)
158
-
159
- if a.major != b.major
160
- return a.major > b.major ? 1 : -1
161
- end
162
-
163
- if a.minor != b.minor
164
- return a.minor.to_i > b.minor.to_i ? 1 : -1
165
- end
166
-
167
- if a.patch != b.patch
168
- return a.patch.to_i > b.patch.to_i ? 1 : -1
169
- end
170
-
171
- return 1 if a.pre and (not b.pre)
172
- return -1 if (not a.pre) and b.pre
173
-
174
- return 1 if a.pre_version and (not b.pre_version)
175
- return -1 if (not a.pre_version) and b.pre_version
176
-
177
- if a.pre_version != b.pre_version
178
- return a.pre_version.to_i > b.pre_version.to_i ? 1 : -1
179
- end
180
-
181
- 0
182
-
183
- end
184
- end
185
- end
186
- end
187
-
188
- # These are unit tests.
189
- #
190
- # $ ruby lib/calabash-cucumber/version.rb
191
- #
192
- # todo move to rspec
193
- if __FILE__ == $0
194
- require 'test/unit'
195
-
196
- # @!visibility private
197
- # Unit testing of Version class
198
- class LocalTest < Test::Unit::TestCase
199
- include Calabash::Cucumber
200
-
201
- # @!visibility private
202
- def test_version
203
- a = Version.new('0.9.169')
204
- assert_equal(0, a.major)
205
- assert_equal(9, a.minor)
206
- assert_equal(169, a.patch)
207
- assert_nil(a.pre)
208
- assert_nil(a.pre_version)
209
- end
210
-
211
- # @!visibility private
212
- def test_new_passed_invalid_arg
213
-
214
- assert_raise(ArgumentError) { Version.new(' ') }
215
- assert_raise(ArgumentError) { Version.new('5.1.pre3') }
216
- assert_raise(ArgumentError) { Version.new('5.pre2') }
37
+ class Version < RunLoop::Version
217
38
 
218
39
  end
219
-
220
- # @!visibility private
221
- def test_unnumbered_prerelease
222
- a = Version.new('0.9.169.pre')
223
- assert_equal('pre', a.pre)
224
- assert_nil(a.pre_version)
225
- end
226
-
227
- # @!visibility private
228
- def test_numbered_prerelease
229
- a = Version.new('0.9.169.pre1')
230
- assert_equal('pre1', a.pre)
231
- assert_equal(1, a.pre_version)
232
- end
233
-
234
- # @!visibility private
235
- def test_compare_equal
236
- a = Version.new('0.9.169')
237
- b = Version.new('0.9.169')
238
- assert(a == b)
239
-
240
- a = Version.new('0.9.169.pre')
241
- b = Version.new('0.9.169.pre')
242
- assert(a == b)
243
-
244
- a = Version.new('0.9.169.pre2')
245
- b = Version.new('0.9.169.pre2')
246
- assert(a == b)
247
-
248
- end
249
-
250
- # @!visibility private
251
- def test_compare_not_equal
252
- a = Version.new('0.9.168')
253
- b = Version.new('0.9.169')
254
- assert(a != b)
255
-
256
- a = Version.new('0.9.169')
257
- b = Version.new('0.9.169.pre1')
258
- assert(a != b)
259
-
260
- a = Version.new('0.9.169.pre')
261
- b = Version.new('0.9.169.pre1')
262
- assert(a != b)
263
-
264
- a = Version.new('0.9.169.pre1')
265
- b = Version.new('0.9.169.pre2')
266
- assert(a != b)
267
- end
268
-
269
- # @!visibility private
270
- def test_compare_lt
271
- a = Version.new('0.9.168')
272
- b = Version.new('0.9.169')
273
- assert(a < b)
274
-
275
- a = Version.new('0.9.169')
276
- b = Version.new('0.9.169.pre')
277
- assert(a < b)
278
-
279
- a = Version.new('0.9.169.pre')
280
- b = Version.new('0.9.169.pre1')
281
- assert(a < b)
282
-
283
- a = Version.new('0.9.169.pre1')
284
- b = Version.new('0.9.169.pre2')
285
- assert(a < b)
286
- end
287
-
288
- # @!visibility private
289
- def test_compare_gt
290
- a = Version.new('0.9.169')
291
- b = Version.new('0.9.168')
292
- assert(a > b)
293
-
294
- a = Version.new('0.9.169.pre')
295
- b = Version.new('0.9.169')
296
- assert(a > b)
297
-
298
- a = Version.new('0.9.169.pre1')
299
- b = Version.new('0.9.169.pre')
300
- assert(a > b)
301
-
302
- a = Version.new('0.9.169.pre2')
303
- b = Version.new('0.9.169.pre1')
304
- assert(a > b)
305
- end
306
-
307
- # @!visibility private
308
- def test_compare_lte
309
- a = Version.new('0.9.168')
310
- b = Version.new('0.9.169')
311
- assert(a <= b)
312
- a = Version.new('0.9.169')
313
- assert(a <= b)
314
- end
315
-
316
- # @!visibility private
317
- def test_compare_gte
318
- a = Version.new('0.9.169')
319
- b = Version.new('0.9.168')
320
- assert(a >= b)
321
- b = Version.new('0.9.169')
322
- assert(a >= b)
323
- end
324
-
325
- # @!visibility private
326
- def test_compare_missing_patch_level
327
- a = Version.new('6.0')
328
- b = Version.new('5.1.1')
329
- assert(Version.compare(a, b) == 1)
330
- assert(a > b)
331
-
332
- a = Version.new('5.1.1')
333
- b = Version.new('6.0')
334
- assert(Version.compare(a, b) == -1)
335
- assert(a < b)
336
- end
337
-
338
- # @!visibility private
339
- def test_compare_missing_minor_level
340
- a = Version.new('5.1')
341
- b = Version.new('5.1.1')
342
- assert(Version.compare(a, b) == -1)
343
- assert(a < b)
344
-
345
- a = Version.new('5.1.1')
346
- b = Version.new('5.1')
347
- assert(Version.compare(a, b) == 1)
348
- assert(a > b)
349
- end
350
-
351
40
  end
352
41
  end
@@ -46,7 +46,7 @@ module Calabash
46
46
  :timeout_message => 'Timed out waiting...',
47
47
  # Calabash will generate a screenshot by default if waiting times out
48
48
  :screenshot_on_error => true
49
- }.freeze
49
+ }
50
50
 
51
51
  # Waits for a condition to be true. The condition is specified by a given block that is called repeatedly.
52
52
  # If the block returns a 'trueish' value the condition is considered true and
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.0
4
+ version: 0.10.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: 2014-09-09 00:00:00.000000000 Z
11
+ date: 2014-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.0.0
173
+ version: 1.0.3
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.0.0
180
+ version: 1.0.3
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rake
183
183
  requirement: !ruby/object:Gem::Requirement