selenium-connect 3.4.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/Rakefile +3 -3
- data/bin/{selenium-server-standalone-2.33.0.jar → selenium-server-standalone-2.34.0.jar} +0 -0
- data/lib/selenium_connect/configuration.rb +1 -1
- data/lib/selenium_connect/job.rb +16 -3
- data/lib/selenium_connect/runners/saucelabs.rb +5 -1
- data/lib/selenium_connect/server.rb +1 -1
- data/selenium-connect.gemspec +2 -2
- data/spec/integration/lib/selenium_connect/runners/chrome_spec.rb +3 -1
- data/spec/integration/lib/selenium_connect/runners/firefox_spec.rb +31 -15
- data/spec/integration/lib/selenium_connect/runners/sauce_spec.rb +7 -7
- data/spec/spec_helper.rb +5 -0
- data/spec/unit/lib/selenium_connect/configuration_spec.rb +2 -2
- metadata +6 -5
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
#3.5.0 (2013-08-12)
|
2
|
+
updated selenium server jar and sauce version default plus screenshots and dom html for everyone
|
3
|
+
|
4
|
+
- Bumped version to 3.5.0 to prepare for release.
|
5
|
+
- updated documentation
|
6
|
+
- updated the sauce version of selenium server to 2.32, upgraded the local selenium server bin to 2.34, changed logfiles to be more readable, added the ability to grab the dom html and the non sauce screenshots on failure
|
7
|
+
- updated selenium server jar
|
8
|
+
|
1
9
|
#3.4.0 (2013-08-03)
|
2
10
|
Added more code quality tools and capture enhanced chrome logs
|
3
11
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#selenium-connect 3.
|
1
|
+
#selenium-connect 3.5.0 (2013-08-12)
|
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
|
|
@@ -120,7 +120,7 @@ job.start name: 'website should load'
|
|
120
120
|
#…
|
121
121
|
```
|
122
122
|
|
123
|
-
Similarly, when you finish your job you can pass in parameters.
|
123
|
+
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
124
|
|
125
125
|
```Ruby
|
126
126
|
# sweet your test passed!
|
data/Rakefile
CHANGED
@@ -50,19 +50,19 @@ end
|
|
50
50
|
Rubocop::RakeTask.new
|
51
51
|
|
52
52
|
# TODO: lower the quality score and improve the code!
|
53
|
-
FlogTask.new :flog_total,
|
53
|
+
FlogTask.new :flog_total, 10000 do |t|
|
54
54
|
t.method = :total_score
|
55
55
|
t.verbose = true
|
56
56
|
end
|
57
57
|
|
58
58
|
# TODO: lower the quality score and improve the code!
|
59
|
-
FlogTask.new :flog_average,
|
59
|
+
FlogTask.new :flog_average, 100 do |t|
|
60
60
|
t.method = :average
|
61
61
|
t.verbose = true
|
62
62
|
end
|
63
63
|
|
64
64
|
# TODO: lower the quality score and improve the code!
|
65
|
-
FlayTask.new :flay,
|
65
|
+
FlayTask.new :flay, 10000 do |t|
|
66
66
|
t.verbose = true
|
67
67
|
end
|
68
68
|
|
Binary file
|
data/lib/selenium_connect/job.rb
CHANGED
@@ -30,6 +30,10 @@ class SeleniumConnect
|
|
30
30
|
|
31
31
|
# extracted from the earlier main finish
|
32
32
|
begin
|
33
|
+
save_html
|
34
|
+
if opts.has_key?(:failshot) && opts[:failshot] && @config.host != 'saucelabs'
|
35
|
+
save_screenshot
|
36
|
+
end
|
33
37
|
@driver.quit
|
34
38
|
@data = { assets: {} }
|
35
39
|
process_sauce_logs(opts) if @config.host == 'saucelabs'
|
@@ -43,6 +47,15 @@ class SeleniumConnect
|
|
43
47
|
|
44
48
|
private
|
45
49
|
|
50
|
+
def save_screenshot
|
51
|
+
path = File.join(Dir.getwd, @config.log, 'failshot.png')
|
52
|
+
@driver.save_screenshot path
|
53
|
+
end
|
54
|
+
|
55
|
+
def save_html
|
56
|
+
save_asset('dom.html', @driver.page_source)
|
57
|
+
end
|
58
|
+
|
46
59
|
# if a log path is configured move the logs, otherwise delete them
|
47
60
|
def process_chrome_logs(opts = {})
|
48
61
|
['chromedriver.log', 'libpeerconnection.log'].each do |log_file|
|
@@ -64,7 +77,7 @@ class SeleniumConnect
|
|
64
77
|
@sauce_facade.fail_job
|
65
78
|
if opts.has_key?(:failshot) && opts[:failshot]
|
66
79
|
screenshot = @sauce_facade.fetch_last_screenshot
|
67
|
-
@data[:assets][:failshot] = save_asset(
|
80
|
+
@data[:assets][:failshot] = save_asset('failshot.png', screenshot) if screenshot
|
68
81
|
end
|
69
82
|
end
|
70
83
|
if opts.has_key?(:passed) && opts[:passed]
|
@@ -72,12 +85,12 @@ class SeleniumConnect
|
|
72
85
|
@sauce_facade.pass_job
|
73
86
|
end
|
74
87
|
server_log = @sauce_facade.fetch_server_log
|
75
|
-
@data[:assets][:server_log] = save_asset(
|
88
|
+
@data[:assets][:server_log] = save_asset('server.log', server_log) if server_log
|
76
89
|
|
77
90
|
job_data = @sauce_facade.fetch_job_data
|
78
91
|
@data[:sauce_data] = job_data if job_data
|
79
92
|
|
80
|
-
job_data_log_file =
|
93
|
+
job_data_log_file = 'sauce_job.log'
|
81
94
|
@data[:assets][:job_data_log] = job_data_log_file
|
82
95
|
@data = symbolize_keys @data
|
83
96
|
save_asset(job_data_log_file, @data)
|
@@ -27,7 +27,11 @@ class SeleniumConnect
|
|
27
27
|
|
28
28
|
def init_browser
|
29
29
|
get_credentials
|
30
|
-
|
30
|
+
# TODO: clean this up and pull it to the config... and clean up that config
|
31
|
+
config_hash = config.sauce_opts.marshal_dump
|
32
|
+
config_hash['selenium-version'] = config_hash[:selenium_version]
|
33
|
+
config_hash.delete :selenium_version
|
34
|
+
Sauce::Selenium2.new(config_hash)
|
31
35
|
end
|
32
36
|
|
33
37
|
end # Saucelabs
|
@@ -33,7 +33,7 @@ class SeleniumConnect
|
|
33
33
|
if configuration.jar
|
34
34
|
"t.jar = '#{configuration.jar}'"
|
35
35
|
else
|
36
|
-
"t.jar = '#{current_dir_path + '/../../bin/selenium-server-standalone-2.
|
36
|
+
"t.jar = '#{current_dir_path + '/../../bin/selenium-server-standalone-2.34.0.jar'}'"
|
37
37
|
end
|
38
38
|
}
|
39
39
|
t.background
|
data/selenium-connect.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'selenium-connect'
|
3
|
-
s.version = '3.
|
3
|
+
s.version = '3.5.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 = '
|
9
|
+
s.description = 'updated selenium server jar and sauce version default plus screenshots and dom html for everyone'
|
10
10
|
s.license = 'MIT'
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split($/)
|
@@ -26,10 +26,12 @@ describe 'Chrome', selenium: true do
|
|
26
26
|
|
27
27
|
execute_simple_test driver
|
28
28
|
|
29
|
-
job.finish
|
29
|
+
job.finish failshot: true
|
30
30
|
sc.finish
|
31
31
|
|
32
32
|
File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'chromedriver.log')).should be_true
|
33
33
|
File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'libpeerconnection.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', 'failshot.png')).should be_true
|
34
36
|
end
|
35
37
|
end
|
@@ -7,18 +7,41 @@ describe 'Firefox', selenium: true do
|
|
7
7
|
|
8
8
|
it 'blank config' do
|
9
9
|
@config = SeleniumConnect::Configuration.new
|
10
|
+
sc = SeleniumConnect.start @config
|
11
|
+
job = sc.create_job
|
12
|
+
driver = job.start
|
13
|
+
execute_simple_test driver
|
14
|
+
job.finish
|
15
|
+
sc.finish
|
10
16
|
end
|
11
17
|
|
12
18
|
it 'localhost' do
|
13
|
-
@config = SeleniumConnect::Configuration.new host: 'localhost'
|
19
|
+
@config = SeleniumConnect::Configuration.new host: 'localhost', log: '/build/tmp'
|
20
|
+
sc = SeleniumConnect.start @config
|
21
|
+
job = sc.create_job
|
22
|
+
driver = job.start
|
23
|
+
execute_simple_test driver
|
24
|
+
job.finish failshot: true
|
25
|
+
sc.finish
|
26
|
+
|
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
|
29
|
+
File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'failshot.png')).should be_true
|
30
|
+
File.exist?(File.join(ENV['BUILD_PATH'], 'tmp', 'server.log')).should be_true
|
14
31
|
end
|
15
32
|
|
16
33
|
it 'local jar file specified' do
|
17
34
|
opts = {
|
18
35
|
host: 'localhost',
|
19
|
-
jar: "#{Dir.pwd}/bin/selenium-server-standalone-2.
|
36
|
+
jar: "#{Dir.pwd}/bin/selenium-server-standalone-2.34.0.jar"
|
20
37
|
}
|
21
38
|
@config = SeleniumConnect::Configuration.new opts
|
39
|
+
sc = SeleniumConnect.start @config
|
40
|
+
job = sc.create_job
|
41
|
+
driver = job.start
|
42
|
+
execute_simple_test driver
|
43
|
+
job.finish
|
44
|
+
sc.finish
|
22
45
|
end
|
23
46
|
|
24
47
|
it 'profile name' do
|
@@ -38,18 +61,11 @@ describe 'Firefox', selenium: true do
|
|
38
61
|
browser_path: '/Applications/Firefox.app/Contents/MacOS/firefox'
|
39
62
|
}
|
40
63
|
@config = SeleniumConnect::Configuration.new opts
|
64
|
+
sc = SeleniumConnect.start @config
|
65
|
+
job = sc.create_job
|
66
|
+
driver = job.start
|
67
|
+
execute_simple_test driver
|
68
|
+
job.finish
|
69
|
+
sc.finish
|
41
70
|
end
|
42
|
-
|
43
|
-
after(:each) do
|
44
|
-
# execute a simple test with the configuration
|
45
|
-
unless @config.nil?
|
46
|
-
sc = SeleniumConnect.start @config
|
47
|
-
job = sc.create_job
|
48
|
-
driver = job.start
|
49
|
-
execute_simple_test driver
|
50
|
-
job.finish
|
51
|
-
sc.finish
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
71
|
end
|
@@ -14,7 +14,8 @@ describe 'Sauce Labs', selenium: true do
|
|
14
14
|
os: 'windows',
|
15
15
|
browser: 'iexplore',
|
16
16
|
browser_version: '7',
|
17
|
-
description: 'test description'
|
17
|
+
description: 'test description',
|
18
|
+
sauce_opts: { selenium_version: '2.32.0' }
|
18
19
|
}
|
19
20
|
config = SeleniumConnect::Configuration.new opts
|
20
21
|
@sc = SeleniumConnect.start config
|
@@ -26,11 +27,11 @@ describe 'Sauce Labs', selenium: true do
|
|
26
27
|
driver = job.start name: name
|
27
28
|
execute_simple_test driver
|
28
29
|
report = job.finish passed: true
|
29
|
-
sauce_id = report.data[:sauce_data][:id]
|
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 ==
|
33
|
-
File.exist?(File.join(Dir.pwd, 'build', 'tmp',
|
32
|
+
report.data[:assets][:server_log].should be == 'server.log'
|
33
|
+
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
|
34
35
|
end
|
35
36
|
|
36
37
|
it 'should mark a sauce job as failed' do
|
@@ -55,10 +56,9 @@ describe 'Sauce Labs', selenium: true do
|
|
55
56
|
# simulate a failure situation
|
56
57
|
report = job.finish failed: true, failshot: true
|
57
58
|
end
|
58
|
-
sauce_id = report.data[:sauce_data][:id]
|
59
59
|
report.data[:sauce_data][:passed].should be false
|
60
|
-
report.data[:assets][:failshot].should be ==
|
61
|
-
File.exist?(File.join(Dir.pwd, 'build', 'tmp',
|
60
|
+
report.data[:assets][:failshot].should be == 'failshot.png'
|
61
|
+
File.exist?(File.join(Dir.pwd, 'build', 'tmp', 'failshot.png')).should be_true
|
62
62
|
end
|
63
63
|
|
64
64
|
after(:each) do
|
data/spec/spec_helper.rb
CHANGED
@@ -27,6 +27,11 @@ RSpec.configure do |config|
|
|
27
27
|
config.before(:all) do
|
28
28
|
setup_test_environment
|
29
29
|
end
|
30
|
+
|
31
|
+
config.before(:each) do
|
32
|
+
FileUtils.rm_rf(File.join(Dir.pwd, 'build', 'tmp'))
|
33
|
+
Dir.mkdir(File.join(Dir.pwd, 'build', 'tmp'))
|
34
|
+
end
|
30
35
|
config.order = 'random'
|
31
36
|
end
|
32
37
|
|
@@ -52,8 +52,8 @@ describe SeleniumConnect::Configuration do
|
|
52
52
|
@configuration.sauce_opts.capture_html.should be_true
|
53
53
|
end
|
54
54
|
|
55
|
-
it 'should use selenium version 2.
|
56
|
-
@configuration.sauce_opts.selenium_version.should eq '2.
|
55
|
+
it 'should use selenium version 2.32.0 version by default for sauce' do
|
56
|
+
@configuration.sauce_opts.selenium_version.should eq '2.32.0'
|
57
57
|
end
|
58
58
|
|
59
59
|
# the goal here is to allow internal refactoring to use the new configuration pattern
|
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.
|
4
|
+
version: 3.5.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-
|
13
|
+
date: 2013-08-12 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:
|
79
|
+
description: updated selenium server jar and sauce version default plus screenshots
|
80
|
+
and dom html for everyone
|
80
81
|
email:
|
81
82
|
- dave@arrgyle.com
|
82
83
|
- jason@arrgyle.com
|
@@ -98,7 +99,7 @@ files:
|
|
98
99
|
- Rakefile
|
99
100
|
- bin/chromedriver
|
100
101
|
- bin/phantomjs
|
101
|
-
- bin/selenium-server-standalone-2.
|
102
|
+
- bin/selenium-server-standalone-2.34.0.jar
|
102
103
|
- lib/sauce/sauce_facade.rb
|
103
104
|
- lib/selenium-connect.rb
|
104
105
|
- lib/selenium_connect.rb
|
@@ -158,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
159
|
version: '0'
|
159
160
|
segments:
|
160
161
|
- 0
|
161
|
-
hash:
|
162
|
+
hash: -540631903920495411
|
162
163
|
requirements: []
|
163
164
|
rubyforge_project:
|
164
165
|
rubygems_version: 1.8.25
|