Skip to content

Instantly share code, notes, and snippets.

@bbbco
Created January 15, 2014 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbbco/8446710 to your computer and use it in GitHub Desktop.
Save bbbco/8446710 to your computer and use it in GitHub Desktop.
Sample of SWD config
# $> URL=theinternet BROWSER=firefox rspec spec/
URL_CONFIG = {
"theinternet" => {
:url => "http://the-internet.herokuapp.com",
:type => "staging"
},
"elemental-selenium" => {
:url => "http://elemental-selenium.com",
:type => "production"
}
"theinternetlocal" => {
:url => "http://the-internet-local:4567",
:type => "local"
}
}
BROWSER_CONFIG = {
"firefox" => {
:browser => :firefox,
:profile => { ...
},
:capabilities => { ...
}
},
"chrome" => {
:browser => :chrome,
:profile => { ...
},
:capabilities => { ...
}
}
}
PROXY = ENV['PROXY'] || "local"
url = ENV['URL'] || "theinternet"
$base_url = URL_CONFIG[url][:url]
$url_type = URL_CONFIG[url][:type]
browser_choice = ENV['BROWSER'] || "firefox"
if PROXY == "local"
# ... code to generate profile via BROWSER_CONFIG
$driver = Selenium::WebDriver.for BROWSER_CONFIG[browser_choice][:browser], :profile => profile
elsif PROXY == "sauce"
# ... code to generate caps via BROWSER_CONFIG
$driver = Selenium::WebDriver.for BROWSER_CONFIG[browser_choice][:browser], :desired_capabilities => caps
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment