Class: ActiveSupport::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/saucelabs_adapter/test_unit_adapter.rb

Instance Method Summary collapse

Instance Method Details

#configure_seleniumObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/saucelabs_adapter/test_unit_adapter.rb', line 8

def configure_selenium
  puts "[saucelabs-adapter] configuring selenium..." if ENV['SAUCELABS_ADAPTER_DEBUG'] && ENV['SAUCELABS_ADAPTER_DEBUG'].to_i >= 2
  selenium_config = SaucelabsAdapter::SeleniumConfig.new(ENV['SELENIUM_ENV'])
  if defined?(Polonium)
    polonium_config = Polonium::Configuration.instance
    selenium_config.configure_polonium(polonium_config)
  elsif defined?(Webrat)
    webrat_config = Webrat.configuration
    selenium_config.configure_webrat(webrat_config)
  else
    puts "[saucelabs-adapter] Starting browser session"
    @browser = selenium_config.create_driver
    @browser.start_new_browser_session :trustAllSSLCertificates => false
  end
end

#teardownObject



24
25
26
27
28
29
30
# File 'lib/saucelabs_adapter/test_unit_adapter.rb', line 24

def teardown
  if defined?(@browser)
    puts "[saucelabs-adapter] Ending browser session"
    @browser.close_current_browser_session
  end
  super
end