Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.1.0 #425

Merged
merged 96 commits into from
Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
68bbe10
Merge branch 'release/2.0.9' into develop
jmoody Mar 10, 2016
7b705ba
Spec: update test binaries to 0.18.2
jmoody Mar 11, 2016
ee43db1
Flush pipe_io if Errno::EPIPE error is encountered
TeresaP Mar 11, 2016
0d44fe8
Env: return nil if DEVICE_TARGET is empty string
jmoody Mar 12, 2016
df15600
Env: return nil if DEVICE_ENDPOINT is empty string
jmoody Mar 12, 2016
de2f44d
Env: remove unnecessary return from #xcodeproj
jmoody Mar 12, 2016
0406d3c
Env: improve TRACE_TEMPLATE handling
jmoody Mar 12, 2016
0a6a3de
Merge pull request #408 from calabash/feature/handle-empty-values-for…
jmoody Mar 12, 2016
dd9d649
Update fifo.rb
TeresaP Mar 17, 2016
cf46478
Merge pull request #407 from TeresaP/patch-1
jmoody Mar 17, 2016
6b751e4
Gem: 2.0.10.pre1
jmoody Mar 17, 2016
b164154
Merge pull request #409 from calabash/release/2.0.10.pre1
jmoody Mar 17, 2016
50f9690
Loggin: remove leading space from INFO log
jmoody Mar 18, 2016
66170dc
Core: reformat to fix indentation problems
jmoody Mar 20, 2016
d7ecd6a
Core: remove .expec_compatible_simulator_architecture - since 1.5.2
jmoody Mar 20, 2016
db7a1bc
Core.udid_and_bundle_for_launcher - drop Xcode 5 support
jmoody Mar 20, 2016
9c95c1e
Xcode/SimControl deprecate xcode 5? methods
jmoody Mar 20, 2016
89b25c8
Core.prepare_simulator - drop Xcode 5 check
jmoody Mar 20, 2016
2d189c1
Core.simulator_target? drop Xcode 5 check
jmoody Mar 20, 2016
658fa4b
Core: remove Xcode 5 check from integration examples
jmoody Mar 20, 2016
284da8e
Core.expect_simulator_compatible_arch remove Xcode 5 check
jmoody Mar 20, 2016
1c9e1fd
Core.default_simulator drop Xcode 5 check
jmoody Mar 20, 2016
57667d5
CoreSimulator#sim_app_path: remove Xcode 5 check
jmoody Mar 20, 2016
eaac7b7
CoreSimulator#sim_name: drop Xcode 5 check
jmoody Mar 20, 2016
2f54a2f
Device#instruments_identifier: remove Xcode 5 check
jmoody Mar 20, 2016
dc5d465
Instruments#templates: remove Xcode 5 check
jmoody Mar 20, 2016
6619310
L10n#uikit_bundle_l10n_path: remove Xcode 5 check
jmoody Mar 20, 2016
60f8ee3
Merge pull request #410 from calabash/feature/drop-Xcode-5-support
jmoody Mar 20, 2016
7ab3fe5
Core.run_with_options: responds to :instruments option
jmoody Mar 20, 2016
0030ae3
Device: can detect target from options or env
jmoody Mar 20, 2016
590b2aa
Merge pull request #411 from calabash/feature/move-device-target-infe…
jmoody Mar 20, 2016
b35cd67
DetectAUT.detect_app_under_test
jmoody Mar 21, 2016
f484b02
Merge pull request #412 from calabash/feature/centralize-app-inferrin…
jmoody Mar 21, 2016
5612875
Docs: add deprecated docs to Core.detect_connected_device
jmoody Mar 21, 2016
eef762b
Core.detect_uia_strategy given options and device
jmoody Mar 21, 2016
dcbe6df
Merge pull request #413 from calabash/feature/centralize-uia-strategy…
jmoody Mar 21, 2016
9f1a29d
Core#run_with_options: use Xcode,SimControl,Instruments from options
jmoody Mar 21, 2016
96c664b
DetectAUT.detect_aut => use :is_ipa key
jmoody Mar 21, 2016
7626080
Env.reset_between_scenarios?
jmoody Mar 21, 2016
488be3e
Core.detect_reset_options
jmoody Mar 21, 2016
8bffabf
Instruments: spawn args will always have :udid and :bundle_id
jmoody Mar 21, 2016
3696e98
Core.udid_and_bundle_for_launcher - deprecate
jmoody Mar 21, 2016
93d48de
Core.simulator_target? - deprecate
jmoody Mar 21, 2016
cc6fa6b
Core.prepare_simulator - update for new API
jmoody Mar 21, 2016
fbc70b2
Core.expect_simulator_compatible_arch - move to private
jmoody Mar 21, 2016
0c29f2f
Core.run_with_options - update for new API
jmoody Mar 21, 2016
ce99e0c
Merge pull request #414 from calabash/feature/update-run_with_options…
jmoody Mar 21, 2016
ccbddfa
Core: fix dylib injection for new API
jmoody Mar 22, 2016
a196a74
Docs: change deprecation message 2.0.10 => 2.1.0
jmoody Mar 22, 2016
c5a9356
Gem: bump version to 2.1.0.pre1
jmoody Mar 22, 2016
ffdd613
Docs: update changelog for 2.1.0.pre1
jmoody Mar 22, 2016
e3feeed
Merge pull request #415 from calabash/release/2.1.0.pre1
jmoody Mar 22, 2016
3a106d8
XCUITest: prefer CBX-Runner
jmoody Mar 23, 2016
0af88c1
Env: respond to CBXWS variable
jmoody Mar 23, 2016
d1829f9
XCUITest.workspace calls out to Environment
jmoody Mar 23, 2016
52f9cdc
XCUITest.new takes a device parameter
jmoody Mar 23, 2016
6543dfd
XCUITest#url move to private
jmoody Mar 23, 2016
e188d1e
XCUITest: remove references to instruments and simctl
jmoody Mar 23, 2016
cfd6951
XCUITest: refactor shutdown to #shutdown
jmoody Mar 23, 2016
e82031e
XCUITest: refactor health check to #health
jmoody Mar 23, 2016
57fc9c3
XCUITest#launch_cbx_runner move to private
jmoody Mar 23, 2016
2ef154f
XCUITest#launch starts CBXRunner and launches AUT
jmoody Mar 23, 2016
80da637
HTTP: don't log every connection error
jmoody Mar 23, 2016
c75d6df
Merge pull request #417 from calabash/feature/interface-for-launching…
jmoody Mar 23, 2016
675a940
CoreSim#launch - retry on errors
jmoody Mar 23, 2016
4ad1a2a
CoreSim: add CoreSimulatorService to the list of managed processes
jmoody Mar 23, 2016
a16b2b6
Merge pull request #418 from calabash/feature/CoreSimulator-try-relau…
jmoody Mar 23, 2016
96d3e18
Instruments#kill_instruments no longer branches on Xcode version
jmoody Mar 24, 2016
206f760
Merge pull request #419 from calabash/feature/remove-xcode-option-fro…
jmoody Mar 24, 2016
207f83e
Simctl: an interface to simctl
jmoody Mar 24, 2016
cb20ce2
CoreSim#installed_app_bundle_dir uses simctl to check
jmoody Mar 24, 2016
fc50791
Docs: mention simctl doctor in CHANGELOG
jmoody Mar 24, 2016
68b5953
Merge pull request #420 from calabash/feature/improve-installed-app-c…
jmoody Mar 24, 2016
2d12167
CLI: simctl doctor erases sims first
jmoody Mar 28, 2016
9f7cac1
Docs: fix typo in CoreSim#erase docs
jmoody Mar 28, 2016
2c05a2d
Merge pull request #421 from calabash/feature/update-simctl-doctor-to…
jmoody Mar 28, 2016
da67a09
App: can report version info
jmoody Mar 28, 2016
934a39a
Ipa: can report version info
jmoody Mar 28, 2016
7aea4ff
App/Ipa #to_s gives version info
jmoody Mar 28, 2016
abfcdb1
Merge pull request #422 from calabash/feature/app-and-ipa-report-vers…
jmoody Mar 28, 2016
8cfc1b2
XCUITest: terminate xpcproxy; causes sim to hang
jmoody Mar 31, 2016
7b1e1d4
CoreSim: terminate apsd (APNS); crashes in Xcode < 7
jmoody Mar 31, 2016
cb37922
XCUITest: API for checking on the state of the server
jmoody Mar 30, 2016
4c28f2e
RunLoop: respond to :xcuitest option
jmoody Mar 30, 2016
c5d88f1
Docs: maybe move .prepare_simulator to CoreSim
jmoody Mar 30, 2016
3334954
XCUITest: add to_s and inspect methods
jmoody Mar 30, 2016
c99f4e5
XCUITest: log how long it takes to build and launch
jmoody Mar 30, 2016
5da81fd
XCUITest#launch_aut - fix default argument
jmoody Mar 30, 2016
780f197
XCUITest.run mvp for launching
jmoody Mar 30, 2016
0fd493d
XCUITest: handle versioned routes
jmoody Mar 30, 2016
2bade25
HTTP: add delete
jmoody Mar 31, 2016
053dc13
XCUITest: experimental interface for queries and gestures
jmoody Mar 31, 2016
1ece4b7
IRB: use RunLoop.run interface for holmes
jmoody Mar 31, 2016
6c49b57
Merge pull request #423 from calabash/feature/interface-for-launching…
jmoody Mar 31, 2016
2146eda
Gem: bump version to 2.1.0
jmoody Mar 31, 2016
f87bbaf
Docs: update CHANGELOG for 2.1.0
jmoody Mar 31, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .irbrc
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,35 @@ def delete_simulator(name)
true
end

