summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-06-15 16:46:18 -0700
committerStan Hu <stanhu@gmail.com>2017-06-15 16:48:40 -0700
commitaac1e8181cb2e33d16c7bb91af3fc69d4e847b91 (patch)
tree17c58c818dd6d658d5df1bcf75f13390b2960557
parentae9d191e566b036798816e5f8bf5ef1dc0ff3e90 (diff)
downloadgitlab-ce-aac1e8181cb2e33d16c7bb91af3fc69d4e847b91.tar.gz
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
-rw-r--r--spec/support/wait_for_requests.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/support/wait_for_requests.rb b/spec/support/wait_for_requests.rb
index 05ec9026141..ebdc62e4bca 100644
--- a/spec/support/wait_for_requests.rb
+++ b/spec/support/wait_for_requests.rb
@@ -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!