So my question is: How do I get Ruby or Watir to wait around until an object is in a desired state before it can continue?
A secondary question is: How can I tell my Ruby or Watir script that if it waits too long, it should probably just give up and stop the test there?
Here is one way (this does both):
def until_with_timeout(timeout) # block
start_time = Time.now
until yield or Time.now - start_time > timeout do
sleep 0.05
end
end
This is how you use it:
until_with_timeout(30) do
is_biztalk_object_ready?
end
I'm just adding this method to Watir, since watir also has to do this kind of thing sometimes.
You may also want to look at the Ruby Timeout library.
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