if !ENV["XCUITEST_WORKSPACE"]
if !ENV["CBXWS"]
moody = File.expand_path(File.join("~/", "git", "calabash", "xcuitest", "CBXDriver.xcworkspace"))
prometus = File.expand_path(File.join("~/", "calabash-xcuitest-server", "CBXDriver.xcworkspace"))

if File.directory?(moody)
ENV["XCUITEST_WORKSPACE"] = moody
ENV["CBXWS"] = moody
elsif File.directory?(prometus)
ENV["XCUITEST_WORKSPACE"] = prometus
ENV["CBXWS"] = prometus
end
end

puts "XCUITest workspace = #{ENV["XCUITEST_WORKSPACE"]}"
puts "XCUITest workspace = #{ENV["CBXWS"]}"

def xcuitest
RunLoop::XCUITest.new("com.apple.Preferences")
def xcuitest(bundle_id="com.apple.Preferences")
device = RunLoop::Device.detect_device({}, xcode, simcontrol, instruments)
RunLoop::XCUITest.new(bundle_id, device)
end

def holmes(bundle_id="com.apple.Preferences")
device = RunLoop::Device.detect_device({}, xcode, simcontrol, instruments)
options = {
:device => device.udid,
:xcuitest => true,
:xcode => xcode,
:simctl => simcontrol,
:instruments => instruments,
:app => bundle_id
}
RunLoop.run(options)
end

