Created
July 26, 2010 23:23
-
-
Save jeffrafter/491438 to your computer and use it in GitHub Desktop.
Cucumber env on windows for external server with proxy override
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end | |
require 'rack/test' | |
require 'capybara/cucumber' | |
# Need to override the driver to setup our proxy profile | |
class Capybara::Driver::Selenium | |
def self.driver | |
unless @driver | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile["network.proxy.type"] = 1 | |
profile["network.proxy.http"] = "someserver.somecompany.com" | |
profile["network.proxy.http_port"] = 80 | |
@driver = Selenium::WebDriver.for(:firefox, :profile => profile) | |
at_exit do | |
@driver.quit | |
end | |
end | |
@driver | |
end | |
end | |
# Lets you click links with onclick javascript handlers without using @culerity or @javascript | |
# require 'cucumber/rails/capybara_javascript_emulation' | |
Capybara.current_driver = :selenium | |
Capybara.run_server = false | |
Capybara.app_host = 'http://worldcup.socialrange.org' | |
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In | |
# order to ease the transition to Capybara we set the default here. If you'd | |
# prefer to use XPath just remove this line and adjust any selectors in your | |
# steps to use the XPath syntax. | |
Capybara.default_selector = :css |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does it work with passwords where you have to type on a popup the first time you open the browser?