Skip to content

Instantly share code, notes, and snippets.

@giosakti
Created July 2, 2012 00:47
Show Gist options
  • Save giosakti/3030264 to your computer and use it in GitHub Desktop.
Save giosakti/3030264 to your computer and use it in GitHub Desktop.
[RoR] Run ajax cucumber features remotely
require "selenium-webdriver"
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.http.use-cache"] = false
Capybara.register_driver :firefox_host do |app|
Capybara::Selenium::Driver.new(app,
:browser => :remote,
:url => 'http://10.0.2.2:4444/wd/hub',
:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
)
end
Capybara.server_port = 9300
Capybara.app_host = 'http://localhost:9300'
Capybara.javascript_driver = :firefox_host

Download and run selenium server on host.

java -jar selenium-server-standalone.jar

Modify spec_helper.rb

see spec_helper.rb

Modify Vagrantfile to forward port (if using Vagrant).

config.vm.forward_port 9300, 9300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment