Improved error handling.

This commit is contained in:
Martin Edenhofer 2015-01-24 10:05:02 +01:00
parent a18157ba4d
commit 07824ab633

View file

@ -261,18 +261,22 @@ class TestCase < Test::Unit::TestCase
if action[:timeout] if action[:timeout]
timeout = action[:timeout] timeout = action[:timeout]
end end
loops = (timeout / 2).to_i loops = (timeout).to_i
text = '' text = ''
(1..loops).each { |loop| (1..loops).each { |loop|
element = instance.find_elements( { :css => action[:area] } )[0] element = instance.find_elements( { :css => action[:area] } )[0]
if element #&& element.displayed? if element #&& element.displayed?
begin
text = element.text text = element.text
if text =~ /#{action[:value]}/i if text =~ /#{action[:value]}/i
assert( true, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" ) assert( true, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" )
return return
end end
rescue
# just try again
end end
sleep 2 end
sleep 1
} }
assert( false, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" ) assert( false, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" )
return return