Sha256: 2c65272bb1a60c6faa7c7767347cc8b8cd74314c2f9ffb24e66cdc17f92e8cc8

Contents?: true

Size: 476 Bytes

Versions: 20

Compression:

Stored size: 476 Bytes

Contents

module CucumberWaitAjaxRequests
  def wait_ajax_requests(timeout = Capybara.default_max_wait_time)
    Timeout.timeout(timeout) do
      sleep 0.1 until all_ajax_requests_finished?
    end
  end

  def all_ajax_requests_finished?
    page.evaluate_script('jQuery.active').zero?
  end
end

World(CucumberWaitAjaxRequests)

# Auto wait ajax request between steps
AfterStep do |scenario|
  if page.evaluate_script('typeof jQuery') != "undefined"
    wait_ajax_requests
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
dorsale-3.8.1 features/support/ajax.rb
dorsale-3.8.0 features/support/ajax.rb
dorsale-3.7.8 features/support/ajax.rb
dorsale-3.7.7 features/support/ajax.rb
dorsale-3.7.6 features/support/ajax.rb
dorsale-3.7.5 features/support/ajax.rb
dorsale-3.7.4 features/support/ajax.rb
dorsale-3.7.2 features/support/ajax.rb
dorsale-3.7.1 features/support/ajax.rb
dorsale-3.7.0 features/support/ajax.rb
dorsale-3.6.1 features/support/ajax.rb
dorsale-3.6.0 features/support/ajax.rb
dorsale-3.5.2 features/support/ajax.rb
dorsale-3.5.1 features/support/ajax.rb
dorsale-3.5.0 features/support/ajax.rb
dorsale-3.4.0 features/support/ajax.rb
dorsale-3.3.0 features/support/ajax.rb
dorsale-3.2.0 features/support/ajax.rb
dorsale-3.1.7 features/support/ajax.rb
dorsale-3.1.6 features/support/ajax.rb