我将 Rspec 与 Capybara 和 WebMock 一起用于我的测试(我也在使用 Charles 代理),出现以下错误,从未在特定测试中。
我偶尔会发生这种情况,主要使用 rspec-retry 来处理它,但现在我注意到每次遇到此错误都需要花费大量时间。
有任何想法吗?
Curl::Err::ConnectionFailedError: Couldn't connect to server
/home/user/.rvm/gems/ruby-2.2.4/gems/curb-0.8.8/lib/curl/easy.rb:72:in `perform'
/home/user/.rvm/gems/ruby-2.2.4/gems/curb-0.8.8/lib/curl/easy.rb:294:in `http'
/home/user/.rvm/gems/ruby-2.2.4/gems/curb-0.8.8/lib/curl/easy.rb:294:in `http_get'
/home/user/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/curb.rb:63:in `request'
/home/user/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
/home/user/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:649:in `raw_execute'
/home/user/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:627:in `execute'
/home/user/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:576:in `isElementDisplayed'
/home/user/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/element.rb:190:in `displayed?'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/selenium/node.rb:126:in `visible?'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/element.rb:252:in `block in visible?'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/base.rb:81:in `synchronize'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/element.rb:252:in `visible?'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/queries/selector_query.rb:49:in `matches_filters?'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/result.rb:28:in `block in initialize'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/result.rb:28:in `select'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/result.rb:28:in `initialize'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/queries/selector_query.rb:120:in `new'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/queries/selector_query.rb:120:in `block in resolve_for'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/base.rb:81:in `synchronize'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/queries/selector_query.rb:108:in `resolve_for'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/matchers.rb:125:in `block in assert_selector'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/matchers.rb:124:in `assert_selector'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/matchers.rb:40:in `has_selector?'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/node/matchers.rb:271:in `has_css?'
/home/user/.rvm/gems/ruby-2.2.4/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
./spec/charts/charts_dialog_spec.rb:203:in `block in simple_chart_breakdown_initial'
./spec/charts/charts_dialog_spec.rb:201:in `times'
./spec/charts/charts_dialog_spec.rb:201:in `simple_chart_breakdown_initial'
./spec/charts/charts_dialog_spec.rb:1113:in `block (7 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.2.4/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:98:in `block in run'
/home/user/.rvm/gems/ruby-2.2.4/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:88:in `loop'
/home/user/.rvm/gems/ruby-2.2.4/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:88:in `run'
/home/user/.rvm/gems/ruby-2.2.4/gems/rspec-retry-0.4.5/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
/home/user/.rvm/gems/ruby-2.2.4/gems/rspec-retry-0.4.5/lib/rspec/retry.rb:22:in `block (2 levels) in setup'
-e:1:in `load'
-e:1:in `<main>'
原始 Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.5)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
archive-zip (0.7.0)
io-like (~> 0.3.0)
backports (3.6.8)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.2.2)
capybara (2.7.1)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.0.0)
archive-zip (~> 0.7.0)
nokogiri (~> 1.6)
ci_reporter (2.0.0)
builder (>= 2.1.2)
ci_reporter_rspec (1.0.0)
ci_reporter (~> 2.0)
rspec (>= 2.14, < 4)
coderay (1.1.0)
crack (0.4.3)
safe_yaml (~> 1.0.0)
curb (0.8.8)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
ffi (1.9.14)
ffi (1.9.14-x64-mingw32)
hashdiff (0.2.3)
i18n (0.7.0)
interception (0.5)
io-like (0.3.0)
json (1.8.3)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.8.3)
multi_json (1.12.1)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
nokogiri (1.6.8-x64-mingw32)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
parallel (1.6.1)
parallel_tests (2.2.1)
parallel
pkg-config (1.1.7)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rescue (1.4.2)
interception (>= 0.5)
pry
pry-stack_explorer (0.4.9.2)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
puma (2.15.3)
rack (1.6.4)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rake (10.4.2)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.1)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-retry (0.4.5)
rspec-core
rspec-support (3.4.1)
rubyzip (1.2.0)
safe_yaml (1.0.4)
selenium-webdriver (2.53.4)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
sinatra-contrib (1.4.7)
backports (>= 2.0)
multi_json
rack-protection
rack-test
sinatra (~> 1.4.0)
tilt (>= 1.3, < 3)
slop (3.6.0)
thread_safe (0.3.5)
tilt (2.0.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
webmock (1.22.3)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket (1.2.3)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
x64-mingw32
DEPENDENCIES
capybara
chromedriver-helper
ci_reporter_rspec
curb
factory_girl
parallel_tests
pry-rescue
pry-stack_explorer
puma
rake
rspec
rspec-retry
selenium-webdriver
sinatra
sinatra-contrib
webmock
BUNDLED WITH
1.11.2
新 Gemfile 的差异,仍然“无法连接到服务器”错误:
capybara (2.14.0)
rspec (>= 2.2.0, < 4)
selenium-webdriver (3.4.0)