Module: Waiter
- Included in:
- Helpers::Main
- Defined in:
- lib/cucumber/pickles/helpers/waiter.rb
Class Method Summary collapse
- .page ⇒ Object
- .pending_ajax_requests_num ⇒ Object
- .wait ⇒ Object
-
.wait_for_ajax ⇒ Object
waits for all Ajax requests to finish.
Class Method Details
.page ⇒ Object
135 136 137 |
# File 'lib/cucumber/pickles/helpers/waiter.rb', line 135 def page .current_session end |
.pending_ajax_requests_num ⇒ Object
148 149 150 |
# File 'lib/cucumber/pickles/helpers/waiter.rb', line 148 def pending_ajax_requests_num page.evaluate_script("window.activeRequests") end |
.wait ⇒ Object
125 126 127 128 129 130 131 132 133 |
# File 'lib/cucumber/pickles/helpers/waiter.rb', line 125 def wait wait_for_ajax return unless block_given? page.document.synchronize do yield end end |
.wait_for_ajax ⇒ Object
waits for all Ajax requests to finish
142 143 144 145 146 |
# File 'lib/cucumber/pickles/helpers/waiter.rb', line 142 def wait_for_ajax page.document.synchronize do pending_ajax_requests_num.zero? || raise(::ElementNotFound) end end |