Sha256: eb1b87ff0c3610a179cf1d43bfc7d59cb91d7fc921ba80d3011dc5cb66983684

Contents?: true

Size: 906 Bytes

Versions: 10

Compression:

Stored size: 906 Bytes

Contents

module WatiRspec
  module Waiter
    # waits until some 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 condition to be true
    def wait_until! *arg
      Watir::Waiter.wait_until(*arg) {yield}
    end

    # waits until some 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 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

10 entries across 10 versions & 1 rubygems

Version Path
watirspec-0.1.9.1 lib/watirspec/waiter.rb
watirspec-0.1.8 lib/watirspec/waiter.rb
watirspec-0.1.7 lib/watirspec/waiter.rb
watirspec-0.1.6 lib/watirspec/waiter.rb
watirspec-0.1.5 lib/watirspec/waiter.rb
watirspec-0.1.4 lib/watirspec/waiter.rb
watirspec-0.1.3 lib/watirspec/waiter.rb
watirspec-0.1.2 lib/watirspec/waiter.rb
watirspec-0.1.1 lib/watirspec/waiter.rb
watirspec-0.1.0 lib/watirspec/waiter.rb