Sha256: b4cb91c688be8dbbb405c6bf8640709c754bb5910f3b4031d3b9b6186b55d0db
Contents?: true
Size: 905 Bytes
Versions: 3
Compression:
Stored size: 905 Bytes
Contents
# spec/support/wait_for_ajax.rb module WaitForAjax def wait_for_ajax Timeout.timeout(Capybara.default_max_wait_time) do loop until finished_all_ajax_requests? end end def finished_all_ajax_requests? page.evaluate_script('jQuery.active').zero? end def wait_for_visible_modal(key = nil) Timeout.timeout(Capybara.default_max_wait_time) do loop until visible_modal?(key) end end def wait_for_hidden_modal(key = nil) Timeout.timeout(Capybara.default_max_wait_time) do loop until hidden_modal?(key) end end def hidden_modal?(key = nil) page.evaluate_script("jQuery('#{key || "#ow_inline_modal"}').is(':visible')") == false end def visible_modal?(key = nil) page.evaluate_script("jQuery('#{key || "#ow_inline_modal"}').is(':visible')") == true end end RSpec.configure do |config| config.include WaitForAjax, type: :feature end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
camaleon_cms-2.3.6 | spec/support/wait_for_ajax.rb |
camaleon_cms-2.3.5 | spec/support/wait_for_ajax.rb |
camaleon_cms-2.3.4 | spec/support/wait_for_ajax.rb |