Top Level Namespace

Defined Under Namespace

Modules: CapybaraExt, Mobility, NextInstanceOf, Spree Classes: BarAbility, DbMaximumLengthValidator, EmailValidator, OrderWalkthrough

Instance Method Summary collapse

Instance Method Details

#wait_for(options = {}) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/spree/testing_support/capybara_ext.rb', line 58

def wait_for(options = {})
  default_options = { error: nil, seconds: 5 }.merge(options)

  Selenium::WebDriver::Wait.new(timeout: default_options[:seconds]).until { yield }
rescue Selenium::WebDriver::Error::TimeoutError
  default_options[:error].nil? ? false : raise(default_options[:error])
end