verbose
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
## Change Log

### 2.1.0

This release fixes a bug that might put the iOS Simulator into a bad state.
An iOS Simulator could potentially have a .app installed in its directory
structure, but the app would not appear in Springboard or be detected by
simctl. We have fixed the bug for Xcode 7. There is no possible fix for
Xcode 6. In order to ensure that your iOS Simulators are in a good shape we
recommend that all users run:

```
# Will take ~10 minutes depending on the number of installed simulators.
#
# Don't forget to run this on your CI machines.
#
# You only have to run this command once!
$ DEBUG=1 run-loop simctl doctor
```

I apologize for the inconvenience, this mistake is on me. -jjm

* Experimental interface for launching CBX-Runner and sending commands
#423
* App and Ipa can return version info #422
* CLI: simctl doctor erases sims first #421
* Improve installed app check for Xcode 7 simulators #420
* Instruments#kill\_instruments no longer branches on Xcode version #420
* CoreSim#launch - retry on errors #418
* Interface for launching CBX-Runner #417
* Core.run\_with\_options improve the way AUT and DUT are inferred #414
* Core.detecti\_uia\_strategy given options and RunLoop::Device #413
* DetectAUT.detect\_app\_under\_test #412
* Device is responsible for inferring which device to target #411
* Drop Xcode 5 checks #410
* Environment: handle empty strings for DEVICE\_TARGET, DEVICE\_ENDPOINT, and
TRACE\_TEMPLATE #408
* Rescue pipe\_io if Errno::EPIPE error is encountered #407 @TeresaP

