Class: Sauce::Jasmine::SeleniumDriver

Inherits:
Jasmine::SeleniumDriver
  • Object
show all
Defined in:
lib/sauce/jasmine/selenium_driver.rb

Instance Method Summary collapse

Constructor Details

#initialize(browser, host, port) ⇒ SeleniumDriver

Returns a new instance of SeleniumDriver.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sauce/jasmine/selenium_driver.rb', line 6

def initialize(browser, host, port)
  host = host[7..-1] if host =~ /^http:\/\//
  @host = host
  @port = port
  @tunnel_domain = "#{rand(10000)}.jasmine.test"
  @driver = Sauce::Selenium.new(:browser => browser,
                                :browser_url => "http://#{@tunnel_domain}",
                                :job_name => "Jasmine",
                                :'record-video' => false,
                                :'record-screenshots' => false)
end

Instance Method Details

#connectObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/sauce/jasmine/selenium_driver.rb', line 18

def connect
  puts "Setting up Sauce Connect..."
  @connection = Sauce::Connect.new(:domain => @tunnel_domain,
                                   :host => @host,
                                   :port => @port,
                                   :quiet => true)
  @connection.wait_until_ready
  puts "Sauce Connect ready."
  super
end

#disconnectObject



29
30
31
32
# File 'lib/sauce/jasmine/selenium_driver.rb', line 29

def disconnect
  @driver.stop
  @connection.disconnect if @connection
end