selenium-connect 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ #3.3.0 (2013-07-24)
2
+ updated configuration to support any sauce config and set default sauce selenium version
3
+
4
+ - Bumped version to 3.3.0 to prepare for release.
5
+ - updated the configuration object to support passing any arbitrary sauce configuration parameter while also supporting the original configurations for backwards compatibility, also setting a default selenium server version
6
+
1
7
  #3.2.0 (2013-07-15)
2
8
  added better error handling to the sauce api calls and improved naming convention for job assets
3
9
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #selenium-connect 3.2.0 (2013-07-15)
1
+ #selenium-connect 3.3.0 (2013-07-24)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/selenium-connect.png)](http://badge.fury.io/rb/selenium-connect) [![Build Status](https://travis-ci.org/arrgyle/selenium-connect.png?branch=develop)](https://travis-ci.org/arrgyle/selenium-connect) [![Code Climate](https://codeclimate.com/github/arrgyle/selenium-connect.png)](https://codeclimate.com/github/arrgyle/selenium-connect) [![Coverage Status](https://coveralls.io/repos/arrgyle/selenium-connect/badge.png?branch=develop)](https://coveralls.io/r/arrgyle/selenium-connect?branch=develop)
4
4
 
@@ -85,12 +85,19 @@ profile_path:
85
85
  profile_name:
86
86
 
87
87
  # Saucelabs
88
- os:
89
88
  sauce_username: 'test_user_name'
90
89
  sauce_api_key:
90
+ api_timeout: #how many seconds we should try to get the assets (default 10)
91
+ os:
91
92
  browser_version:
92
93
  description: #sauce job/test description
93
- api_timeout: #how many seconds we should try to get the assets (default 10)
94
+ # set any sauce options below, they will override those above
95
+ sauce_opts:
96
+ selenium_version: #default is 2.33.0
97
+ os:
98
+ browser_version:
99
+ job_name: #sauce job/test description
100
+
94
101
  ```
95
102
 
96
103
  You can pass parameters into the new config object like:
@@ -1,6 +1,7 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  require 'yaml'
4
+ require 'ostruct'
4
5
 
5
6
  # selenium connect
6
7
  class SeleniumConnect
@@ -12,20 +13,30 @@ class SeleniumConnect
12
13
  :background, :log, :jar
13
14
 
14
15
  # Browsers
15
- attr_accessor :browser, :browser_path,
16
- :profile_path, :profile_name
16
+ attr_accessor :browser_path, :profile_path, :profile_name
17
17
 
18
18
  # SauceLabs
19
- attr_accessor :sauce_username, :sauce_api_key,
20
- :os, :browser_version, :description, :api_timeout
19
+ attr_accessor :sauce_username, :sauce_api_key, :api_timeout
20
+
21
+ attr_reader :sauce_opts, :browser, :description, :os, :browser_version
21
22
 
22
23
  def initialize(opts = {})
23
24
  @host = 'localhost'
24
25
  @port = 4444
25
26
  @browser = 'firefox'
27
+ @sauce_opts = OpenStruct.new
28
+ @sauce_opts.selenium_version = '2.33.0'
26
29
  populate_with_hash opts unless opts.empty?
27
30
  end
28
31
 
32
+ # TODO eventually roll all sauce options under this node
33
+ # and deprecate setting them at the top level
34
+ def sauce_opts=(opts = {})
35
+ opts.each do |key, value|
36
+ @sauce_opts.send("#{key}=", value) unless value.nil?
37
+ end
38
+ end
39
+
29
40
  def populate_with_hash(hash)
30
41
  hash.each do |key, value|
31
42
  begin
@@ -40,6 +51,29 @@ class SeleniumConnect
40
51
  populate_with_hash YAML.load_file file
41
52
  end
42
53
 
54
+ # The below methods are setters for the explicitly defined sauce and browser
55
+ # options, the is support future refactoring to a strutted config
56
+ # but maintains compatability for now.
57
+ def os=(os)
58
+ @os = os
59
+ @sauce_opts.os = os
60
+ end
61
+
62
+ def browser_version=(browser_version)
63
+ @browser_version = browser_version
64
+ @sauce_opts.browser_version = browser_version if @sauce_opts.browser_version.nil?
65
+ end
66
+
67
+ def description=(description)
68
+ @description = description
69
+ @sauce_opts.job_name = description if @sauce_opts.job_name.nil?
70
+ end
71
+
72
+ def browser=(browser)
73
+ @browser = browser
74
+ @sauce_opts.browser = browser if @sauce_opts.browser.nil?
75
+ end
76
+
43
77
  alias_method :config_file=, :populate_with_yaml
44
78
 
45
79
  end # Configuration
@@ -27,11 +27,7 @@ class SeleniumConnect
27
27
 
28
28
  def init_browser
29
29
  get_credentials
30
- Sauce::Selenium2.new({
31
- os: config.os,
32
- browser: config.browser,
33
- browser_version: config.browser_version,
34
- job_name: config.description })
30
+ Sauce::Selenium2.new(config.sauce_opts.marshal_dump)
35
31
  end
36
32
 
37
33
  end # Saucelabs
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'selenium-connect'
3
- s.version = '3.2.0'
3
+ s.version = '3.3.0'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ['Dave Haeffner', 'Jason Fox']
6
6
  s.email = ['dave@arrgyle.com', 'jason@arrgyle.com']
7
7
  s.homepage = 'https://github.com/arrgyle/selenium-connect'
8
8
  s.summary = 'A stupid simple way to run your Selenium tests on localhost, against a Selenium Grid, or in the cloud (e.g. SauceLabs).'
9
- s.description = 'added better error handling to the sauce api calls and improved naming convention for job assets'
9
+ s.description = 'updated configuration to support any sauce config and set default sauce selenium version'
10
10
  s.license = 'MIT'
11
11
 
12
12
  s.files = `git ls-files`.split($/)
@@ -16,9 +16,13 @@ profile_name:
16
16
 
17
17
 
18
18
  # Saucelabs
19
- os:
20
19
  sauce_username: 'test_user_name'
21
20
  sauce_api_key:
21
+ api_timeout: 10
22
+
23
+ os:
22
24
  browser_version:
23
25
  description:
24
- api_timeout: 10
26
+
27
+ sauce_opts:
28
+ selenium_version: '2.32.0'
@@ -45,4 +45,41 @@ describe SeleniumConnect::Configuration do
45
45
  @configuration.port.should eq 4444
46
46
  @configuration.browser.should eq 'firefox'
47
47
  end
48
+
49
+ it 'should allow for an arbitrary hash of sauce configuration' do
50
+ @configuration.populate_with_hash sauce_opts: { record_video: true, capture_html: true }
51
+ @configuration.sauce_opts.record_video.should be_true
52
+ @configuration.sauce_opts.capture_html.should be_true
53
+ end
54
+
55
+ it 'should use selenium version 2.33.0 version by default for sauce' do
56
+ @configuration.sauce_opts.selenium_version.should eq '2.33.0'
57
+ end
58
+
59
+ # the goal here is to allow internal refactoring to use the new configuration pattern
60
+ # to support deprecating the top level configs later
61
+ it 'should merge the explicitly configured sauce options into the strut' do
62
+ os = 'Linux'
63
+ browser_version = '10'
64
+ browser = 'chrome'
65
+ description = 'test'
66
+ @configuration.populate_with_hash os: os, browser_version: browser_version, browser: browser, description: description
67
+ @configuration.sauce_opts.os.should eq os
68
+ @configuration.sauce_opts.browser.should eq browser
69
+ @configuration.sauce_opts.browser_version.should eq browser_version
70
+ @configuration.sauce_opts.job_name.should eq description
71
+ end
72
+
73
+ it 'should take the sauce_opts as priority' do
74
+ @configuration.populate_with_hash sauce_opts: { browser: 'ie', job_name: 'cool' }, browser: 'chrome', description: 'other'
75
+ @configuration.sauce_opts.browser.should eq 'ie'
76
+ @configuration.description.should eq 'other'
77
+ @configuration.sauce_opts.job_name.should eq 'cool'
78
+ end
79
+
80
+ it 'should use the description as the job name if no job name is specified' do
81
+ @configuration.populate_with_hash description: 'other'
82
+ @configuration.description.should eq 'other'
83
+ @configuration.sauce_opts.job_name.should eq 'other'
84
+ end
48
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-15 00:00:00.000000000 Z
13
+ date: 2013-07-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: selenium-webdriver
@@ -140,8 +140,8 @@ dependencies:
140
140
  - - ~>
141
141
  - !ruby/object:Gem::Version
142
142
  version: 0.6.7
143
- description: added better error handling to the sauce api calls and improved naming
144
- convention for job assets
143
+ description: updated configuration to support any sauce config and set default sauce
144
+ selenium version
145
145
  email:
146
146
  - dave@arrgyle.com
147
147
  - jason@arrgyle.com
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  version: '0'
223
223
  segments:
224
224
  - 0
225
- hash: -3833046545710782296
225
+ hash: -3401162280561917445
226
226
  requirements: []
227
227
  rubyforge_project:
228
228
  rubygems_version: 1.8.25