lib/calabash-cucumber/wait_helpers.rb in calabash-cucumber-0.9.141 vs lib/calabash-cucumber/wait_helpers.rb in calabash-cucumber-0.9.144
- old
+ new
@@ -80,25 +80,29 @@
elements_arr.none? { |q| element_exists(q) }
end
end
def wait_for_condition(options = {})
- options[:timeout] = options[:timeout] || 10
+ options[:timeout] = options[:timeout] || 30
options[:query] = options[:query] || "view"
+ if options.has_key?(:condition)
+ opt_condition = options[:condition]
+ if opt_condition.is_a?(Symbol)
+ target_condition = CALABASH_CONDITIONS[opt_condition]
+ elsif opt_condition.is_a?(String)
+ target_condition = options[:condition]
+ end
+ options[:condition] = target_condition
+ end
options[:condition] = options[:condition] || CALABASH_CONDITIONS[:none_animating]
options[:post_timeout] = options[:post_timeout] || 0.1
- options[:frequency] = options[:frequency] || 0.2
- options[:retry_frequency] = options[:retry_frequency] || 0.2
+ options[:frequency] = options[:frequency] || 0.3
+ options[:retry_frequency] = options[:retry_frequency] || 0.3
options[:count] = options[:count] || 2
options[:timeout_message] = options[:timeout_message] || "Timeout waiting for condition (#{options[:condition]})"
options[:screenshot_on_error] = options[:screenshot_on_error] || true
- if options[:condition] == CALABASH_CONDITIONS[:none_animating]
- #puts "Waiting for none-animating has been found unreliable."
- #puts "You are advised not to use it until this is resolved."
- #puts "Test will continue..."
- end
begin
Timeout::timeout(options[:timeout],WaitError) do
loop do
res = http({:method => :post, :path => 'condition'},
options)
@@ -114,11 +118,15 @@
handle_error_with_options(e,nil, options[:screenshot_on_error])
end
end
def wait_for_none_animating(options = {})
- #sleep(0.3)
options[:condition] = CALABASH_CONDITIONS[:none_animating]
+ wait_for_condition(options)
+ end
+
+ def wait_for_no_network_indicator(options = {})
+ options[:condition] = CALABASH_CONDITIONS[:no_network_indicator]
wait_for_condition(options)
end
#may be called with a string (query) or an array of strings
def wait_for_transition(done_queries, check_options={},animation_options={})