selenium-connect 3.0.0 → 3.1.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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ #3.1.0 (2013-07-14)
2
+ return the log file names in the report object
3
+
4
+ - Bumped version to 3.1.0 to prepare for release.
5
+ - now passing back the sauce job and log file name in the report data
6
+ - removed mocha from gemspec as it was not being used
7
+ - updated rakefile to include release message at the top of the changelog stuff
8
+
1
9
  #3.0.0 (2013-07-14)
2
10
  - updated rake file to run all the tests on a release start
3
11
  - Bumped version to 3.0.0 to prepare for release.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #selenium-connect 3.0.0 (2013-07-14)
1
+ #selenium-connect 3.1.0 (2013-07-14)
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
 
@@ -89,7 +89,6 @@ sauce_username: 'test_user_name'
89
89
  sauce_api_key:
90
90
  browser_version:
91
91
  description: #sauce job/test description
92
-
93
92
  ```
94
93
 
95
94
  You can pass parameters into the new config object like:
@@ -121,7 +120,11 @@ report = job.finish passed: true
121
120
  report = job.finish failed: true, failshot: true
122
121
  ```
123
122
 
124
- The `report` is simply a container for arbitrary data. Right now we are passing back the sauce details.
123
+ The `report` is simply a container for arbitrary data. Right now we are passing back the sauce details. Here is an example of `report.data` for a failed job:
124
+
125
+ ```
126
+ {:failshot=>"failed_e8ebfe9fc5004df7865b6a6f9f1f5491.png", :server_log=>"sauce_job_e8ebfe9fc5004df7865b6a6f9f1f5491.log", :sauce_data=>{:id=>"e8ebfe9fc5004df7865b6a6f9f1f5491", :"custom-data"=>nil, :owner=>"testing_arrgyle", :status=>"complete", :error=>nil, :name=>"failshot", :browser=>"iexplore", :browser_version=>"7.0.5730.13", :os=>"Windows 2003", :creation_time=>1373831090, :start_time=>1373831090, :end_time=>1373831105, :video_url=>"http://saucelabs.com/jobs/e8ebfe9fc5004df7865b6a6f9f1f5491/video.flv", :log_url=>"http://saucelabs.com/jobs/e8ebfe9fc5004df7865b6a6f9f1f5491/selenium-server.log", :public=>nil, :tags=>[], :passed=>false}}
127
+ ```
125
128
 
126
129
  ## Contribution Guidelines
127
130
 
data/Rakefile CHANGED
@@ -104,7 +104,7 @@ task :release_finish, :update_message do |t, args|
104
104
 
105
105
  changelog_contents = File.read(changelog)
106
106
  # create the new heading
107
- updated_changelog = "##{version} (#{date})\n" + log + "\n" + changelog_contents
107
+ updated_changelog = "##{version} (#{date})\n" + message + "\n\n" + log + "\n" + changelog_contents
108
108
  # update the contents
109
109
  File.open(changelog, 'w') { |f| f.write(updated_changelog) }
110
110
  puts "Updated change log for version #{version}\n"
@@ -32,25 +32,25 @@ class SeleniumConnect
32
32
  # extracted from the earlier main finish
33
33
  begin
34
34
  @driver.quit
35
+ data = {}
35
36
  job_id = @driver.session_id
36
37
  if @config.host == 'saucelabs'
37
38
  if opts.has_key?(:failed) && opts[:failed]
38
39
  fail_job job_id
39
40
  if opts.has_key?(:failshot) && opts[:failshot]
40
- save_last_screenshot job_id
41
+ data[:failshot] = save_last_screenshot job_id
41
42
  end
42
43
  end
43
44
  if opts.has_key?(:passed) && opts[:passed]
44
45
  pass_job job_id
45
46
  end
46
- data = fetch_logs(job_id)
47
- report_data = symbolize_keys sauce_data: data
47
+ data.merge! fetch_logs(job_id)
48
48
  end
49
49
  # rubocop:disable HandleExceptions
50
50
  rescue Selenium::WebDriver::Error::WebDriverError
51
51
  # rubocop:enable HandleExceptions
52
52
  end
53
-
53
+ report_data = symbolize_keys data
54
54
  @report_factory.build :job, report_data
55
55
  end
56
56
 
@@ -62,9 +62,11 @@ class SeleniumConnect
62
62
  begin
63
63
  # Seemingly need to wait slightly for the images to be processed
64
64
  sleep(2)
65
+ filename = "failed_#{job_id}.png"
65
66
  image = SauceWhisk::Jobs.fetch_asset job_id, 'final_screenshot.png'
