Class: Watir::Timecop::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/watir-timecop/timer.rb

Instance Method Summary collapse

Instance Method Details

#wait(timeout) { ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Executes given block until it returns true or exceeds timeout. It is different from default Watir::Wait::Timer implementation since it does not use ‘Time.now` to determine if waiting has exceeded timeout. Usage of `Time.now` is not compatible with Timecop gem - we may never exceed the timeout if it’s stubbed.

Parameters:

  • timeout (Fixnum)

Yields:

  • block



17
18
19
20
21
22
23
24
# File 'lib/watir-timecop/timer.rb', line 17

def wait(timeout, &block)
  counter = 0
  until counter >= timeout
    yield(block)
    sleep Watir::Wait::INTERVAL
    counter += Watir::Wait::INTERVAL
  end
end