selenium-connect 3.6.0 → 3.7.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,12 @@
1
+ #3.7.0 (2013-08-26)
2
+ Can now pass run time sauce options to a job and will capture all open window doms
3
+
4
+ - Bumped version to 3.7.0 to prepare for release.
5
+ - upgraded chromedriver and moved the tests to the right place
6
+ - updated tests and doc for additional configurations
7
+ - added the ability to pass in a hash of sauce opts to the job start array in order to set team permissions and what have
8
+ - first crack at multi window assets
9
+
1
10
  #3.6.0 (2013-08-18)
2
11
  upgraded selenium version and improved chrome log storage
3
12
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #selenium-connect 3.6.0 (2013-08-18)
1
+ #selenium-connect 3.7.0 (2013-08-26)
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
 
@@ -45,9 +45,13 @@ sc.finish
45
45
  ### Start
46
46
  If host is set to "localhost" and no jar file is specified, it will run the version of [selenium-standalone-server.jar](https://code.google.com/p/selenium/downloads/list) that is bundled with the library (currently 2.33.0). Or, you can specify your own jar if you have one you prefer to use. This is done with c.jar = 'path-to-jar-file'.
47
47
 
48
- If no additional parameters are set, the Selenium Server will be run in the background with logging disabled. If a logging directory is provided (with c.log = 'path-to-log-dir') then 2 output files will be generated:
49
- + Selenium Server JSON Wire Protocol output (server.log)
50
- + Browser output (browser.log) -- currently only available for Firefox
48
+ If no additional parameters are set, the Selenium Server will be run in the background with logging disabled. If a logging directory is provided (with c.log = 'path-to-log-dir') then the following output files will be generated:
49
+
50
+ - Selenium Server JSON Wire Protocol output (server.log)
51
+ - firefox.log (If using Firefox as the browser)
52
+ - chrome.log (If using Chrome as the browser)
53
+ - dom_0.html (Or dom_1.html etc for each open window at the time the job is finished, a dump of the html)
54
+ - failshot.png (If failshot is marked as true, a screenshot of the end state)
51
55
 
52
56
  This localhost functionality is driven using the [Selenium Rake Server Task](http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/Rake/ServerTask.html).
53
57
 
@@ -116,10 +120,13 @@ When you create your job you can pass in parameters, right now just `:name` that
116
120
 
117
121
  ```Ruby
118
122
  #…
119
- job.start name: 'website should load'
123
+ job.start name: 'website should load', sauce_opts: { public: 'team' }
120
124
  #…
121
125
  ```
122
126
 
127
+ Note you can also pass a hash of `sauce_opts` to the job start function that will let you do additional run time configuration with options as detailed here: [https://saucelabs.com/docs/additional-config](https://saucelabs.com/docs/additional-config)
128
+
129
+
123
130
  Similarly, when you finish your job you can pass in parameters. You can use the `failshot` parameter to turn on the saving of the last screenshot. For SauceLabs you can mark the tests as passed or failed:
124
131
 
125
132
  ```Ruby
data/bin/chromedriver CHANGED
Binary file
@@ -19,9 +19,12 @@ class SeleniumConnect
19
19
 
20
20
  # Creates and returns the driver, using options passed in
21
21
  def start(opts = {})
22
- @job_name = slugify_name opts[:name] if opts.has_key? :name
23
22
  # TODO: this could be refactored out into an options parser of sorts
24
- @config.sauce_opts.job_name = @job_name ||= 'unnamed_job'
23
+ @job_name = opts.key?(:name) ? slugify_name(opts[:name]) : 'unnamed_job'
24
+ sauce_config = {}
25
+ sauce_config.merge!(opts[:sauce_opts]) if opts.key? :sauce_opts
26
+ sauce_config.merge!(job_name: @job_name)
27
+ @config.sauce_opts = sauce_config
25
28
  @driver = Runner.new(@config).driver
26
29
  end
27
30
 
@@ -31,7 +34,7 @@ class SeleniumConnect
31
34
  # extracted from the earlier main finish
32
35
  begin
33
36
  save_html
34
- if opts.has_key?(:failshot) && opts[:failshot] && @config.host != 'saucelabs'
37
+ if opts.key?(:failshot) && opts[:failshot] && @config.host != 'saucelabs'
35
38
  save_screenshot
36
39
  end
37
40
  @driver.quit
@@ -52,21 +55,26 @@ class SeleniumConnect
52
55
  end
53
56
 
54
57
  def save_html
55
- save_asset('dom.html', @driver.page_source)
58
+ dom_number = 0
59
+ @driver.window_handles.each do |handle|
60
+ @driver.switch_to.window(handle)
61
+ save_asset("dom_#{dom_number}.html", @driver.page_source)
62
+ dom_number += 1
63
+ end
56
64
  end
57
65
 
58
66
  def process_sauce_logs(opts = {})
59
67
  job_id = @driver.session_id
60
68
  @sauce_facade.job_id = job_id
61
- if opts.has_key?(:failed) && opts[:failed]
69
+ if opts.key?(:failed) && opts[:failed]
62
70
  status = 'failed'
63
71
  @sauce_facade.fail_job
64
- if opts.has_key?(:failshot) && opts[:failshot]
72
+ if opts.key?(:failshot) && opts[:failshot]
65
73
  screenshot = @sauce_facade.fetch_last_screenshot
66
74
  @data[:assets][:failshot] = save_asset('failshot.png', screenshot) if screenshot
67
75
  end
68
76
  end
69
- if opts.has_key?(:passed) && opts[:passed]
77
+ if opts.key?(:passed) && opts[:passed]
70
78
  status = 'passed'
71
79
  @sauce_facade.pass_job
72
80
  end
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'selenium-connect'
3
- s.version = '3.6.0'
3
+ s.version = '3.7.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 = 'upgraded selenium version and improved chrome log storage'
9
+ s.description = 'Can now pass run time sauce options to a job and will capture all open window doms'
10
10
  s.license = 'MIT'
11
11
 
12
12
  s.files = `git ls-files`.split($/)
@@ -30,7 +30,7 @@ describe 'Chrome', selenium: true do
30
30
  sc.finish
31
31
 
32
32
  File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'chrome.log')).should be_true
33
- File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom.html')).should be_true
33
+ File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom_0.html')).should be_true
34
34
  File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'failshot.png')).should be_true
35
35
  end
36
36
  end
@@ -25,7 +25,7 @@ describe 'Firefox', selenium: true do
25
25
  sc.finish
26
26
 
27
27
  File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'firefox.log')).should be_true
28
- File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom.html')).should be_true
28
+ File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom_0.html')).should be_true
29
29
  File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'failshot.png')).should be_true
30
30
  File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'server.log')).should be_true
31
31
  end
@@ -68,4 +68,21 @@ describe 'Firefox', selenium: true do
68
68
  job.finish
69
69
  sc.finish
70
70
  end
71
+
72
+ it 'should download all the dom dumps if there are multiple windows open' do
73
+ config = SeleniumConnect::Configuration.new browser: 'firefox', log: '/build/tmp'
74
+ sc = SeleniumConnect.start config
75
+ job = sc.create_job
76
+ driver = job.start
77
+
78
+ driver.get 'http://the-internet.herokuapp.com/windows'
79
+ driver.find_element(css: '.example a').click
80
+ unless driver.title =~ /Poogle/
81
+ # simulate a failure situation
82
+ job.finish failed: true, failshot: true
83
+ end
84
+ File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom_0.html')).should be_true
85
+ File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom_1.html')).should be_true
86
+ sc.finish
87
+ end
71
88
  end
@@ -24,14 +24,15 @@ describe 'Sauce Labs', selenium: true do
24
24
  it 'just execute a sauce job successfully' do
25
25
  job = @sc.create_job
26
26
  name = 'successful sauce job'
27
- driver = job.start name: name
27
+ driver = job.start name: name, sauce_opts: { public: 'share' }
28
28
  execute_simple_test driver
29
29
  report = job.finish passed: true
30
30
  report.data[:sauce_data][:name].should be == 'successful_sauce_job'
31
31
  report.data[:sauce_data][:passed].should be_true
32
- report.data[:assets][:server_log].should be == 'server.log'
32
+ report.data[:sauce_data][:public].should eq 'share'
33
+ report.data[:assets][:server_log].should eq 'server.log'
33
34
  File.exist?(File.join(Dir.pwd, 'build', 'tmp', 'server.log')).should be_true
34
- File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom.html')).should be_true
35
+ File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'dom_0.html')).should be_true
35
36
  end
36
37
 
37
38
  it 'should mark a sauce job as failed' 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.6.0
4
+ version: 3.7.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-08-19 00:00:00.000000000 Z
13
+ date: 2013-08-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: selenium-webdriver
@@ -76,7 +76,8 @@ dependencies:
76
76
  - - ~>
77
77
  - !ruby/object:Gem::Version
78
78
  version: 0.0.8
79
- description: upgraded selenium version and improved chrome log storage
79
+ description: Can now pass run time sauce options to a job and will capture all open
80
+ window doms
80
81
  email:
81
82
  - dave@arrgyle.com
82
83
  - jason@arrgyle.com
@@ -156,9 +157,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
157
  - - ! '>='
157
158
  - !ruby/object:Gem::Version
158
159
  version: '0'
159
- segments:
160
- - 0
161
- hash: -2907860851704269908
162
160
  requirements: []
163
161
  rubyforge_project:
164
162
  rubygems_version: 1.8.25