Improved "watch_for" with timeout option.
This commit is contained in:
parent
48156373a9
commit
fe4e5354fc
1 changed files with 6 additions and 2 deletions
|
@ -250,12 +250,16 @@ class TestCase < Test::Unit::TestCase
|
||||||
assert( false, "(#{test[:name]}) no login box found!" )
|
assert( false, "(#{test[:name]}) no login box found!" )
|
||||||
return
|
return
|
||||||
elsif action[:execute] == 'watch_for'
|
elsif action[:execute] == 'watch_for'
|
||||||
|
timeout = 16
|
||||||
|
if action[:timeout]
|
||||||
|
timeout = action[:timeout]
|
||||||
|
end
|
||||||
|
loops = timeout / 0.33
|
||||||
text = ''
|
text = ''
|
||||||
(1..36).each { |loop|
|
(1..loops).each { |loop|
|
||||||
element = instance.find_element( { :css => action[:area] } )
|
element = instance.find_element( { :css => action[:area] } )
|
||||||
if element.displayed?
|
if element.displayed?
|
||||||
text = element.text
|
text = element.text
|
||||||
puts "T: #{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}'" )
|
||||||
sleep 0.4
|
sleep 0.4
|
||||||
|
|
Loading…
Reference in a new issue