diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-05-12 17:10:12 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-05-12 17:10:12 -0500 |
commit | 718350dc9fbfea4836f0cfb2955d3d8653ba7901 (patch) | |
tree | ece139dee47d0af85279f79b029628e7c65c23cc | |
parent | ec1a3c093f7a8d2fe29e46ec06e6b35e3f1d97ff (diff) | |
download | gitlab-ce-718350dc9fbfea4836f0cfb2955d3d8653ba7901.tar.gz |
Wait for requests after each Spinach scenario instead of featuredm-wait-for-requests
-rw-r--r-- | features/support/env.rb | 4 | ||||
-rw-r--r-- | spec/support/wait_for_requests.rb | 7 |
2 files changed, 3 insertions, 8 deletions
diff --git a/features/support/env.rb b/features/support/env.rb index 568eeae4479..23a1f702068 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -30,8 +30,8 @@ Spinach.hooks.before_run do include FactoryGirl::Syntax::Methods end -Spinach.hooks.after_feature do |feature_data| - if feature_data.scenarios.flat_map(&:tags).include?('javascript') +Spinach.hooks.after_scenario do |scenario_data, step_definitions| + if scenario_data.tags.include?('javascript') include WaitForRequests wait_for_requests_complete end diff --git a/spec/support/wait_for_requests.rb b/spec/support/wait_for_requests.rb index a18c8e03aa6..d41e83ae128 100644 --- a/spec/support/wait_for_requests.rb +++ b/spec/support/wait_for_requests.rb @@ -10,17 +10,12 @@ module WaitForRequests def wait_for_requests_complete Gitlab::Testing::RequestBlockerMiddleware.block_requests! wait_for('pending AJAX requests complete') do - Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero? && - finished_all_requests? + Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero? end ensure Gitlab::Testing::RequestBlockerMiddleware.allow_requests! end - def finished_all_requests? - finished_all_ajax_requests? && finished_all_vue_resource_requests? - end - # Waits until the passed block returns true def wait_for(condition_name, max_wait_time: Capybara.default_max_wait_time, polling_interval: 0.01) wait_until = Time.now + max_wait_time.seconds |