spriteCloud / lapis-lazuli

Cucumber helper functions and scaffolding for easier test automation suite development.
Other
7 stars 7 forks source link

browser.wait(:condition => :while) does not raise an error if it fails #24

Closed sjieg closed 9 years ago

sjieg commented 9 years ago

When doing the following:

browser.goto 'google.com'
dialog = browser.wait(
      :timeout => 1,
      :condition => :while,
      :like     => [:div, :class, 'fbar']
    )
D, [2015-07-16T17:00:46.621633 #7960] DEBUG -- #<IO:0x610b30>: Caught timeo
ut: timed out after 10 seconds
=> #<Watir::HTMLElement:0x39e27cb4 located=true selector={element: (webdriv
er element)}>

A log message is given that the function failed, but at the same time the element you were waiting for to disappear is returned.

When using :condition => :until an error is raised when failing. The same behavior is expected for :while.

I've taken the liberty to look into the wait.rb file and I think I found the issue:

if not err.nil? and filter_results.empty?
        options[:exception] = err
        world.error(options)
      end

The error is only raised if there is NO result, but when waiting :while there will be a result if it failed.

jfinkhaeuser commented 9 years ago

Dupe of #26, of sorts.