There are a lot of examples on how to perform javascript tests with Capybara/Selenium/Rspec in which you can write a test like so:
it \"does som
Just to update some information, there is a more powerful selenium-webdriver with Ruby Bindings now.
To test JavaScript on firefox from terminal quickly with Rails 4 and selenium-webdriver, you need to do the 4 steps below:
Add gem to your Gemfile
gem 'selenium-webdriver' gem 'minitest-rails'
Install gem
bundle install
Generate test case (Ref: Official Guide)
bin/rails generate integration_test your_case_name
Start to write test code in your test case. Actually you can write it in ruby without Capybara, to write case with Capybara you can refer to Capybara at Github
Minitest sample:
# create a driver
driver = Selenium::WebDriver.for :firefox
# navigate to a page
driver.navigate.to 'url_to_page'
# get element with class box
box = driver.find_element(:css, '.box')
# check width
# get width by execute JavaScript
assert_equal 100, driver.execute_script('return $(arguments[0]).width()', box)
Currently it seems lack of resources with respect to how to work with selenium-webdriver, CI server (Jenkins) and Rails minitest smoothly, I have created a simple project and hope it can help any one getting started quickly and easily: Rails Selenium Working Case
Also appreciate the comments that let me can make better answer.