diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-16 12:35:00 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-16 12:35:00 +0300 |
commit | 2e08fd3c9c92e7f572665fbacc8602bee80c5ad1 (patch) | |
tree | 9fbd5c49928088efeb91a1e55aecdf297d576f11 | |
parent | 301386ed5ff3c0e99c04f6fa98474407aaf78754 (diff) | |
parent | fdf78bb9c71c6b3119a054adeec2bb1c55b46284 (diff) |
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
-rw-r--r-- | spec/support/wait_for_requests.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/support/wait_for_requests.rb b/spec/support/wait_for_requests.rb index 05ec9026141..1cbe609c0e0 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! @@ -40,13 +40,13 @@ module WaitForRequests end def finished_all_vue_resource_requests? - page.evaluate_script('window.activeVueResources || 0').zero? + Capybara.page.evaluate_script('window.activeVueResources || 0').zero? end 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 def javascript_test? |