summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-18 18:55:11 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-10-18 18:55:11 +0300
commit82033e2edc43b34823625f886f229e5ae944d4d6 (patch)
tree9424eac6efc01c8f348e87c761246a00f4dc67c2 /features
parent146e0cbc4dfb857e0eb44777c40da5df56f376e0 (diff)
downloadgitlab-ce-82033e2edc43b34823625f886f229e5ae944d4d6.tar.gz
Wait for ajax for every merge request spinach testdz-spinach-wait-ajax
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'features')
-rw-r--r--features/steps/project/merge_requests.rb4
-rw-r--r--features/steps/shared/note.rb2
-rw-r--r--features/support/env.rb2
-rw-r--r--features/support/wait_for_ajax.rb11
4 files changed, 5 insertions, 14 deletions
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index 44346d99f44..2ccab4334eb 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -9,6 +9,10 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
include SharedUser
include WaitForAjax
+ after do
+ wait_for_ajax if javascript_test?
+ end
+
step 'I click link "New Merge Request"' do
click_link "New Merge Request"
end
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index d3b5b0bdebe..9dc1fc41b3b 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -1,5 +1,3 @@
-require Rails.root.join('features/support/wait_for_ajax')
-
module SharedNote
include Spinach::DSL
include WaitForAjax
diff --git a/features/support/env.rb b/features/support/env.rb
index 569fd444e86..8dbe3624410 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -15,7 +15,7 @@ if ENV['CI']
Knapsack::Adapters::SpinachAdapter.bind
end
-%w(select2_helper test_env repo_helpers).each do |f|
+%w(select2_helper test_env repo_helpers wait_for_ajax).each do |f|
require Rails.root.join('spec', 'support', f)
end
diff --git a/features/support/wait_for_ajax.rb b/features/support/wait_for_ajax.rb
deleted file mode 100644
index b90fc112671..00000000000
--- a/features/support/wait_for_ajax.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module WaitForAjax
- def wait_for_ajax
- Timeout.timeout(Capybara.default_max_wait_time) do
- loop until finished_all_ajax_requests?
- end
- end
-
- def finished_all_ajax_requests?
- page.evaluate_script('jQuery.active').zero?
- end
-end