简体   繁体   中英

Cucumber/Capybara won't run in selenium mode on rails 2.3 app

Okay, I'm running into a strange error with a cucumber scenario on a Rails 2 app.

We're running our Cucumber suite under Capybara Webkit. This, for the most part is working fine, but I have a test that's failing during an ajax transaction because it can't see the element that should be appearing on the page.

I initially though this was a race condition and upped the max timeout, but no matter how long we wait around, the element is not found.

So I wanted to see it in action, so I tried to switch to Selenium so I could watch the whole test end-to-end.

However, whenever I try to run it through selenium, it fails right out of the gate during the first setup step with the error:

Given I am logged in # features/step_definitions/users/authentication_steps.rb:5
  HTTP request path is empty (ArgumentError)
  /home/dvg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1860:in `initialize'
  /home/dvg/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2093:in `initialize'
  ./features/support/assumption.rb:48:in `login'
  ./features/step_definitions/users/authentication_steps.rb:7:in `/^I am logged in$/'
  features/requests/user_requests_a_thing.feature:4:in `Given I am logged in'

I have messed with every setting I can think of to try and get it working.

I have tried:

  1. Switching from Firefox to ChromeDriver
  2. Defining App Host
  3. Defining a NO_PROXY environment vriable in case the proxy server was getting in the way (which I think is something Selenium Webdriver looks at)
  4. Refactoring to use path_helpers instead of visit "/login" style steps
  5. Updating the bundle

Special Considerations:

  1. We are a rails 2.3 app that just converted from Ruby 1.8.7 to 1.9.3
  2. We are using the latest Cucumber/Capybara

这是没有代理变量,但需要

ENV['no_proxy'] = "127.0.0.1"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM