Commit aac1e818 authored by Stan Hu's avatar Stan Hu

Wait for all Ajax and Vue requests to complete in JavaScript tests

From logs in #33756, we that it's possible for an Ajax call to be made
before the middleware receives it. To prevent stray Ajax calls from
breaking other specs, we need to wait for all scheduled calls to finish.

Closes #33756
parent ae9d191e
......@@ -7,7 +7,7 @@ module WaitForRequests
def block_and_wait_for_requests_complete
Gitlab::Testing::RequestBlockerMiddleware.block_requests!
wait_for('pending requests complete') do
Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero?
Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero? && finished_all_requests?
end
ensure
Gitlab::Testing::RequestBlockerMiddleware.allow_requests!
......
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