Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-12-08 01:08:22 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-12-08 01:40:17 +0300
commitbdb4945dcf3c899c6a88fd42657a1b3f04baced1 (patch)
treec200dd2911336dd64575835e59f83368afc98736 /spec/support/wait_for_ajax.rb
parent2928e19d4356683119cf0d2bb269752253ea5d50 (diff)
Fix random failing test - delete attachment
Make sure we wait for AJAX request to finish before end test and cleanup database Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/support/wait_for_ajax.rb')
-rw-r--r--spec/support/wait_for_ajax.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/wait_for_ajax.rb b/spec/support/wait_for_ajax.rb
new file mode 100644
index 00000000000..692d219e9f1
--- /dev/null
+++ b/spec/support/wait_for_ajax.rb
@@ -0,0 +1,11 @@
+module WaitForAjax
+ def wait_for_ajax
+ Timeout.timeout(Capybara.default_wait_time) do
+ loop until finished_all_ajax_requests?
+ end
+ end
+
+ def finished_all_ajax_requests?
+ page.evaluate_script('jQuery.active').zero?
+ end
+end