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-2.0.0 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.11.0 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.10.5 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.10.2 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.10.1 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.10.0 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.20 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.19 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.18 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.17 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.16 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.15 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.14 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.13 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.12 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.11 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.10 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.9 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.8 lib/agilibox/cucumber_helpers/ajax.rb
agilibox-1.9.7 lib/agilibox/cucumber_helpers/ajax.rb