66
- image_file = File.join(Dir.getwd, @config.log, "failed_#{job_id}.png") if @config.log
67
+ image_file = File.join(Dir.getwd, @config.log, filename) if @config.log
67
68
  File.open(image_file, 'w') { |f| f.write image }
69
+ filename
68
70
  rescue RestClient::ResourceNotFound
69
71
  puts 'Unable to download image!'
70
72
  end
@@ -82,10 +84,11 @@ class SeleniumConnect
82
84
  sauce_job = Sauce::Job.find(job_id)
83
85
  # Seemingly need to wait slightly for the images to be processed
84
86
  sleep(2)
87
+ filename = "sauce_job_#{job_id}.log"
85
88
  server_log = SauceWhisk::Jobs.fetch_asset job_id, 'selenium-server.log'
86
- log_file = File.join(Dir.getwd, @config.log, "sauce_job_#{job_id}.log") if @config.log
89
+ log_file = File.join(Dir.getwd, @config.log, filename) if @config.log
87
90
  File.open(log_file, 'w') { |f| f.write server_log }
88
- JSON.parse(sauce_job.to_json)
91
+ { server_log: filename, sauce_data: JSON.parse(sauce_job.to_json) }
89
92
  end
90
93
 
91
94
  # TODO this should be pulled out into a generic report... or something
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'selenium-connect'
3
- s.version = '3.0.0'
3
+ s.version = '3.1.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 = 'Major refactoring of the public api which now includes correct updating of sauce lab job status and fetching screenshots on failure'
9
+ s.description = 'return the log file names in the report object'
10
10
  s.license = 'MIT'
11
11
 
12
12
  s.files = `git ls-files`.split($/)
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'curb', '~> 0.8.4'
22
22
 
23
23
  s.add_development_dependency 'rspec', '~> 2.14.1'
24
- s.add_development_dependency 'mocha', '~> 0.14.0'
25
24
  s.add_development_dependency 'rubocop', '~> 0.9.0'
26
25
  s.add_development_dependency 'guard-rspec', '~> 3.0.2'
27
26
  s.add_development_dependency 'coveralls', '~> 0.6.7'
@@ -28,6 +28,7 @@ describe 'Sauce Labs', selenium: true do
28
28
  sauce_id = report.data[:sauce_data][:id]
29
29
  report.data[:sauce_data][:name].should be == name
30
30
  report.data[:sauce_data][:passed].should be_true
31
+ report.data[:server_log].should be == "sauce_job_#{sauce_id}.log"
31
32
  File.exist?(File.join(Dir.pwd, 'build', 'tmp', "sauce_job_#{sauce_id}.log")).should be_true
32
33
  end
33
34
 
@@ -40,7 +41,7 @@ describe 'Sauce Labs', selenium: true do
40
41
  report.data[:sauce_data][:passed].should be false
41
42
  end
42
43
 
43
- it 'should download save a screenshot on failure' do
44
+ it 'should download a screenshot on failure' do
44
45
  # pending 'need to resolve the api issues first'
45
46
  job = @sc.create_job
46
47
  name = 'failshot'
@@ -53,8 +54,10 @@ describe 'Sauce Labs', selenium: true do
53
54
  # simulate a failure situation
54
55
  report = job.finish failed: true, failshot: true
55
56
  end
56
-
57
+ sauce_id = report.data[:sauce_data][:id]
57
58
  report.data[:sauce_data][:passed].should be false
59
+ report.data[:failshot].should be == "failed_#{sauce_id}.png"
60
+ File.exist?(File.join(Dir.pwd, 'build', 'tmp', "failed_#{sauce_id}.png")).should be_true
58
61
  end
59
62
 
60
63
  after(:each) do
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.0.0
4
+ version: 3.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -108,22 +108,6 @@ dependencies:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.14.1
111
- - !ruby/object:Gem::Dependency
112
- name: mocha
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
118
- version: 0.14.0
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: 0.14.0
127
111
  - !ruby/object:Gem::Dependency
128
112
  name: rubocop
129
113
  requirement: !ruby/object:Gem::Requirement
@@ -172,8 +156,7 @@ dependencies:
172
156
  - - ~>
173
157
  - !ruby/object:Gem::Version
174
158
  version: 0.6.7
175
- description: Major refactoring of the public api which now includes correct updating
176
- of sauce lab job status and fetching screenshots on failure
159
+ description: return the log file names in the report object
177
160
  email:
178
161
  - dave@arrgyle.com
179
162
  - jason@arrgyle.com
@@ -252,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
235
  version: '0'
253
236
  segments:
254
237
  - 0
255
- hash: -448221364801641841
238
+ hash: 3213783370642047366
256
239
  requirements: []
257
240
  rubyforge_project:
258
241
  rubygems_version: 1.8.25