Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Created February 8, 2013 05:05
Show Gist options
  • Save DylanLacey/4736721 to your computer and use it in GitHub Desktop.
Save DylanLacey/4736721 to your computer and use it in GitHub Desktop.
How to set the name of your tests for Selenium::WebDriver & Sauce Labs, in Ruby. Lots of other things can be set this way, check out https://saucelabs.com/docs/additional-config under the "Job Annotation" heading.
# Where you create your WebDriver object, set a "name" key-value pair to name a test:
Capybara.register_driver :selenium do |app|
require 'selenium-webdriver'
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
capabilities[:name] = "Some Sort Of Test"
Capybara::Selenium::Driver.new(app, {
:url => "http://username:[email protected]:80/wd/hub",
:browser => :remote,
:desired_capabilities => capabilities
})
# Where you create your WebDriver Object
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
capabilities[:name] = "Some Sort Of Test"
driver = Selenium::WebDriver.for(
:browser => :remote,
:url => "http://username:[email protected]:80/wd/hub",
:desired_capabilities => capabilities
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment