Sha256: afc5a911f4c5f04fb04ab801a963bcf35be5c3aa95143c19c493342c5a186005

Contents?: true

Size: 458 Bytes

Versions: 4

Compression:

Stored size: 458 Bytes

Contents

module CucumberWaitAjaxRequests
  def wait_ajax_requests
    Timeout.timeout(Capybara.default_max_wait_time) 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 requests between steps
AfterStep do |scenario|
  if page.evaluate_script('typeof jQuery') != "undefined"
    wait_ajax_requests
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dorsale-3.1.5 features/support/ajax.rb
dorsale-3.1.4 features/support/ajax.rb
dorsale-3.1.3 features/support/ajax.rb
dorsale-3.1.2 features/support/ajax.rb