saucer 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5f21ddff0974db9cf6930a8344d010b8aa2a7c6
4
- data.tar.gz: 4488033e1b91513f46917806312a5ef4368b2cc8
3
+ metadata.gz: f2dbf2b0339d94beec378bedf4fb5fff20c07ccf
4
+ data.tar.gz: 73e0fe1bdd5e8fb93f25dc06505073ccec501347
5
5
  SHA512:
6
- metadata.gz: 7b37864310312c7a204e314f951a17800e37dc654e6218b397af0d4a562234be8fb53ade2638594c017d490aa83bb378fddfa9bf1bb8b3a576f555ad4c0c8abb
7
- data.tar.gz: 9a575731b71aa3e1b326b635d4b369c6ea068a8581c32f71846b5567e1d35bff419f4de60e6385a9940a2573ef6cc5b7b07a82ac516257b53d82ca4333206442
6
+ metadata.gz: 1c7f46751be467415cea49ebcb1b0251ccb5e5d55c107804da909caf3204242a8ea2e2bc030180ba1ff3f606c0b83c6fa6e9e4b9ff8bea04a8a5ce72bb2db510
7
+ data.tar.gz: 8b59759a69338cd7fef28f71408ba78990d13e913ed947e4e23938b192c6b8d0daedcec44a49eb709838ef3df5ce8694ad42772589e1c29d1c2fcbde7b8e98bf
@@ -8,11 +8,12 @@ module Saucer
8
8
  avoid_proxy public record_video video_upload_on_pass record_screenshots
9
9
  record_logs capture_html priority webdriver_remote_quiet_exceptions).freeze
10
10
 
11
- attr_reader :config_params, :username, :access_key
11
+ attr_reader :config_params, :username, :access_key, :url
12
12
 
13
13
  def initialize(opts = {})
14
14
  @username = opts.delete(:username) || ENV['SAUCE_USERNAME']
15
15
  @access_key = opts.delete(:access_key) || ENV['SAUCE_ACCESS_KEY']
16
+ @url = opts.delete(:url) || "https://#{@username}:#{@access_key}@ondemand.saucelabs.com:443/wd/hub"
16
17
 
17
18
  @opts = opts
18
19
  @config_params = CONFIG_PARAMS
@@ -17,15 +17,19 @@ module Saucer
17
17
  end
18
18
 
19
19
  def capabilities
20
- caps = @config_params.each_with_object({}) do |param, hash|
21
- hash[param] = @opts[param] if @opts.key?(param)
22
- hash[param] ||= ENV[param.to_s] if ENV[param.to_s]
20
+ caps = @opts[:desired_capabilities]
21
+ caps ||= begin
22
+ caps = @config_params.each_with_object({}) do |param, hash|
23
+ hash[param] = @opts[param] if @opts.key?(param)
24
+ hash[param] ||= ENV[param.to_s] if ENV[param.to_s]
25
+ end
26
+ browser_name = @opts[:browser_name] || :chrome
27
+ ::Selenium::WebDriver::Remote::Capabilities.send(browser_name, caps)
23
28
  end
24
- @sauce = Sauce.new.to_hash
25
29
 
30
+ @sauce = Sauce.new.to_hash
26
31
  caps[:"sauce:data"] = @sauce.to_hash
27
- browser_name = @opts[:browser_name] || :chrome
28
- ::Selenium::WebDriver::Remote::Capabilities.send(browser_name, caps)
32
+ caps
29
33
  end
30
34
  end
31
35
 
data/lib/saucer/driver.rb CHANGED
@@ -4,8 +4,12 @@ module Saucer
4
4
  attr_reader :driver, :config
5
5
 
6
6
  def initialize(opt = {})
7
- caps = opt[:desired_capabilities] || {}
8
- @config = Config::Selenium.new(caps)
7
+ unless opt[:desired_capabilities].is_a? Selenium::WebDriver::Remote::Capabilities
8
+ opts = opt[:desired_capabilities] || {}
9
+ browser = opt.key?(:browser_name) ? opt[:browser_name].downcase.to_sym : :chrome
10
+ opt[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.send(browser, opts)
11
+ end
12
+ @config = Config::Selenium.new(opt)
9
13
 
10
14
  opt[:url] = @config.url
11
15
  opt[:desired_capabilities] = @config.capabilities
@@ -1,3 +1,3 @@
1
1
  module Saucer
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner