selenium-grid 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +1 -0
- data/bin/selenium-grid +9 -2
- data/lib/java/vm.rb +13 -1
- data/lib/selenium-grid/hub.rb +4 -4
- data/lib/selenium-grid/remote.rb +1 -0
- data/lib/selenium-grid/version.rb +1 -1
- data/lib/tasks/grid.rake +18 -0
- data/lib/tasks/hub.rake +1 -1
- data/spec/selenium-grid/hub_spec.rb +3 -3
- metadata +2 -1
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/bin/selenium-grid
CHANGED
@@ -107,6 +107,13 @@ class RcRunningOptions < SeleniumGridOptions
|
|
107
107
|
end
|
108
108
|
|
109
109
|
case ARGV.first
|
110
|
+
when 'grid:list':
|
111
|
+
hub = Hub.instance.list.collect { |port, component| "#{port}\t#{component}"}
|
112
|
+
remotes = Remote.instance.list.collect { |port, browser| "#{port}\tremote\t#{browser}"}.sort
|
113
|
+
puts hub.concat(remotes).join("\n")
|
114
|
+
when 'grid:stop':
|
115
|
+
Hub.instance.stop
|
116
|
+
Remote.instance.list.keys.each { |port| Remote.instance.stop(:port => port) }
|
110
117
|
when 'hub:start':
|
111
118
|
options = HubStartOptions.new.parse(ARGV)
|
112
119
|
Hub.instance.start(options)
|
@@ -115,7 +122,7 @@ case ARGV.first
|
|
115
122
|
when 'hub:running':
|
116
123
|
puts Hub.instance.running?
|
117
124
|
when 'hub:list':
|
118
|
-
puts Hub.instance.list
|
125
|
+
puts Hub.instance.list.collect { |port, component| "#{port}\t#{component}"}
|
119
126
|
when 'rc:start':
|
120
127
|
options = RcStartOptions.new.parse(ARGV)
|
121
128
|
Remote.instance.start(options)
|
@@ -131,7 +138,7 @@ case ARGV.first
|
|
131
138
|
puts "Usage: selenium-grid <command> [options]"
|
132
139
|
puts ""
|
133
140
|
puts "commands"
|
134
|
-
puts "\t" + %w(hub:start hub:stop hub:list hub:running rc:start rc:stop rc:list rc:running).join("\n\t")
|
141
|
+
puts "\t" + %w(grid:list grid:stop hub:start hub:stop hub:list hub:running rc:start rc:stop rc:list rc:running).join("\n\t")
|
135
142
|
puts ""
|
136
143
|
|
137
144
|
HubStartOptions.new.summarize
|
data/lib/java/vm.rb
CHANGED
@@ -11,7 +11,7 @@ module Java
|
|
11
11
|
include_log(command, options)
|
12
12
|
include_background(command, options)
|
13
13
|
|
14
|
-
sh command.compact.join(' ')
|
14
|
+
hide_error_stream { sh command.compact.join(' ') }
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -56,5 +56,17 @@ module Java
|
|
56
56
|
command << options[:settings].collect { |key, value| "-D#{key}=#{value}" }.join(' ')
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
def hide_error_stream
|
61
|
+
old_stderr = $stderr
|
62
|
+
begin
|
63
|
+
$stderr = StringIO.new
|
64
|
+
yield
|
65
|
+
rescue Exception => e
|
66
|
+
$stderr = old_stderr
|
67
|
+
ensure
|
68
|
+
$stderr = old_stderr
|
69
|
+
end
|
70
|
+
end
|
59
71
|
end
|
60
72
|
end
|
data/lib/selenium-grid/hub.rb
CHANGED
@@ -3,7 +3,7 @@ require 'singleton'
|
|
3
3
|
module SeleniumGrid
|
4
4
|
class Hub
|
5
5
|
include Singleton
|
6
|
-
|
6
|
+
|
7
7
|
HUB_PORT=4444
|
8
8
|
|
9
9
|
def start(overrides = {})
|
@@ -15,7 +15,7 @@ module SeleniumGrid
|
|
15
15
|
:log => ENV['LOG'] || overrides[:log] || File.join(".", "log", "hub.log")
|
16
16
|
}
|
17
17
|
options = {
|
18
|
-
:background => ENV['BACKGROUND'] || false
|
18
|
+
:background => ENV['BACKGROUND'] || false
|
19
19
|
}.merge(overrides).merge(requirements)
|
20
20
|
|
21
21
|
Java::VM.new.run "com.thoughtworks.selenium.grid.hub.HubServer", options
|
@@ -26,9 +26,9 @@ module SeleniumGrid
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def list
|
29
|
-
|
29
|
+
running? ? { HUB_PORT.to_s => "hub" } : {}
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def running?
|
33
33
|
Lsof.running?(HUB_PORT)
|
34
34
|
end
|
data/lib/selenium-grid/remote.rb
CHANGED
data/lib/tasks/grid.rake
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
namespace :grid do
|
4
|
+
include SeleniumGrid
|
5
|
+
|
6
|
+
desc "Stop the entire Grid."
|
7
|
+
task(:stop) do
|
8
|
+
Hub.instance.stop
|
9
|
+
Remote.instance.list.keys.each { |port| Remote.instance.stop(:port => port) }
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "List details about the Grid."
|
13
|
+
task(:list) do
|
14
|
+
hub = Hub.instance.list.collect { |port, component| "#{port}\t#{component}"}
|
15
|
+
remotes = Remote.instance.list.collect { |port, browser| "#{port}\tremote\t#{browser}"}.sort
|
16
|
+
puts hub.concat(remotes).join("\n")
|
17
|
+
end
|
18
|
+
end
|
data/lib/tasks/hub.rake
CHANGED
@@ -74,8 +74,8 @@ module SeleniumGrid
|
|
74
74
|
mock(Lsof).running?(Hub::HUB_PORT) { false }
|
75
75
|
end
|
76
76
|
|
77
|
-
it "lists
|
78
|
-
hub.list.should
|
77
|
+
it "lists empty string" do
|
78
|
+
hub.list.should be_empty
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -85,7 +85,7 @@ module SeleniumGrid
|
|
85
85
|
end
|
86
86
|
|
87
87
|
it "lists details about the running Hub" do
|
88
|
-
hub.list.should ==
|
88
|
+
hub.list.should == { Hub::HUB_PORT.to_s => "hub" }
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Dy
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/selenium-grid/hub.rb
|
86
86
|
- lib/selenium-grid/remote.rb
|
87
87
|
- lib/selenium-grid/version.rb
|
88
|
+
- lib/tasks/grid.rake
|
88
89
|
- lib/tasks/hoe.rake
|
89
90
|
- lib/tasks/hub.rake
|
90
91
|
- lib/tasks/rc.rake
|