Class: Hollandaise::Browser::Sauce
- Inherits:
-
Base
- Object
- Base
- Hollandaise::Browser::Sauce
show all
- Defined in:
- lib/hollandaise/browser/sauce.rb
Instance Attribute Summary
Attributes inherited from Base
#browser
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#close, #dir, #take_screenshot
Constructor Details
#initialize(browser, version, os, options) ⇒ Sauce
Returns a new instance of Sauce.
4
5
6
|
# File 'lib/hollandaise/browser/sauce.rb', line 4
def initialize(browser, version, os, options)
@browser, @version, @os, @options = browser, version, os, options
end
|
Class Method Details
.start_tunnel ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/hollandaise/browser/sauce.rb', line 21
def self.start_tunnel
return @tunnel if @tunnel
@tunnel = ::Sauce::Connect.new
@tunnel.connect
@tunnel.wait_until_ready
at_exit do
@tunnel.disconnect
end
end
|
Instance Method Details
#info ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/hollandaise/browser/sauce.rb', line 41
def info
{
:browser => @browser,
:browser_version => @version,
:os => @os,
:browser_url => @url,
:job_name => "#{@url}"
}
end
|
#name ⇒ Object
37
38
39
|
# File 'lib/hollandaise/browser/sauce.rb', line 37
def name
"#{@browser} #{@version} #{@os}"
end
|
#run_and_take_screenshot(url, *args) ⇒ Object
15
16
17
18
19
|
# File 'lib/hollandaise/browser/sauce.rb', line 15
def run_and_take_screenshot(url, *args)
self.class.start_tunnel if URI(url).host == 'localhost'
super
end
|
#selenium ⇒ Object
8
9
10
11
12
13
|
# File 'lib/hollandaise/browser/sauce.rb', line 8
def selenium
require 'sauce'
require 'sauce/selenium'
@selenium ||= ::Sauce::Selenium2.new(info)
end
|
#target ⇒ Object
33
34
35
|
# File 'lib/hollandaise/browser/sauce.rb', line 33
def target
dir.join(@os.to_s).join("#{@browser} #{@version || 'latest'}.png")
end
|