Sha256: 00f3dd35e9a2d1a264a430a016c7af5fe8b13bcff6b923af5d3dc0e59c4afd0c

Contents?: true

Size: 933 Bytes

Versions: 5

Compression:

Stored size: 933 Bytes

Contents

module WatirSplash
  module Waiter
    # waits until specified condition is true and
    # throws Watir::Exception::TimeOutException upon timeout
    #
    # examples:
    #   wait_until {text_field(:name => 'x').exists?} # waits until text field exists
    #   wait_until(5) {...} # waits maximum of 5 seconds for the condition to be true
    def wait_until *arg
      Watir::Waiter.wait_until(*arg) {yield}
    end

    # waits until specified condition is true and
    # returns false if timeout occurred, true otherwise
    #
    # examples:
    #   wait_until? {text_field(:name => 'x').exists?} # waits until text field exists
    #   wait_until?(5) {...} # waits maximum of 5 seconds for the condition to be true
    def wait_until? *arg
      begin
        wait_until(*arg) {yield}
      rescue Watir::Exception::TimeOutException
        return false
      end

      return true
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
watirsplash-0.2.5 lib/watirsplash/waiter.rb
watirsplash-0.2.4 lib/watirsplash/waiter.rb
watirsplash-0.2.3 lib/watirsplash/waiter.rb
watirsplash-0.2.2 lib/watirsplash/waiter.rb
watirsplash-0.2.1 lib/watirsplash/waiter.rb