0

I am using capybara and rspec to test my rails app. Precisely, I test some javascript code. In fact, running test launches firefox (how can I configure this ?). First, the page loading in firefox browser is very long and then I get this error

Failure/Error: visit root_path
     Net::ReadTimeout:
       Net::ReadTimeout

How can I fix this ?

user1611830
  • 4,749
  • 10
  • 52
  • 89

2 Answers2

0

Your firefox browser is starting because Capybara is using default web-driver (selenium). If you would like not to load browser, you can switch capybara javascript driver to webkit for example. Please, consider this to understand how to install webkit driver.

With regards to this Net::ReadTimeout I think that you need to specify correct host and correct port for Capybara in your spec_helper:

spec_helper.rb:
# Capybara.server_port = 3001
Capybara.host = 127.0.0.1 # Try to experiment with this option !

Capybara.javascript_driver = :webkit # or :selenium
Capybara.current_driver = :webkit # or :selenium
Capybara.run_server = true #Whether start server when testing
# Capybara.default_selector = :css #:xpath #default selector , you can change to :css
Capybara.default_wait_time = 3 #When we testing AJAX, we can set a default wait time
Capybara.ignore_hidden_elements = false #Ignore hidden elements when testing, make helpful when you hide or show elements using javascript

If you have problems with 127.0.0.1 address It can be due to the wrong proxy config in your shell. Try to start you webserver on adress %your_IP_adress%

It can be helpful to inspect this topic in order to understand how to set chrome browser instead of firefox if you are using Selenium web-driver

Community
  • 1
  • 1
Mihail Davydenkov
  • 1,861
  • 2
  • 19
  • 33
0

Check out status bar in your browser. Perhaps, the point in a large picture, which demand a lot of time to download to. Try to remove all the pictures from root_path view.

Unkas
  • 3,522
  • 2
  • 19
  • 23