Skip to content
This repository was archived by the owner on Jul 20, 2026. It is now read-only.

Testing Framework Setup

lkhoward edited this page Mar 11, 2016 · 2 revisions

For RSpec (spec_helper.rb) or Cucumber (env.rb), you will want to setup your Huzzah configuration and define your custom drivers the same way. Other testing frameworks should have a similar setup.

require 'huzzah'
require 'watir-webdriver'


Huzzah.define_driver(:grid_firefox) do
  client = Selenium::WebDriver::Remote::Http::Default.new
  client.timeout = 120
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile['browser.fixup.alternate.enabled'] = false
  profile['network.dns.disablePrefetch'] = true
  profile['network.http.connect.timeout'] = 120
  profile['network.http.request.timeout'] = 120

  caps = Selenium::WebDriver::Remote::Capabilities.firefox(firefox_profile: profile,
                                                           version: '40',
                                                           platform: 'linux')
  driver = Selenium::WebDriver.for(:remote,
                                   url: 'http://my_gridhub01.local:9000/wd/hub',
                                   desired_capabilities: caps,
                                   http_client: client)
  Watir::Browser.new(driver)
end

Huzzah.configure do |config|
  config.path = "#{your_project_path}/lib/huzzah"
  config.default_driver = ENV['BROWSER'] ||= 'firefox'
  config.environment = ENV['AUTO_ENV'] ||= 'qa'
end

See Configuration and Defining Custom Drivers for more information.

Clone this wiki locally