### 2.0.9

* Improve automatic .app detection #405
Expand Down
92 changes: 48 additions & 44 deletions lib/run_loop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
require 'run_loop/host_cache'
require 'run_loop/patches/awesome_print'
require 'run_loop/core_simulator'
require 'run_loop/simctl/plists'
require "run_loop/simctl"
require 'run_loop/template'
require "run_loop/locale"
require "run_loop/language"
Expand Down Expand Up @@ -66,64 +66,69 @@ class WriteFailedError < RuntimeError

def self.run(options={})

if RunLoop::Instruments.new.instruments_app_running?
raise %q(The Instruments.app is open.
if options[:xcuitest]
RunLoop::XCUITest.run(options)
else

if RunLoop::Instruments.new.instruments_app_running?
raise %q(The Instruments.app is open.

If the Instruments.app is open, the instruments command line tool cannot take
control of your application.

Please quit the Instruments.app and try again.)

end
end

uia_strategy = options[:uia_strategy]
if options[:script]
script = validate_script(options[:script])
else
if uia_strategy
script = default_script_for_uia_strategy(uia_strategy)
uia_strategy = options[:uia_strategy]
if options[:script]
script = validate_script(options[:script])
else
if options[:calabash_lite]
uia_strategy = :host
script = Core.script_for_key(:run_loop_host)
else
uia_strategy = :preferences
if uia_strategy
script = default_script_for_uia_strategy(uia_strategy)
else
if options[:calabash_lite]
uia_strategy = :host
script = Core.script_for_key(:run_loop_host)
else
uia_strategy = :preferences
script = default_script_for_uia_strategy(uia_strategy)
end
end
end
end
# At this point, 'script' has been chosen, but uia_strategy might not
unless uia_strategy
desired_script = options[:script]
if desired_script.is_a?(String) #custom path to script
uia_strategy = :host
elsif desired_script == :run_loop_host
uia_strategy = :host
elsif desired_script == :run_loop_fast_uia
uia_strategy = :preferences
elsif desired_script == :run_loop_shared_element
uia_strategy = :shared_element
else
raise "Inconsistent state: desired script #{desired_script} has not uia_strategy"
# At this point, 'script' has been chosen, but uia_strategy might not
unless uia_strategy
desired_script = options[:script]
if desired_script.is_a?(String) #custom path to script
uia_strategy = :host
elsif desired_script == :run_loop_host
uia_strategy = :host
elsif desired_script == :run_loop_fast_uia
uia_strategy = :preferences
elsif desired_script == :run_loop_shared_element
uia_strategy = :shared_element
else
raise "Inconsistent state: desired script #{desired_script} has not uia_strategy"
end
end
end

# At this point script and uia_strategy selected
cloned_options = options.clone
cloned_options[:script] = script
cloned_options[:uia_strategy] = uia_strategy
# At this point script and uia_strategy selected
cloned_options = options.clone
cloned_options[:script] = script
cloned_options[:uia_strategy] = uia_strategy

# Xcode and SimControl will not be properly cloned and we don't want
# them to be; we want to use the exact objects that were passed.
if options[:xcode]
cloned_options[:xcode] = options[:xcode]
end
# Xcode and SimControl will not be properly cloned and we don't want
# them to be; we want to use the exact objects that were passed.
if options[:xcode]
cloned_options[:xcode] = options[:xcode]
end

if options[:sim_control]
cloned_options[:sim_control] = options[:sim_control]
end
if options[:sim_control]
cloned_options[:sim_control] = options[:sim_control]
end

Core.run_with_options(cloned_options)
Core.run_with_options(cloned_options)
end
end

def self.send_command(run_loop, cmd, options={timeout: 60}, num_retries=0, last_error=nil)
Expand Down Expand Up @@ -235,5 +240,4 @@ def self.validate_script(script)
def self.log_info(*args)
RunLoop::Logging.log_info(*args)
end

end
84 changes: 83 additions & 1 deletion lib/run_loop/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,20 @@ def initialize(app_bundle_path)

# @!visibility private
def to_s
"#<APP: #{path}>"
cf_bundle_version = bundle_version
cf_bundle_short_version = short_bundle_version

if cf_bundle_version && cf_bundle_short_version
version = "#{cf_bundle_version.to_s} / #{cf_bundle_short_version}"
elsif cf_bundle_version
version = cf_bundle_version.to_s
elsif cf_bundle_short_version
version = cf_bundle_short_version
else
version = ""
end

"#<APP #{bundle_identifier} #{version} #{path}>"
end

# @!visibility private
Expand Down Expand Up @@ -130,6 +143,75 @@ def distribution_signed?
RunLoop::Codesign.distribution?(path)
end

# Returns the CFBundleShortVersionString of the app as Version instance.
#
# Apple docs:
#
# CFBundleShortVersionString specifies the release version number of the
# bundle, which identifies a released iteration of the app. The release
# version number is a string comprised of three period-separated integers.
#
# The first integer represents major revisions to the app, such as revisions
# that implement new features or major changes. The second integer denotes
# revisions that implement less prominent features. The third integer
# represents maintenance releases.
#
# The value for this key differs from the value for CFBundleVersion, which
# identifies an iteration (released or unreleased) of the app. This key can
# be localized by including it in your InfoPlist.strings files.
#
# @return [RunLoop::Version, nil] Returns a Version instance if the
# CFBundleShortVersion string is well formed and nil if not.
def marketing_version
string = plist_buddy.plist_read("CFBundleShortVersionString", info_plist_path)
begin
version = RunLoop::Version.new(string)
rescue
if string && string != ""
RunLoop.log_debug("CFBundleShortVersionString: '#{string}' is not a well formed version string")
else
RunLoop.log_debug("CFBundleShortVersionString is not defined in Info.plist")
end
version = nil
end
version
end

# See #marketing_version
alias_method :short_bundle_version, :marketing_version

# Returns the CFBundleVersionString of the app as Version instance.
#
# Apple docs:
#
# CFBundleVersion specifies the build version number of the bundle, which
# identifies an iteration (released or unreleased) of the bundle. The build
# version number should be a string comprised of three non-negative,
# period-separated integers with the first integer being greater than zero.
# The string should only contain numeric (0-9) and period (.) characters.
# Leading zeros are truncated from each integer and will be ignored (that
# is, 1.02.3 is equivalent to 1.2.3).
#
# @return [RunLoop::Version, nil] Returns a Version instance if the
# CFBundleVersion string is well formed and nil if not.
def build_version
string = plist_buddy.plist_read("CFBundleVersionString", info_plist_path)
begin
version = RunLoop::Version.new(string)
rescue
if string && string != ""
RunLoop.log_debug("CFBundleVersionString: '#{string}' is not a well formed version string")
else
RunLoop.log_debug("CFBundleVersionString is not defined in Info.plist")
end
version = nil
end
version
end

# See #build_version
alias_method :bundle_version, :build_version

# @!visibility private
# Collects the paths to executables in the bundle.
def executables
Expand Down
11 changes: 8 additions & 3 deletions lib/run_loop/cli/simctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,25 @@ def doctor
debug = options[:debug]
device = options[:device]

manage_processes

if device
RunLoop::Environment.with_debugging(debug) do
RunLoop::CoreSimulator.erase(device)
launch_simulator(device, xcode)
end
else
launch_each_simulator
RunLoop::Environment.with_debugging(debug) do
erase_and_launch_each_simulator
end
end

manage_processes
end

no_commands do
def launch_each_simulator
def erase_and_launch_each_simulator
sim_control.simulators.each do |simulator|
RunLoop::CoreSimulator.erase(simulator)
launch_simulator(simulator, xcode)
end
end
Expand Down
Loading