diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/support/capybara.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/support/capybara.rb')
-rw-r--r-- | spec/support/capybara.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 90adfb1a2ee..38f9ccf23f5 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -7,7 +7,7 @@ require 'capybara-screenshot/rspec' require 'selenium-webdriver' # Give CI some extra time -timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30 +timeout = ENV['CI'] || ENV['CI_SERVER'] ? 60 : 30 # Define an error class for JS console messages JSConsoleError = Class.new(StandardError) @@ -95,12 +95,23 @@ RSpec.configure do |config| config.include CapybaraHelpers, type: :feature config.before(:context, :js) do + # This prevents Selenium from creating thousands of connections while waiting for + # an element to appear + webmock_enable_with_http_connect_on_start! + next if $capybara_server_already_started TestEnv.eager_load_driver_server $capybara_server_already_started = true end + config.after(:context, :js) do + # WebMock doesn't stub connections, so we need to restore the original behavior + # to prevent many specs from failing: + # https://github.com/bblimke/webmock/blob/master/README.md#connecting-on-nethttpstart + webmock_enable! + end + config.before(:example, :js) do session = Capybara.current_session |