Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def self.device(device_name)
{
:name => device_name,
:udid => device['UDID'],
:screen => device['screen']
:screen => device['screen'],
:simfamily => device['simfamily']
}
end

Expand Down
5 changes: 4 additions & 1 deletion lib/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def collect
`rm -rf #{run_data_path}/*`
compile_js

device_params = (@device[:name] == "iOS Simulator") ? "" : "-w #{@device[:udid]}"
device_params = ""
if(@device[:name] != "iOS Simulator")
device_params = "-w #{@device[:udid]}"
end

begin
out = `instruments #{device_params} -t #{@template} #{Zucchini::Config.app} -e UIASCRIPT #{run_data_path}/feature.js -e UIARESULTSPATH #{run_data_path} 2>&1`
Expand Down
35 changes: 35 additions & 0 deletions lib/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,41 @@ def execute
def run
compare_threads = {}

device_size = ""
if(@device[:name] == "iOS Simulator" && @device[:simfamily] != nil)
#Kill the simulator if it's already running
out = `array=$(ps -ax | grep -i "Simulator" | awk ' { print $1 } '); for PID in $array; do kill $PID; done;`
puts out

# Figure out which simulator to use...
if(@device[:simfamily] == "iPad" || @device[:simfamily] == "ipad" )
uidevicefamily = 2
device_size = "iPad"
else
uidevicefamily = 1
device_size = "iPhone"
end
# And at what resolution
if @device[:screen].include?("retina") then
if uidevicefamily == 2 then
device_size = "iPad (Retina)"
else
device_size = "iPhone (Retina)"
end
end

# Set up the simulator's device size...
`defaults write com.apple.iphonesimulator "SimulateDevice" '"#{device_size}"'`

# Plist tool and file to edit
plistbuddy = "/usr/libexec/PlistBuddy"
plistfile = "#{Zucchini::Config.app}/Info.plist"
# Set the plist items to the correct values
`#{plistbuddy} -c "Delete :UIDeviceFamily" #{plistfile}`
`#{plistbuddy} -c "Add :UIDeviceFamily array" #{plistfile}`
`#{plistbuddy} -c "Add :UIDeviceFamily:0 integer #{uidevicefamily}" #{plistfile}`
end

features.each do |f|
f.device = @device
f.template = @template
Expand Down