Class: Saucer::Driver
- Inherits:
-
Selenium::WebDriver::Remote::Driver
- Object
- Selenium::WebDriver::Remote::Driver
- Saucer::Driver
- Defined in:
- lib/saucer/driver.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Driver
constructor
A new instance of Driver.
- #quit ⇒ Object
- #sauce ⇒ Object
Constructor Details
#initialize(*args) ⇒ Driver
Returns a new instance of Driver.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/saucer/driver.rb', line 6 def initialize(*args) browser = args.shift if args.first.is_a? Symbol browser = nil if browser == :remote opt = args.first || {} unless opt[:desired_capabilities].is_a? Selenium::WebDriver::Remote::Capabilities opts = opt[:desired_capabilities] || {} browser = opt.key?(:browser_name) ? opt[:browser_name].downcase.to_sym : browser || :chrome opt[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.send(browser, opts) end @config = Config::Selenium.new(opt) opt[:url] = @config.url opt[:desired_capabilities] = @config.capabilities super(opt) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/saucer/driver.rb', line 4 def config @config end |
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
4 5 6 |
# File 'lib/saucer/driver.rb', line 4 def driver @driver end |
Instance Method Details
#quit ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/saucer/driver.rb', line 27 def quit if RSpec.current_example exception = RSpec.current_example.exception result = exception.nil? elsif Saucer::Config::Sauce.scenario exception = Saucer::Config::Sauce.scenario.exception result = Saucer::Config::Sauce.scenario.passed? end if exception sauce.comment = "Error: #{exception.inspect}" sauce.comment = "Error Location: #{exception.backtrace.first}" end sauce.job_result = result unless result.nil? results = sauce.api.job.log_url[/(.*)\/.*$/, 1] Selenium::WebDriver.logger.warn("Sauce Labs results: #{results}") super end |