Skip to content

Instantly share code, notes, and snippets.

@scytacki
Created March 1, 2011 19:53
Show Gist options
  • Save scytacki/849756 to your computer and use it in GitHub Desktop.
Save scytacki/849756 to your computer and use it in GitHub Desktop.
put this in features/support to enable remote running of cucumber selenium tests
# HOST_OF_SELENIUM_BROWSER_SERVER=10.0.2.2
# HOST_OF_APP_BEING_TESTED=33.33.33.10
if ENV['HOST_OF_SELENIUM_BROWSER_SERVER'] and ENV['HOST_OF_APP_BEING_TESTED']
# if capybara supported this type of approach: http://selenium-client-factory.infradna.com/
# this code could be removed
require 'selenium-webdriver'
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.http.use-cache"] = false
Capybara.register_driver :selenium do |app|
Capybara::Driver::Selenium.new(app,
:browser => :remote,
:url => "http://#{ENV['HOST_OF_SELENIUM_BROWSER_SERVER']}:4444/wd/hub",
:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
)
end
class Capybara::Server
def host
ENV['HOST_OF_APP_BEING_TESTED']
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment