Permalink
Browse files

support for 4-inch simulator pref

  • Loading branch information...
1 parent 38a9ba1 commit 0a53e0abc63649ea02881291e13763c843f1c685 @krukow krukow committed Nov 17, 2012
@@ -28,7 +28,7 @@ def calabash_sim_reset
end
def calabash_sim_accessibility
- dirs = Dir.glob(File.join(File.expand_path("~/Library"),"Application Support","iPhone Simulator","*.*","Library","Preferences"))
+ dirs = Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "*.*", "Library", "Preferences"))
dirs.each do |sim_pref_dir|
fp = File.expand_path("#{@script_dir}/data/")
FileUtils.cp("#{fp}/com.apple.Accessibility.plist", sim_pref_dir)
@@ -50,7 +50,7 @@ def calabash_sim_location(args)
bundle_id = args.shift
- dirs = Dir.glob(File.join(File.expand_path("~/Library"),"Application Support","iPhone Simulator","*.*","Library","Caches","locationd"))
+ dirs = Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "*.*", "Library", "Caches", "locationd"))
dirs.each do |sim_dir|
existing_path = "#{sim_dir}/clients.plist"
if File.exist?(existing_path)
@@ -99,23 +99,23 @@ def calabash_sim_locale(args)
end
langs = hash['AppleLanguages']
- lang_index = langs.find_index {|l| l == lang}
+ lang_index = langs.find_index { |l| l == lang }
if lang_index.nil?
puts "Unable to find #{lang}..."
puts "Options:\n#{langs.join("\n")}"
exit 0
end
- langs[0],langs[lang_index] = langs[lang_index],langs[0]
+ langs[0], langs[lang_index] = langs[lang_index], langs[0]
if reg
hash['AppleLocale'] = reg
end
res_plist = CFPropertyList::List.new
res_plist.value = CFPropertyList.guess(hash)
- dirs = Dir.glob(File.join(File.expand_path("~/Library"),"Application Support","iPhone Simulator","*.*","Library","Preferences"))
+ dirs = Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "*.*", "Library", "Preferences"))
dirs.each do |sim_pref_dir|
res_plist.save("#{sim_pref_dir}/.GlobalPreferences.plist", CFPropertyList::List::FORMAT_BINARY)
end
@@ -126,18 +126,29 @@ def calabash_sim_locale(args)
def calabash_sim_device(args)
quit_sim
- options = ["iPad", "iPhone", "iPhone_Retina"]
- if args.length != 1 or not options.find {|x| x == args[0]}
+ options = ["iPad", "iPhone", "iPhone_Retina", "iPhone_Retina_4inch"]
+ if args.length != 1 or not options.find { |x| x == args[0] }
print_usage
puts "Unrecognized args: #{args}"
puts "should be one of #{options}"
exit(0)
end
- path =File.join(File.expand_path("~/Library"),"Preferences","com.apple.iphonesimulator.plist")
+ path =File.join(File.expand_path("~/Library"), "Preferences", "com.apple.iphonesimulator.plist")
plist = CFPropertyList::List.new(:file => path)
hash = CFPropertyList.native_types(plist.value)
- hash['SimulateDevice'] = args[0].gsub("iPhone_Retina","iPhone (Retina)")
- plist.value = CFPropertyList.guess(hash)
- plist.save(path, CFPropertyList::List::FORMAT_BINARY)
-end
+ device = case args[0]
+ when "iPhone_Retina"
+ "iPhone (Retina)"
+ when "iPhone_Retina_4inch"
+ "iPhone (Retina 4-inch)"
+ else
+ args[0]
+ end
+ if device
+ hash['SimulateDevice'] = device
+ plist.value = CFPropertyList.guess(hash)
+ plist.save(path, CFPropertyList::List::FORMAT_BINARY)
+ end
+
+end
@@ -24,6 +24,14 @@ def page(clz,*args)
clz.new(@world,*args)
end
+ def step(s)
+
+ end
+
+ def steps(ss)
+
+ end
+
def await(opts={})
wait_for_elements_exist([trait], opts)
self
@@ -1,6 +1,6 @@
module Calabash
module Cucumber
- VERSION = "0.9.119"
+ VERSION = "0.9.120"
FRAMEWORK_VERSION = "0.9.117"
end
end
@@ -1,10 +1,29 @@
(ns calabash-jvm.wait
+ (:use [slingshot.slingshot :only [try+ throw+]])
+
(:require [calabash-jvm
[http :as http]
[core :as core]
[utils :as utils]]))
+(defn with-timeout*
+ [opts action]
+ (let [opts (merge {:timeout 10 :message "Timeout"} opts)
+ f (future-call action)
+ timeout (* 1000 (:timeout opts))
+ res (deref f timeout :calabash-jvm/timeout)]
+ (try
+ (if (= :calabash-jvm/timeout res)
+ (throw+ (merge {:type :calabash-jvm/timeout} opts))
+ res)
+ (finally
+ (future-cancel f)))))
+
+(defmacro with-timeout [opts & body]
+ `(let [f# (fn [] ~@body)]
+ (with-timeout* ~opts f#)))
+
(defn do-until
[pred action]
(loop []

0 comments on commit 0a53e0a

Please sign in to comment.