diff options
author | Stan Hu <stanhu@gmail.com> | 2017-06-16 02:46:18 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-06-16 02:48:40 +0300 |
commit | aac1e8181cb2e33d16c7bb91af3fc69d4e847b91 (patch) | |
tree | 17c58c818dd6d658d5df1bcf75f13390b2960557 /spec/support/wait_for_requests.rb | |
parent | ae9d191e566b036798816e5f8bf5ef1dc0ff3e90 (diff) |
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
Diffstat (limited to 'spec/support/wait_for_requests.rb')
-rw-r--r-- | spec/support/wait_for_requests.rb | 2 |
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! |