Sha256: b2e60a8faee77484af95556b6ec11296f9630ee744161dce67bd5278f98ebabf

Contents?: true

Size: 467 Bytes

Versions: 73

Compression:

Stored size: 467 Bytes

Contents

module CapybaraWaitAjaxRequests
  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(CapybaraWaitAjaxRequests)

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

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
agilibox-1.3.0 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.2.3 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.2.2 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.2.1 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.2.0 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.1.0 features/support/ajax.rb
agilibox-1.0.15 features/support/ajax.rb
agilibox-1.0.14 features/support/ajax.rb
agilibox-1.0.13 features/support/ajax.rb
agilibox-1.0.12 features/support/ajax.rb
agilibox-1.0.11 features/support/ajax.rb
agilibox-1.0.10 features/support/ajax.rb
agilibox-1.0.9 features/support/ajax.rb