user1611830 user1611830 - 1 year ago 138
Javascript Question

javascript rspec testing times out

I am using

to test my rails app. Precisely, I test some javascript code. In fact, running test launches
(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

How can I fix this ?

Answer Source

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:

# Capybara.server_port = 3001 = # 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 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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download