calabash-cucumber 0.10.1 → 0.10.2
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 +4 -4
- data/dylibs/libCalabashDyn.dylib +0 -0
- data/dylibs/libCalabashDynSim.dylib +0 -0
- data/lib/calabash-cucumber.rb +1 -0
- data/lib/calabash-cucumber/core.rb +36 -3
- data/lib/calabash-cucumber/deprecated.rb +34 -0
- data/lib/calabash-cucumber/launch/simulator_launcher.rb +2 -1
- data/lib/calabash-cucumber/launcher.rb +58 -27
- data/lib/calabash-cucumber/utils/simulator_accessibility.rb +3 -4
- data/lib/calabash-cucumber/version.rb +2 -30
- data/staticlib/calabash.framework.zip +0 -0
- data/staticlib/libFrankCalabash.a +0 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 897651c4a4fa6614afc67e03db8ef2e6765460f8
|
4
|
+
data.tar.gz: a99ac89d631f74da261382d01be1280e09e28a8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acbdeaff512e94a5dbf62756e684e3bec5cdca1f664c98aca2938dc937b1d03453c61afa8f9989aab30ba91efdea587cdcf088ded1f055d6aa8350d2112ea263
|
7
|
+
data.tar.gz: b55621291aecd6e071f628509e1ffe75f878ac1bd222493bfb8e53bb4832bf38393473df00d4c2706234ae730023314dbbaf9e9ff7bc77d9dd8f60f6a447f2da
|
data/dylibs/libCalabashDyn.dylib
CHANGED
Binary file
|
Binary file
|
data/lib/calabash-cucumber.rb
CHANGED
@@ -761,13 +761,46 @@ module Calabash
|
|
761
761
|
res['result']
|
762
762
|
end
|
763
763
|
|
764
|
-
#
|
765
|
-
|
764
|
+
# Attempts to shut the app down gracefully by simulating the transition
|
765
|
+
# to closed steps. The server will attempt to ensure that the following
|
766
|
+
# UIApplicationDelegate methods methods are called (in order).
|
767
|
+
#
|
768
|
+
# ```
|
769
|
+
# - (void)applicationWillResignActive:(UIApplication *)application
|
770
|
+
# - (void)applicationWillTerminate:(UIApplication *)application
|
771
|
+
# ```
|
772
|
+
#
|
773
|
+
# @todo Shutdown the CalabashServer and close connections.
|
774
|
+
#
|
775
|
+
# @param [Hash] opts Options for controlling the app shutdown process.
|
776
|
+
# @option opts [Float] :post_resign_active_delay (0.4) How long to wait
|
777
|
+
# after calling 'application will resign active' before calling
|
778
|
+
# 'app will terminate'.
|
779
|
+
# @option opts [Float] :post_will_terminate_delay (0.4) How long to wait
|
780
|
+
# after calling 'application will resign active' before calling 'exit'.
|
781
|
+
# @option opts [Integer] :exit_code What code should the application
|
782
|
+
# exit with? This exit code may or may not be used! If the
|
783
|
+
# UIApplication responds to `terminateWithSuccess`, then that method will
|
784
|
+
# be called. The exit code for `terminateWithSuccess` is undefined.
|
785
|
+
def calabash_exit(opts={})
|
786
|
+
default_opts = {:post_resign_active_delay => 0.4,
|
787
|
+
:post_will_terminate_delay => 0.4,
|
788
|
+
:exit_code => 0}
|
789
|
+
merged_opts = default_opts.merge(opts)
|
766
790
|
# Exiting the app shuts down the HTTP connection and generates ECONNREFUSED,
|
767
791
|
# or HTTPClient::KeepAliveDisconnected
|
768
792
|
# which needs to be suppressed.
|
769
793
|
begin
|
770
|
-
http({
|
794
|
+
http({
|
795
|
+
:method => :post,
|
796
|
+
:path => 'exit',
|
797
|
+
:retryable_errors => Calabash::Cucumber::HTTPHelpers::RETRYABLE_ERRORS - [Errno::ECONNREFUSED, HTTPClient::KeepAliveDisconnected]
|
798
|
+
}, {
|
799
|
+
:post_resign_active_delay => merged_opts[:post_resign_active_delay],
|
800
|
+
:post_will_terminate_delay => merged_opts[:post_will_terminate_delay],
|
801
|
+
:exit_code => merged_opts[:exit_code]
|
802
|
+
}
|
803
|
+
)
|
771
804
|
rescue Errno::ECONNREFUSED, HTTPClient::KeepAliveDisconnected
|
772
805
|
[]
|
773
806
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'run_loop'
|
2
|
+
require 'calabash-cucumber/utils/logging'
|
3
|
+
|
4
|
+
module Calabash
|
5
|
+
module Cucumber
|
6
|
+
|
7
|
+
include Calabash::Cucumber::Logging
|
8
|
+
|
9
|
+
# @!visibility private
|
10
|
+
def self.const_missing(const_name)
|
11
|
+
if const_name == :FRAMEWORK_VERSION
|
12
|
+
_deprecated('0.9.169', 'FRAMEWORK_VERSION has been deprecated - there is no replacement', :warn)
|
13
|
+
return nil
|
14
|
+
end
|
15
|
+
raise(NameError, "uninitialized constant Calabash::Cucumber::#{const_name}")
|
16
|
+
end
|
17
|
+
|
18
|
+
# A model of a release version that can be used to compare two version.
|
19
|
+
#
|
20
|
+
# Calabash tries very hard to comply with Semantic Versioning rules. However,
|
21
|
+
# the semantic versioning spec is incompatible with RubyGem's patterns for
|
22
|
+
# pre-release gems.
|
23
|
+
#
|
24
|
+
# > "But returning to the practical: No release version of SemVer is compatible with Rubygems." - _David Kellum_
|
25
|
+
#
|
26
|
+
# Calabash version numbers will be in the form `<major>.<minor>.<patch>[.pre<N>]`.
|
27
|
+
#
|
28
|
+
# @see http://semver.org/
|
29
|
+
# @see http://gravitext.com/2012/07/22/versioning.html
|
30
|
+
class Version < RunLoop::Version
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -3,6 +3,7 @@ require 'json'
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'cfpropertylist'
|
5
5
|
require 'calabash-cucumber/utils/logging'
|
6
|
+
require 'run_loop'
|
6
7
|
|
7
8
|
module Calabash
|
8
9
|
module Cucumber
|
@@ -71,7 +72,7 @@ module Calabash
|
|
71
72
|
|
72
73
|
# Stops (quits) the simulator.
|
73
74
|
def stop
|
74
|
-
|
75
|
+
RunLoop::SimControl.new.quit_sim
|
75
76
|
end
|
76
77
|
|
77
78
|
|
@@ -250,31 +250,54 @@ class Calabash::Cucumber::Launcher
|
|
250
250
|
default_opts = {:sdk => nil, :path => nil}
|
251
251
|
merged_opts = default_opts.merge opts
|
252
252
|
|
253
|
-
|
254
|
-
|
253
|
+
sim_control = opts.fetch(:sim_control, RunLoop::SimControl.new)
|
254
|
+
if sim_control.xcode_version_gte_6?
|
255
|
+
default_sim = RunLoop::Core.default_simulator(sim_control.xctools)
|
256
|
+
name_or_udid = merged_opts[:udid] || ENV['DEVICE_TARGET'] || default_sim
|
257
|
+
|
258
|
+
target_simulator = nil
|
259
|
+
sim_control.simulators.each do |device|
|
260
|
+
instruments_launch_name = "#{device.name} (#{device.version.to_s} Simulator)"
|
261
|
+
if instruments_launch_name == name_or_udid or device.udid == name_or_udid
|
262
|
+
target_simulator = device
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
if target_simulator.nil?
|
267
|
+
raise "Could not find a simulator that matches '#{name_or_udid}'"
|
268
|
+
end
|
255
269
|
|
256
|
-
|
270
|
+
sim_control.reset_sim_content_and_settings({:sim_udid => target_simulator.udid})
|
271
|
+
else
|
272
|
+
sdk ||= merged_opts[:sdk] || sdk_version || self.simulator_launcher.sdk_detector.latest_sdk_version
|
273
|
+
path ||= merged_opts[:path] || self.simulator_launcher.app_bundle_or_raise(app_path)
|
257
274
|
|
258
|
-
|
259
|
-
app_dir = File.expand_path("#{sdk_dir}/Applications")
|
260
|
-
next unless File.exists?(app_dir)
|
275
|
+
app = File.basename(path)
|
261
276
|
|
262
|
-
|
277
|
+
directories_for_sdk_prefix(sdk).each do |sdk_dir|
|
278
|
+
app_dir = File.expand_path("#{sdk_dir}/Applications")
|
279
|
+
next unless File.exists?(app_dir)
|
263
280
|
|
264
|
-
|
281
|
+
bundle = `find "#{app_dir}" -type d -depth 2 -name "#{app}" | head -n 1`
|
265
282
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
283
|
+
next if bundle.empty? # Assuming we're already clean
|
284
|
+
|
285
|
+
if debug_logging?
|
286
|
+
puts "Reset app state for #{bundle}"
|
287
|
+
end
|
288
|
+
sandbox = File.dirname(bundle)
|
289
|
+
['Library', 'Documents', 'tmp'].each do |content_dir|
|
290
|
+
FileUtils.rm_rf(File.join(sandbox, content_dir))
|
291
|
+
end
|
272
292
|
end
|
273
293
|
end
|
274
294
|
end
|
275
295
|
|
276
|
-
#
|
277
|
-
#
|
296
|
+
# Erases the contents and setting for every available simulator.
|
297
|
+
#
|
298
|
+
# For Xcode 6, this is equivalent to calling: `$ xcrun simctl erase` on
|
299
|
+
# every available simulator. For Xcode < 6, it is equivalent to touching
|
300
|
+
# the 'Reset Content & Settings' menu item.
|
278
301
|
#
|
279
302
|
# @note
|
280
303
|
# **WARNING** This is a destructive operation. You have been warned.
|
@@ -282,9 +305,9 @@ class Calabash::Cucumber::Launcher
|
|
282
305
|
# @raise RuntimeError if called when targeting a physical device
|
283
306
|
def reset_simulator
|
284
307
|
if device_target?
|
285
|
-
raise "
|
308
|
+
raise "Calling 'reset_simulator' when targeting a device is not allowed"
|
286
309
|
end
|
287
|
-
|
310
|
+
RunLoop::SimControl.new.reset_sim_content_and_settings
|
288
311
|
end
|
289
312
|
|
290
313
|
# @!visibility private
|
@@ -484,8 +507,17 @@ class Calabash::Cucumber::Launcher
|
|
484
507
|
#TODO stopping is currently broken, but this works anyway because instruments stop the process before relaunching
|
485
508
|
RunLoop.stop(run_loop) if run_loop
|
486
509
|
|
510
|
+
# @todo Don't overwrite the _args_ parameter!
|
487
511
|
args = default_launch_args.merge(args)
|
488
512
|
|
513
|
+
# RunLoop::Core.run_with_options can reuse the SimControl instance. Many
|
514
|
+
# of the Xcode tool calls, like instruments -s templates, take a long time
|
515
|
+
# to execute. The SimControl instance has XCTool attribute which caches
|
516
|
+
# the results of many of these time-consuming calls so they only need to
|
517
|
+
# be called 1 time per launch.
|
518
|
+
# @todo Use SimControl in Launcher in place of methods like simulator_target?
|
519
|
+
args[:sim_control] = RunLoop::SimControl.new
|
520
|
+
|
489
521
|
args[:app] = args[:app] || args[:bundle_id] || app_path || detect_app_bundle_from_args(args)
|
490
522
|
|
491
523
|
|
@@ -530,7 +562,10 @@ class Calabash::Cucumber::Launcher
|
|
530
562
|
if sdk.nil? and args[:device_target] == 'simulator'
|
531
563
|
sdk = :all
|
532
564
|
end
|
533
|
-
reset_app_sandbox({:sdk => sdk,
|
565
|
+
reset_app_sandbox({:sdk => sdk,
|
566
|
+
:path => args[:app],
|
567
|
+
:udid => args[:udid],
|
568
|
+
:sim_control => args[:sim_control]})
|
534
569
|
end
|
535
570
|
|
536
571
|
if args[:privacy_settings]
|
@@ -555,14 +590,6 @@ class Calabash::Cucumber::Launcher
|
|
555
590
|
if run_with_instruments?(args)
|
556
591
|
# Patch for bug in Xcode 6 GM + iOS 8 device testing.
|
557
592
|
# 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
593
|
uia_strategy = default_uia_strategy(args, args[:sim_control])
|
567
594
|
args[:uia_strategy] ||= uia_strategy
|
568
595
|
calabash_info "Using uia strategy: '#{args[:uia_strategy]}'" if debug_logging?
|
@@ -608,6 +635,10 @@ class Calabash::Cucumber::Launcher
|
|
608
635
|
break
|
609
636
|
end
|
610
637
|
end
|
638
|
+
|
639
|
+
# Device could not be found; kick the problem down the road.
|
640
|
+
return :preferences if target_device.nil?
|
641
|
+
|
611
642
|
# Preferences strategy works for iOS < 8.0, but not for iOS >= 8.0.
|
612
643
|
if target_device.version < RunLoop::Version.new('8.0')
|
613
644
|
:preferences
|
@@ -3,6 +3,7 @@ require 'calabash-cucumber/utils/plist_buddy'
|
|
3
3
|
require 'calabash-cucumber/utils/logging'
|
4
4
|
require 'sim_launcher'
|
5
5
|
require 'cfpropertylist'
|
6
|
+
require 'run_loop'
|
6
7
|
|
7
8
|
module Calabash
|
8
9
|
module Cucumber
|
@@ -30,14 +31,12 @@ module Calabash
|
|
30
31
|
# simulator, but in case we can, this method will quit the simulator
|
31
32
|
# that is indicated by `xcode-select` or `DEVELOPER_DIR`.
|
32
33
|
def quit_simulator
|
33
|
-
|
34
|
-
system "/usr/bin/osascript -e 'tell application \"#{dev_dir}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app\" to quit'"
|
34
|
+
RunLoop::SimControl.new.quit_sim
|
35
35
|
end
|
36
36
|
|
37
37
|
# Launches the iOS Simulator indicated by `xcode-select` or `DEVELOPER_DIR`.
|
38
38
|
def launch_simulator
|
39
|
-
|
40
|
-
system "open -a \"#{dev_dir}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app\""
|
39
|
+
RunLoop::SimControl.new.launch_sim
|
41
40
|
end
|
42
41
|
|
43
42
|
# Resets the simulator content and settings. It is analogous to touching
|
@@ -1,41 +1,13 @@
|
|
1
|
-
require 'calabash-cucumber/utils/logging'
|
2
|
-
require 'run_loop/version'
|
3
|
-
|
4
1
|
module Calabash
|
5
2
|
module Cucumber
|
6
3
|
|
7
4
|
# @!visibility public
|
8
5
|
# The Calabash iOS gem version.
|
9
|
-
VERSION = '0.10.
|
6
|
+
VERSION = '0.10.2'
|
10
7
|
|
11
8
|
# @!visibility public
|
12
9
|
# The minimum required version of the calabash.framework or, for Xamarin
|
13
10
|
# users, the Calabash component.
|
14
|
-
MIN_SERVER_VERSION = '0.10.
|
15
|
-
|
16
|
-
# @!visibility private
|
17
|
-
def self.const_missing(const_name)
|
18
|
-
if const_name == :FRAMEWORK_VERSION
|
19
|
-
_deprecated('0.9.169', 'FRAMEWORK_VERSION has been deprecated - there is no replacement', :warn)
|
20
|
-
return nil
|
21
|
-
end
|
22
|
-
raise(NameError, "uninitialized constant Calabash::Cucumber::#{const_name}")
|
23
|
-
end
|
24
|
-
|
25
|
-
# A model of a release version that can be used to compare two version.
|
26
|
-
#
|
27
|
-
# Calabash tries very hard to comply with Semantic Versioning rules. However,
|
28
|
-
# the semantic versioning spec is incompatible with RubyGem's patterns for
|
29
|
-
# pre-release gems.
|
30
|
-
#
|
31
|
-
# > "But returning to the practical: No release version of SemVer is compatible with Rubygems." - _David Kellum_
|
32
|
-
#
|
33
|
-
# Calabash version numbers will be in the form `<major>.<minor>.<patch>[.pre<N>]`.
|
34
|
-
#
|
35
|
-
# @see http://semver.org/
|
36
|
-
# @see http://gravitext.com/2012/07/22/versioning.html
|
37
|
-
class Version < RunLoop::Version
|
38
|
-
|
39
|
-
end
|
11
|
+
MIN_SERVER_VERSION = '0.10.2'
|
40
12
|
end
|
41
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.
|
4
|
+
version: 0.10.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-
|
11
|
+
date: 2014-10-01 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.
|
173
|
+
version: 1.0.8
|
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.
|
180
|
+
version: 1.0.8
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rake
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- lib/calabash-cucumber/core.rb
|
274
274
|
- lib/calabash-cucumber/cucumber.rb
|
275
275
|
- lib/calabash-cucumber/date_picker.rb
|
276
|
+
- lib/calabash-cucumber/deprecated.rb
|
276
277
|
- lib/calabash-cucumber/device.rb
|
277
278
|
- lib/calabash-cucumber/environment_helpers.rb
|
278
279
|
- lib/calabash-cucumber/failure_helpers.rb
|