selenium-connect 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rubocop.yml CHANGED
@@ -3,6 +3,3 @@ LineLength:
3
3
 
4
4
  MethodLength:
5
5
  Max: 30
6
-
7
- EndAlignment:
8
- Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ #2.2.0 (2013-07-08)
2
+ - Bumped version to 2.2.0 to prepare for release.
3
+ - updated tests and log namming to account for possible parallel usage
4
+ - added test and fixed the log path
5
+ - first cut of grabbing the server log from sauce labs after a job
6
+
1
7
  #2.1.1 (2013-07-04)
2
8
  - Updated rakefile to propperly fetch the previous version for changelog purposes
3
9
  - Bumped version to 2.1.1 to prepare for release.
@@ -4,6 +4,8 @@ require 'selenium-webdriver'
4
4
  require 'selenium-connect/configuration'
5
5
  require 'selenium-connect/runner'
6
6
  require 'selenium-connect/server'
7
+ require 'sauce/client'
8
+ require 'rest_client'
7
9
 
8
10
  # Selenium Connect main module
9
11
  module SeleniumConnect
@@ -38,6 +40,7 @@ module SeleniumConnect
38
40
  def finish
39
41
  begin
40
42
  driver.quit
43
+ fetch_logs if config.host == 'saucelabs'
41
44
  # rubocop:disable HandleExceptions
42
45
  rescue Selenium::WebDriver::Error::WebDriverError
43
46
  # rubocop:enable HandleExceptions
@@ -46,6 +49,31 @@ module SeleniumConnect
46
49
  server.stop if localhost?
47
50
  end
48
51
 
52
+ def fetch_logs
53
+ # this could be pulled out into the specific sauce runner
54
+ job_id = driver.session_id
55
+ sauce_client = Sauce::Client.new
56
+ sauce_job = Sauce::Job.find(job_id)
57
+ # poll while job is in progress
58
+ while sauce_job.status == 'in progress'
59
+ sleep 5
60
+ sauce_job.refresh!
61
+ end
62
+
63
+ url = "#{sauce_client.api_url}jobs/#{job_id}/assets/selenium-server.log"
64
+ response = RestClient::Request.new(
65
+ method: :get,
66
+ url: url
67
+ ).execute
68
+
69
+ log_file = File.join(Dir.getwd, config.log, "sauce_job_#{job_id}.log") if config.log
70
+
71
+ File.open(log_file, 'w') do |log|
72
+ log.write response
73
+ end
74
+
75
+ end
76
+
49
77
  alias_method :start, :run
50
78
  alias_method :stop, :finish
51
79
  end
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'selenium-connect'
3
- s.version = '2.1.1'
3
+ s.version = '2.2.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 localhost server quitting'
9
+ s.description = 'Now pulling in the server log from sauce labs'
10
10
  s.license = 'MIT'
11
11
 
12
12
  s.files = `git ls-files`.split($/)
@@ -6,6 +6,7 @@ describe 'Sauce Labs', selenium: true do
6
6
 
7
7
  it 'hello world' do
8
8
  SeleniumConnect.configure do |c|
9
+ c.log = File.join('build', 'tmp')
9
10
  c.host = 'saucelabs'
10
11
  c.sauce_username = 'testing_arrgyle'
11
12
  c.sauce_api_key = 'ab7a6e17-16df-42d2-9ef6-c8d2539cc38a'
@@ -17,7 +18,9 @@ describe 'Sauce Labs', selenium: true do
17
18
  driver = SeleniumConnect.start
18
19
  driver.get 'http://google.com'
19
20
  driver.title.should include('Google')
21
+ id = driver.session_id
20
22
  SeleniumConnect.finish
23
+ File.exist?(File.join(Dir.pwd, 'build', 'tmp', "sauce_job_#{id}.log")).should be_true
21
24
  end
22
25
 
23
26
  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: 2.1.1
4
+ version: 2.2.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-04 00:00:00.000000000 Z
13
+ date: 2013-07-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: selenium-webdriver
@@ -92,7 +92,7 @@ dependencies:
92
92
  - - ~>
93
93
  - !ruby/object:Gem::Version
94
94
  version: 0.9.0
95
- description: Fixed bug with localhost server quitting
95
+ description: Now pulling in the server log from sauce labs
96
96
  email:
97
97
  - dave@arrgyle.com
98
98
  - jason@arrgyle.com
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  segments:
158
158
  - 0
159
- hash: 2657149500405024858
159
+ hash: 2088832621683806109
160
160
  requirements: []
161
161
  rubyforge_project:
162
162
  rubygems_version: 1.8.25