diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-02 13:03:23 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-02 13:03:23 +0000 |
commit | a72a9af092c1bfcf9f8024d59c11cf222f07e1e7 (patch) | |
tree | 44b60265c1d476d026b2862d2c1244748f558d4f /qa/qa/support | |
parent | b085478c4c2bed74fdc6eb2c33bfc62e791baf03 (diff) | |
download | gitlab-ce-a72a9af092c1bfcf9f8024d59c11cf222f07e1e7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/qa/support')
-rw-r--r-- | qa/qa/support/wait_for_requests.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/qa/qa/support/wait_for_requests.rb b/qa/qa/support/wait_for_requests.rb new file mode 100644 index 00000000000..c573fc1f8e1 --- /dev/null +++ b/qa/qa/support/wait_for_requests.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module QA + module Support + module WaitForRequests + module_function + + def wait_for_requests + Waiter.wait do + finished_all_ajax_requests? && finished_all_axios_requests? + end + end + + def finished_all_axios_requests? + Capybara.page.evaluate_script('window.pendingRequests || 0').zero? + end + + def finished_all_ajax_requests? + return true if Capybara.page.evaluate_script('typeof jQuery === "undefined"') + + Capybara.page.evaluate_script('jQuery.active').zero? + end + end + end +end |