diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-07 23:08:22 +0100 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-07 23:40:17 +0100 |
commit | bdb4945dcf3c899c6a88fd42657a1b3f04baced1 (patch) | |
tree | c200dd2911336dd64575835e59f83368afc98736 /spec/support | |
parent | 2928e19d4356683119cf0d2bb269752253ea5d50 (diff) | |
download | gitlab-ce-bdb4945dcf3c899c6a88fd42657a1b3f04baced1.tar.gz |
Fix random failing test - delete attachmentfix-random-test
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')
-rw-r--r-- | spec/support/wait_for_ajax.rb | 11 |
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 |