BigW Consortium Gitlab

Commit 2e08fd3c by Rémy Coutable

Merge branch 'sh-fix-issue-33756' into 'master'

Wait for all Ajax and Vue requests to complete in JavaScript tests Closes #33756 See merge request !12203
parents 301386ed fdf78bb9
...@@ -7,7 +7,7 @@ module WaitForRequests ...@@ -7,7 +7,7 @@ module WaitForRequests
def block_and_wait_for_requests_complete def block_and_wait_for_requests_complete
Gitlab::Testing::RequestBlockerMiddleware.block_requests! Gitlab::Testing::RequestBlockerMiddleware.block_requests!
wait_for('pending requests complete') do wait_for('pending requests complete') do
Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero? Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero? && finished_all_requests?
end end
ensure ensure
Gitlab::Testing::RequestBlockerMiddleware.allow_requests! Gitlab::Testing::RequestBlockerMiddleware.allow_requests!
...@@ -40,13 +40,13 @@ module WaitForRequests ...@@ -40,13 +40,13 @@ module WaitForRequests
end end
def finished_all_vue_resource_requests? def finished_all_vue_resource_requests?
page.evaluate_script('window.activeVueResources || 0').zero? Capybara.page.evaluate_script('window.activeVueResources || 0').zero?
end end
def finished_all_ajax_requests? def finished_all_ajax_requests?
return true if page.evaluate_script('typeof jQuery === "undefined"') return true if Capybara.page.evaluate_script('typeof jQuery === "undefined"')
page.evaluate_script('jQuery.active').zero? Capybara.page.evaluate_script('jQuery.active').zero?
end end
def javascript_test? def javascript_test?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment