selenium-connect 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,3 +3,9 @@ LineLength:
3
3
 
4
4
  MethodLength:
5
5
  Max: 30
6
+
7
+ SymbolName:
8
+ AllowCamelCase: false
9
+
10
+ Documentation:
11
+ Enabled: false
@@ -1,3 +1,17 @@
1
+ #3.4.0 (2013-08-03)
2
+ Added more code quality tools and capture enhanced chrome logs
3
+
4
+ - Bumped version to 3.4.0 to prepare for release.
5
+ - fixed error with chrome processor
6
+ - added reek and a rake task and fixed on of the smell issues, leaving it only as warnings for now but we should fix the smells at some point
7
+ - added flog and updated rubocop version, fixed all quality issues, updated rake tasks for flog and rubocop
8
+ - moved development dependencies to gemfile to support git based repo for latest rubocop
9
+ - added a test for the chrome log files and also updated it to pull the libpeer log
10
+ - updated readme
11
+ - added animoto to the readme
12
+ - updated job finishing to move chrome log to evidence folder
13
+ - added advanced logs to the evidence directory
14
+
1
15
  #3.3.1 (2013-07-24)
2
16
  Fixed bug with the job naming
3
17
 
data/Gemfile CHANGED
@@ -1,3 +1,13 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ # Using the master version to incorporate latest cops and bug fixes
6
+ gem 'rubocop', git: 'https://github.com/bbatsov/rubocop.git', branch: 'master'
7
+ gem 'rspec', '~> 2.14.1'
8
+ gem 'guard-rspec', '~> 3.0.2'
9
+ gem 'coveralls', '~> 0.6.7'
10
+ gem 'flog'
11
+ gem 'flay'
12
+ gem 'ruby2ruby'
13
+ gem 'reek', '1.3.1'
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- #selenium-connect 3.3.1 (2013-07-24)
1
+ #selenium-connect 3.4.0 (2013-08-03)
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
 
5
- A stupid simple way to run your Selenium tests on your computer, against a Selenium Grid, or in the cloud (e.g. SauceLabs). For a rocking implementation of this library, checkout [ChemistryKit](https://github.com/arrgyle/chemistrykit)!
5
+ A stupid simple way to run your Selenium tests on your computer, against a Selenium Grid, or in the cloud (e.g. SauceLabs). For a rocking implementation of this library, checkout [ChemistryKit](https://github.com/arrgyle/chemistrykit)! For more usage examples check out our [Friends](#friends) section!
6
6
 
7
7
  All the documentation for Selenium Connect can be found in this README, organized as follows:
8
8
 
@@ -11,6 +11,7 @@ All the documentation for Selenium Connect can be found in this README, organize
11
11
  - [Configuration](#configuration)
12
12
  - [Contribution Guidelines](#contribution-guidelines)
13
13
  - [Deployment](#deployment)
14
+ - [Friends](#friends)
14
15
 
15
16
  ## Getting Started
16
17
  ```ruby
@@ -170,3 +171,11 @@ And another to finish the release:
170
171
  rake release_finish['A helpful tag message that will be included in the gemspec.']
171
172
 
172
173
  This handles updating the change log, committing, and tagging the release.
174
+
175
+ ## Friends
176
+
177
+ Below you can find some honorable mentions of those friends that are using Selenium Connect:
178
+
179
+ ![image](http://d14f1fnryngsxt.cloudfront.net/images/logo/animotologotext_f78c60cbbd36837c7aad596e3b3bb019.svg)
180
+
181
+ We are proud that [Animoto](http://animoto.com/) uses Selenium Connect to help them test their awesome web app.
data/Rakefile CHANGED
@@ -1,13 +1,20 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  require 'rspec/core/rake_task'
4
+ require 'rubocop/rake_task'
5
+ require 'flog_task'
6
+ require 'flay_task'
7
+ require 'reek/rake/task'
4
8
 
5
9
  task default: :build
6
10
 
7
- task build: [:clean, :prepare, :rubocop, :unit, :integration]
11
+ task build: [:clean, :prepare, :quality, :unit, :integration]
8
12
 
9
13
  desc 'Runs standard build activities.'
10
- task build_full: [:clean, :prepare, :rubocop, :unit, :integration, :system]
14
+ task build_full: [:clean, :prepare, :quality, :unit, :integration, :system]
15
+
16
+ desc 'Runs quality checks.'
17
+ task quality: [:rubocop, :reek, :flog_total, :flog_average, :flay]
11
18
 
12
19
  desc 'Removes the build directory.'
13
20
  task :clean do
@@ -40,12 +47,33 @@ RSpec::Core::RakeTask.new(:system) do |t|
40
47
  t.rspec_opts = get_rspec_flags('system', '--tag selenium')
41
48
  end
42
49
 
43
- desc 'Runs code quality check'
44
- task :rubocop do
45
- sh 'rubocop'
50
+ Rubocop::RakeTask.new
51
+
52
+ # TODO: lower the quality score and improve the code!
53
+ FlogTask.new :flog_total, 1250 do |t|
54
+ t.method = :total_score
55
+ t.verbose = true
56
+ end
57
+
58
+ # TODO: lower the quality score and improve the code!
59
+ FlogTask.new :flog_average, 10 do |t|
60
+ t.method = :average
61
+ t.verbose = true
62
+ end
63
+
64
+ # TODO: lower the quality score and improve the code!
65
+ FlayTask.new :flay, 200 do |t|
66
+ t.verbose = true
67
+ end
68
+
69
+ # TODO: fix all the smells and turn on failing on error
70
+ Reek::Rake::Task.new do |t|
71
+ t.fail_on_error = false
72
+ t.verbose = false
73
+ t.reek_opts = '--quiet'
46
74
  end
47
75
 
48
- # TODO This could probably be more cleanly automated
76
+ # TODO: This could probably be more cleanly automated
49
77
  desc 'Start a release (Requires Git Flow)'
50
78
  task :release_start, :version do |t, args|
51
79
  version = args['version']
@@ -41,13 +41,13 @@ module Sauce
41
41
 
42
42
  def fetch_job_data
43
43
  requires_job_id
44
- # TODO let's switch this over to use whisk as well
44
+ # TODO: let's switch this over to use whisk as well
45
45
  # This is used because it's easy to get all the data out of the job
46
46
  begin
47
47
  job = Sauce::Job.find @job_id
48
48
  JSON.parse job.to_json
49
- rescue StandardError => e
50
- puts "An error occured while fetching the job data: #{e.message}"
49
+ rescue StandardError => exception
50
+ puts "An error occured while fetching the job data: #{exception.message}"
51
51
  end
52
52
  end
53
53
 
@@ -58,16 +58,14 @@ module Sauce
58
58
  end
59
59
 
60
60
  def polling_api_request(timeout)
61
- begin
62
- sleep 1
63
- yield
64
- rescue RestClient::Exception => e
61
+ sleep 1
62
+ yield
63
+ rescue RestClient::Exception => exception
65
64
  if timeout > 0
66
65
  polling_api_request(timeout - 1) { yield }
67
66
  else
68
- puts "Request timed out after #{timeout} with: #{e.message}"
67
+ puts "Request timed out after #{timeout} with: #{exception.message}"
69
68
  end
70
- end
71
69
  end
72
70
  end
73
71
  end
@@ -39,7 +39,7 @@ class SeleniumConnect
39
39
 
40
40
  def server_start
41
41
  if @config.host == 'localhost'
42
- # TODO this is just temp,
42
+ # TODO: this is just temp,
43
43
  # in the next iteration we will inject this in by default in start
44
44
  # to a required argument in initialize
45
45
  @server = Server.new(config)
@@ -29,7 +29,7 @@ class SeleniumConnect
29
29
  populate_with_hash opts unless opts.empty?
30
30
  end
31
31
 
32
- # TODO eventually roll all sauce options under this node
32
+ # TODO: eventually roll all sauce options under this node
33
33
  # and deprecate setting them at the top level
34
34
  def sauce_opts=(opts = {})
35
35
  opts.each do |key, value|
@@ -40,7 +40,7 @@ class SeleniumConnect
40
40
  def populate_with_hash(hash)
41
41
  hash.each do |key, value|
42
42
  begin
43
- self.send "#{key}=", value unless value.nil?
43
+ send "#{key}=", value unless value.nil?
44
44
  rescue NoMethodError
45
45
  raise ArgumentError.new "The config key: \"#{key}\" is unknown!"
46
46
  end
@@ -20,7 +20,7 @@ class SeleniumConnect
20
20
  # Creates and returns the driver, using options passed in
21
21
  def start(opts = {})
22
22
  @job_name = slugify_name opts[:name] if opts.has_key? :name
23
- # TODO this could be refactored out into an options parser of sorts
23
+ # TODO: this could be refactored out into an options parser of sorts
24
24
  @config.sauce_opts.job_name = @job_name ||= 'unnamed_job'
25
25
  @driver = Runner.new(@config).driver
26
26
  end
@@ -33,6 +33,7 @@ class SeleniumConnect
33
33
  @driver.quit
34
34
  @data = { assets: {} }
35
35
  process_sauce_logs(opts) if @config.host == 'saucelabs'
36
+ process_chrome_logs(opts) if @config.browser == 'chrome'
36
37
  # rubocop:disable HandleExceptions
37
38
  rescue Selenium::WebDriver::Error::WebDriverError
38
39
  # rubocop:enable HandleExceptions
@@ -42,6 +43,19 @@ class SeleniumConnect
42
43
 
43
44
  private
44
45
 
46
+ # if a log path is configured move the logs, otherwise delete them
47
+ def process_chrome_logs(opts = {})
48
+ ['chromedriver.log', 'libpeerconnection.log'].each do |log_file|
49
+ path = File.join(Dir.getwd, log_file)
50
+
51
+ if @config.log
52
+ FileUtils.mv(path, File.join(Dir.getwd, @config.log)) if File.exist? path
53
+ else
54
+ FileUtils.rm path if File.exist? path
55
+ end
56
+ end
57
+ end
58
+
45
59
  def process_sauce_logs(opts = {})
46
60
  job_id = @driver.session_id
47
61
  @sauce_facade.job_id = job_id
@@ -81,7 +95,7 @@ class SeleniumConnect
81
95
  name.downcase.strip.gsub(' ', '_').gsub(/[^\w-]/, '')
82
96
  end
83
97
 
84
- # TODO this should be pulled out into a generic report... or something
98
+ # TODO: this should be pulled out into a generic report... or something
85
99
  def symbolize_keys(hash)
86
100
  hash.reduce({}) do |result, (key, value)|
87
101
  new_key = key.class == String ? key.to_sym : key
@@ -22,7 +22,13 @@ class SeleniumConnect
22
22
  private
23
23
 
24
24
  def init_browser
25
- config.browser.to_sym
25
+ caps = Selenium::WebDriver::Remote::Capabilities.chrome
26
+
27
+ if config.log
28
+ log_path = File.join(Dir.getwd, config.log, 'chrome')
29
+ caps['chrome.switches'] = ["--user-data-dir=#{log_path}", '--enable-logging', '--v=1', "--log-net-log=#{log_path}/net_log.log", '--net-log-level=0']
30
+ end
31
+ caps
26
32
  end
27
33
 
28
34
  end # Chrome
@@ -38,7 +38,7 @@ class SeleniumConnect
38
38
  browser = Selenium::WebDriver::Remote::Capabilities.firefox
39
39
  browser[:firefox_binary] = config.browser_path if config.browser_path
40
40
  browser[:firefox_profile] = profile
41
- return browser
41
+ browser
42
42
  end
43
43
 
44
44
  def init_browser
@@ -30,7 +30,7 @@ class SeleniumConnect
30
30
  executable_path = get_executable_path
31
31
  browser = Selenium::WebDriver::Remote::Capabilities.phantomjs
32
32
  browser['phantomjs.binary.path'] = executable_path
33
- return browser
33
+ browser
34
34
  end
35
35
 
36
36
  def init_browser
@@ -58,7 +58,7 @@ class SeleniumConnect
58
58
  rake_file = File.open(rake_file_path, 'w')
59
59
  rake_file << generate_rake_task
60
60
  rake_file.close
61
- return rake_file_path
61
+ rake_file_path
62
62
  end
63
63
 
64
64
  def rake(task)
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'selenium-connect'
3
- s.version = '3.3.1'
3
+ s.version = '3.4.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 = 'Fixed bug with the job naming'
9
+ s.description = 'Added more code quality tools and capture enhanced chrome logs'
10
10
  s.license = 'MIT'
11
11
 
12
12
  s.files = `git ls-files`.split($/)
@@ -18,10 +18,4 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'rake'
19
19
  s.add_dependency 'sauce', '~> 2.4.4'
20
20
  s.add_dependency 'sauce_whisk', '~> 0.0.8'
21
-
22
- s.add_development_dependency 'rspec', '~> 2.14.1'
23
- s.add_development_dependency 'rubocop', '~> 0.9.0'
24
- s.add_development_dependency 'guard-rspec', '~> 3.0.2'
25
- s.add_development_dependency 'coveralls', '~> 0.6.7'
26
-
27
21
  end
@@ -16,4 +16,20 @@ describe 'Chrome', selenium: true do
16
16
  job.finish
17
17
  sc.finish
18
18
  end
19
+
20
+ it 'should work correctly with a configuration file' do
21
+ config = SeleniumConnect::Configuration.new
22
+ config.populate_with_yaml "#{ENV['SUPPORT_PATH']}/chrome.yaml"
23
+ sc = SeleniumConnect.start config
24
+ job = sc.create_job
25
+ driver = job.start
26
+
27
+ execute_simple_test driver
28
+
29
+ job.finish
30
+ sc.finish
31
+
32
+ File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'chromedriver.log')).should be_true
33
+ File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'libpeerconnection.log')).should be_true
34
+ end
19
35
  end
@@ -0,0 +1,26 @@
1
+ # Setup & Debugging
2
+ jar:
3
+ log: /build/tmp
4
+
5
+
6
+ # Where to run your tests
7
+ host: 'localhost'
8
+ port:
9
+
10
+
11
+ # Browser
12
+ browser: 'chrome'
13
+ browser_path:
14
+ profile_path:
15
+ profile_name:
16
+
17
+
18
+ # Saucelabs
19
+ sauce_username: 'test_user_name'
20
+ sauce_api_key:
21
+ api_timeout: 10
22
+
23
+ os:
24
+ browser_version:
25
+ description:
26
+
@@ -30,7 +30,7 @@ describe SeleniumConnect::Configuration do
30
30
  end
31
31
 
32
32
  it 'supports the config_file= method' do
33
- @configuration.config_file= "#{ENV['SUPPORT_PATH']}/example.yaml"
33
+ @configuration.config_file = "#{ENV['SUPPORT_PATH']}/example.yaml"
34
34
  @configuration.sauce_username.should eq VALID_SAUCE_USERNAME
35
35
  end
36
36
 
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.3.1
4
+ version: 3.4.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-24 00:00:00.000000000 Z
13
+ date: 2013-08-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: selenium-webdriver
@@ -76,71 +76,7 @@ dependencies:
76
76
  - - ~>
77
77
  - !ruby/object:Gem::Version
78
78
  version: 0.0.8
79
- - !ruby/object:Gem::Dependency
80
- name: rspec
81
- requirement: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ~>
85
- - !ruby/object:Gem::Version
86
- version: 2.14.1
87
- type: :development
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ~>
93
- - !ruby/object:Gem::Version
94
- version: 2.14.1
95
- - !ruby/object:Gem::Dependency
96
- name: rubocop
97
- requirement: !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ~>
101
- - !ruby/object:Gem::Version
102
- version: 0.9.0
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ~>
109
- - !ruby/object:Gem::Version
110
- version: 0.9.0
111
- - !ruby/object:Gem::Dependency
112
- name: guard-rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
118
- version: 3.0.2
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ~>
125
- - !ruby/object:Gem::Version
126
- version: 3.0.2
127
- - !ruby/object:Gem::Dependency
128
- name: coveralls
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - ~>
133
- - !ruby/object:Gem::Version
134
- version: 0.6.7
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ~>
141
- - !ruby/object:Gem::Version
142
- version: 0.6.7
143
- description: Fixed bug with the job naming
79
+ description: Added more code quality tools and capture enhanced chrome logs
144
80
  email:
145
81
  - dave@arrgyle.com
146
82
  - jason@arrgyle.com
@@ -188,6 +124,7 @@ files:
188
124
  - spec/integration/lib/selenium_connect/runners/sauce_spec.rb
189
125
  - spec/integration/lib/selenium_connect_spec.rb
190
126
  - spec/spec_helper.rb
127
+ - spec/support/chrome.yaml
191
128
  - spec/support/example.yaml
192
129
  - spec/support/example_page_object.rb
193
130
  - spec/support/integration_helper.rb
@@ -221,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
158
  version: '0'
222
159
  segments:
223
160
  - 0
224
- hash: -2232335152555328092
161
+ hash: 2633789005975885710
225
162
  requirements: []
226
163
  rubyforge_project:
227
164
  rubygems_version: 1.8.25