Module: SparklingWatir::Waitable

Included in:
Element
Defined in:
lib/sparkling_watir/wait.rb

Overview

THis module provides wait utility methods

Instance Method Summary collapse

Instance Method Details

#wait_until(timeout: nil, message: nil, interval: nil, **opt, &blk) ⇒ Object

Waits until the condition is true.

TODO: Add examples



97
98
99
100
101
102
103
104
105
106
# File 'lib/sparkling_watir/wait.rb', line 97

def wait_until(timeout: nil, message: nil, interval: nil, **opt, &blk)
  message ||= proc { |obj| "waiting for true condition on #{obj.inspect}" }

  # TODO: Consider throwing argument error for mixing block & options
  proc = create_proc(opt, &blk)

  Wait.until(timeout: timeout, message: message, interval: interval, object: self, &proc)

  self
end

#wait_while(timeout: nil, message: nil, interval: nil, **opt, &blk) ⇒ Object

Add examples



112
113
114
115
116
117
118
119
120
121
# File 'lib/sparkling_watir/wait.rb', line 112

def wait_while(timeout: nil, message: nil, interval: nil, **opt, &blk)
  message ||= proc { |obj| "waiting for false condition on #{obj.inspect}" }

  # TODO: Add examples
  proc = create_proc(opt, &blk)

  Wait.while(timeout: timeout, message: message, interval: interval, object: self, &proc)

  self
end