Hi, Michael , thanks for your help
I log the bundlePath of the app, and It's like this :
/Users/user_name/Library/
Developer/CoreSimulator/Devices/2214EA44-01D2-4F86-8BA3-469062E28B32/data/Applications/..........
i guess xcode6(which I'm using) change the path of app installed to the simulator? so I change the 'reset app' method and now it works for me :
APPLICATIONS_DIR_1 = "/Users/#{ENV['USER']}/Library/Developer/CoreSimulator/Devices"
USERDEFAULTS_PLIST = "Library/Preferences/com.companyName.myApp.frankified.plist"
def app_folder
Dir.foreach(APPLICATIONS_DIR_1) do |item|
next if item.index(".") == 0
_applications_dir_2 = "#{APPLICATIONS_DIR_1}/#{item}/data/Applications"
next if !File.directory?( _applications_dir_2 )
Dir.foreach( _applications_dir_2 ) do |item|
next if item.index(".") == 0
if File.file?("#{_applications_dir_2}/#{item}/#{USERDEFAULTS_PLIST}")
puts "found the app_folder"
return "#{_applications_dir_2}/#{item}"
end
end
end
return nil
end
Given /^I reset the app on simulator
$/ do
_app_folder = app_folder
if _app_folder != nil
FileUtils.rm_rf _app_folder
end
steps "Given I launch the app"
end
在 2015年3月13日星期五 UTC+8上午10:17:47,Michael Buckley写道: