watirgrid 1.1.3 → 1.1.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -2
- data/bin/provider +1 -0
- data/examples/basic/example_safariwatir.rb +9 -18
- data/examples/basic/example_webdriver.rb +9 -25
- data/examples/cucumber/support/env.rb +3 -3
- data/examples/parallel/cucumber/support/env.rb +1 -1
- data/lib/listener.rb +4 -4
- data/lib/provider.rb +2 -1
- data/lib/watirgrid.rb +5 -3
- data/spec/grid_mixed_spec.rb +37 -0
- data/watirgrid.gemspec +7 -12
- metadata +16 -25
- data/examples/basic/example_webdriver_remote.rb +0 -34
data/Rakefile
CHANGED
@@ -9,13 +9,12 @@ begin
|
|
9
9
|
gem.email = "tim.koops@gmail.com"
|
10
10
|
gem.homepage = "http://github.com/90kts/watirgrid"
|
11
11
|
gem.authors = ["Tim Koopmans"]
|
12
|
-
gem.version = "1.1.
|
12
|
+
gem.version = "1.1.4.pre"
|
13
13
|
end
|
14
14
|
rescue LoadError
|
15
15
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
16
16
|
end
|
17
17
|
|
18
|
-
require 'spec/rake/spectask'
|
19
18
|
require 'rake/rdoctask'
|
20
19
|
Rake::RDocTask.new do |rdoc|
|
21
20
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
data/bin/provider
CHANGED
@@ -95,6 +95,7 @@ provider = Provider.new(
|
|
95
95
|
:ring_server_host => options[:ring_server_host],
|
96
96
|
:ring_server_port => options[:ring_server_port] || 12358,
|
97
97
|
:driver => options[:driver] || nil,
|
98
|
+
:browser_type => options[:browser_type] || nil,
|
98
99
|
:controller_uri => options[:controller_uri] || nil,
|
99
100
|
:acls => options[:acls] || %w{ allow all },
|
100
101
|
:loglevel => options[:loglevel])
|
@@ -8,24 +8,15 @@ controller = Controller.new
|
|
8
8
|
controller.start
|
9
9
|
|
10
10
|
# Start a Provider with SafariWatir
|
11
|
-
provider = Provider.new(:
|
11
|
+
provider = Provider.new(:driver => 'safariwatir')
|
12
12
|
provider.start
|
13
13
|
|
14
|
-
# Start a Grid
|
15
|
-
grid = Watir::Grid.new
|
16
|
-
grid.start(:take_all => true)
|
17
|
-
|
18
14
|
# Control the Providers via the Grid
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
b.button(:name, "btnI").click
|
28
|
-
b.close
|
29
|
-
end
|
30
|
-
end
|
31
|
-
threads.each {|thread| thread.join}
|
15
|
+
Watir::Grid.control do |browser, index|
|
16
|
+
p "I am browser index #{index}"
|
17
|
+
browser.goto "http://google.com"
|
18
|
+
p browser.title
|
19
|
+
browser.text_field(:name, 'q').set("watirgrid")
|
20
|
+
browser.button(:name, "btnI").click
|
21
|
+
browser.close
|
22
|
+
end
|
@@ -9,32 +9,16 @@ controller.start
|
|
9
9
|
|
10
10
|
# Start 2 Providers with WebDriver
|
11
11
|
1.upto(2) do
|
12
|
-
provider = Provider.new(:
|
12
|
+
provider = Provider.new(:driver => 'webdriver')
|
13
13
|
provider.start
|
14
14
|
end
|
15
15
|
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
b = grid.browsers[0][:object].new_browser(:firefox)
|
25
|
-
b.goto("http://google.com")
|
26
|
-
b.text_field(:name, 'q').set("watirgrid")
|
27
|
-
b.button(:name, "btnI").click
|
28
|
-
b.close
|
29
|
-
end
|
30
|
-
thread.join
|
31
|
-
|
32
|
-
# Control the second Provider via the Grid, this time using Chrome
|
33
|
-
thread = Thread.new do
|
34
|
-
b = grid.browsers[1][:object].new_browser(:chrome)
|
35
|
-
b.goto("http://google.com")
|
36
|
-
b.text_field(:name, 'q').set("watirgrid")
|
37
|
-
b.button(:name, "btnI").click
|
38
|
-
b.close
|
16
|
+
# Control the Providers via the Grid
|
17
|
+
Watir::Grid.control(:browser_type => 'firefox') do |browser, index|
|
18
|
+
p "I am browser index #{index}"
|
19
|
+
browser.goto "http://google.com"
|
20
|
+
p browser.title
|
21
|
+
browser.text_field(:name, 'q').set("watirgrid")
|
22
|
+
browser.button(:name, "btnI").click
|
23
|
+
browser.close
|
39
24
|
end
|
40
|
-
thread.join
|
@@ -10,10 +10,10 @@ controller = Controller.new(
|
|
10
10
|
:loglevel => Logger::ERROR)
|
11
11
|
controller.start
|
12
12
|
|
13
|
-
|
13
|
+
2.times do
|
14
14
|
provider = Provider.new(
|
15
15
|
:ring_server_port => 12357,
|
16
|
-
:loglevel => Logger::ERROR, :
|
16
|
+
:loglevel => Logger::ERROR, :driver => 'webdriver')
|
17
17
|
provider.start
|
18
18
|
end
|
19
19
|
|
@@ -29,7 +29,7 @@ if ENV["GRID"] then
|
|
29
29
|
# params[:controller_uri] = ENV["controller_uri"]
|
30
30
|
|
31
31
|
# Now for the other params
|
32
|
-
params[:
|
32
|
+
params[:browser_type] = 'firefox' # type of webdriver browser to spawn
|
33
33
|
params[:quantity] = 20 # max number of browsers to use
|
34
34
|
params[:rampup] = 10 # seconds
|
35
35
|
grid ||= Watir::Grid.new(params)
|
@@ -9,7 +9,7 @@ ENV["controller_uri"] = "druby://10.0.1.3:11235"
|
|
9
9
|
if ENV["GRID"] then
|
10
10
|
params = {}
|
11
11
|
params[:controller_uri] = ENV["controller_uri"]
|
12
|
-
params[:
|
12
|
+
params[:browser_type] = 'chrome' # type of webdriver browser to spawn
|
13
13
|
grid ||= Watir::Grid.new(params)
|
14
14
|
grid.start(:initiate => true, :quantity => 1, :take_all => true)
|
15
15
|
else
|
data/lib/listener.rb
CHANGED
@@ -17,11 +17,11 @@ class Listener
|
|
17
17
|
def start
|
18
18
|
DRb.start_service
|
19
19
|
ring_server = DRbObject.new(nil, @controller_uri)
|
20
|
-
service = ring_server.read([:WatirGrid, nil, nil, nil, nil, nil, nil])
|
20
|
+
service = ring_server.read([:WatirGrid, nil, nil, nil, nil, nil, nil, nil])
|
21
21
|
observers = []
|
22
|
-
observers << ring_server.notify('write',[:WatirGrid, nil, nil, nil, nil, nil, nil], nil)
|
23
|
-
observers << ring_server.notify('take', [:WatirGrid, nil, nil, nil, nil, nil, nil], nil)
|
24
|
-
observers << ring_server.notify('delete', [:WatirGrid, nil, nil, nil, nil, nil, nil], nil)
|
22
|
+
observers << ring_server.notify('write',[:WatirGrid, nil, nil, nil, nil, nil, nil, nil], nil)
|
23
|
+
observers << ring_server.notify('take', [:WatirGrid, nil, nil, nil, nil, nil, nil, nil], nil)
|
24
|
+
observers << ring_server.notify('delete', [:WatirGrid, nil, nil, nil, nil, nil, nil, nil], nil)
|
25
25
|
@log.debug("Listener started on : #{@controller_uri}")
|
26
26
|
threads = []
|
27
27
|
observers.each do |observer|
|
data/lib/provider.rb
CHANGED
data/lib/watirgrid.rb
CHANGED
@@ -55,7 +55,7 @@ module Watir
|
|
55
55
|
def setup
|
56
56
|
@browsers.each_with_index do |browser, index|
|
57
57
|
sleep 0.15
|
58
|
-
@providers[index] ||= browser[:object].new_browser @browser_type
|
58
|
+
@providers[index] ||= browser[:object].new_browser((browser[:browser_type] || @browser_type))
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -83,7 +83,7 @@ module Watir
|
|
83
83
|
sleep rampup(grid.size, params)
|
84
84
|
threads << Thread.new do
|
85
85
|
start = ::Time.now
|
86
|
-
@browser = browser[:object].new_browser
|
86
|
+
@browser = browser[:object].new_browser((params[:browser_type] || browser[:browser_type]))
|
87
87
|
yield @browser, "#{index}"
|
88
88
|
end
|
89
89
|
end
|
@@ -176,7 +176,8 @@ module Watir
|
|
176
176
|
nil, # provider description
|
177
177
|
nil, # hostname
|
178
178
|
params[:architecture],
|
179
|
-
params[:driver]
|
179
|
+
params[:driver],
|
180
|
+
params[:browser_type]
|
180
181
|
])
|
181
182
|
end
|
182
183
|
|
@@ -213,6 +214,7 @@ module Watir
|
|
213
214
|
tuple_hash[:hostname] = tuple[4]
|
214
215
|
tuple_hash[:architecture] = tuple[5]
|
215
216
|
tuple_hash[:driver] = tuple[6]
|
217
|
+
tuple_hash[:browser_type] = tuple[7]
|
216
218
|
tuple_hash
|
217
219
|
end
|
218
220
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'childprocess'
|
3
|
+
|
4
|
+
describe 'Using the Grid with different Drivers AND Browser Types' do
|
5
|
+
before(:all) do
|
6
|
+
@controller = ChildProcess.build("~/.rvm/gems/ruby-1.8.7-p334/bin/controller -h 127.0.0.1").start
|
7
|
+
sleep 1
|
8
|
+
@provider1 = ChildProcess.build("~/.rvm/gems/ruby-1.8.7-p334/bin/provider -h 127.0.0.1 -p 8001 -d safariwatir").start
|
9
|
+
sleep 1
|
10
|
+
@provider2 = ChildProcess.build("~/.rvm/gems/ruby-1.8.7-p334/bin/provider -h 127.0.0.1 -p 8002 -d webdriver -b firefox").start
|
11
|
+
sleep 2
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:all) do
|
15
|
+
@controller.stop if @controller.alive?
|
16
|
+
@provider1.stop if @provider1.alive?
|
17
|
+
@provider2.stop if @provider2.alive?
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should control a grid' do
|
21
|
+
Watir::Grid.control(:controller_uri => 'druby://127.0.0.1:11235') do |browser, index|
|
22
|
+
p "I am browser index #{index}"
|
23
|
+
browser.goto "http://google.com"
|
24
|
+
p browser.title
|
25
|
+
browser.close
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should iterate over a grid' do
|
30
|
+
grid = Watir::Grid.new(:controller_uri => 'druby://127.0.0.1:11235')
|
31
|
+
grid.start(:initiate => true)
|
32
|
+
grid.iterate do |browser|
|
33
|
+
browser.goto "http://google.com"
|
34
|
+
browser.close
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/watirgrid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{watirgrid}
|
8
|
-
s.version = "1.1.3
|
8
|
+
s.version = "1.1.3"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tim Koopmans"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-26}
|
13
13
|
s.description = %q{WatirGrid allows for distributed testing across a grid network using Watir.}
|
14
14
|
s.email = %q{tim.koops@gmail.com}
|
15
15
|
s.executables = ["listener", "controller", "provider"]
|
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
-
"EXAMPLES.rdoc",
|
23
22
|
"LICENSE",
|
24
23
|
"README.rdoc",
|
25
24
|
"Rakefile",
|
@@ -40,13 +39,11 @@ Gem::Specification.new do |s|
|
|
40
39
|
"lib/provider.rb",
|
41
40
|
"lib/watirgrid.rb",
|
42
41
|
"rdoc/logo.png",
|
43
|
-
"spec/
|
44
|
-
"spec/
|
42
|
+
"spec/grid_control_spec.rb",
|
43
|
+
"spec/grid_management_spec.rb",
|
45
44
|
"spec/memory_spec.rb",
|
46
45
|
"spec/selenium_webdriver_spec.rb",
|
47
46
|
"spec/spec_helper.rb",
|
48
|
-
"spec/utilities_spec.rb",
|
49
|
-
"spec/webdriver_remote_spec.rb",
|
50
47
|
"spec/webdriver_spec.rb",
|
51
48
|
"watirgrid.gemspec"
|
52
49
|
]
|
@@ -62,13 +59,11 @@ Gem::Specification.new do |s|
|
|
62
59
|
"examples/cucumber/support/env.rb",
|
63
60
|
"examples/parallel/cucumber/step_definitions/example_steps.rb",
|
64
61
|
"examples/parallel/cucumber/support/env.rb",
|
65
|
-
"spec/
|
66
|
-
"spec/
|
62
|
+
"spec/grid_control_spec.rb",
|
63
|
+
"spec/grid_management_spec.rb",
|
67
64
|
"spec/memory_spec.rb",
|
68
65
|
"spec/selenium_webdriver_spec.rb",
|
69
66
|
"spec/spec_helper.rb",
|
70
|
-
"spec/utilities_spec.rb",
|
71
|
-
"spec/webdriver_remote_spec.rb",
|
72
67
|
"spec/webdriver_spec.rb"
|
73
68
|
]
|
74
69
|
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watirgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 961915980
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
|
9
|
+
- 4
|
10
|
+
- pre
|
11
|
+
version: 1.1.4.pre
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Tim Koopmans
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-05
|
19
|
+
date: 2011-06-05 00:00:00 +10:00
|
19
20
|
default_executable:
|
20
21
|
dependencies: []
|
21
22
|
|
@@ -40,7 +41,6 @@ files:
|
|
40
41
|
- bin/provider
|
41
42
|
- examples/basic/example_safariwatir.rb
|
42
43
|
- examples/basic/example_webdriver.rb
|
43
|
-
- examples/basic/example_webdriver_remote.rb
|
44
44
|
- examples/cucumber/example.feature
|
45
45
|
- examples/cucumber/step_definitions/example_steps.rb
|
46
46
|
- examples/cucumber/support/env.rb
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- rdoc/logo.png
|
55
55
|
- spec/grid_control_spec.rb
|
56
56
|
- spec/grid_management_spec.rb
|
57
|
+
- spec/grid_mixed_spec.rb
|
57
58
|
- spec/memory_spec.rb
|
58
59
|
- spec/selenium_webdriver_spec.rb
|
59
60
|
- spec/spec_helper.rb
|
@@ -80,30 +81,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
82
|
none: false
|
82
83
|
requirements:
|
83
|
-
- - "
|
84
|
+
- - ">"
|
84
85
|
- !ruby/object:Gem::Version
|
85
|
-
hash:
|
86
|
+
hash: 25
|
86
87
|
segments:
|
87
|
-
-
|
88
|
-
|
88
|
+
- 1
|
89
|
+
- 3
|
90
|
+
- 1
|
91
|
+
version: 1.3.1
|
89
92
|
requirements: []
|
90
93
|
|
91
94
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.
|
95
|
+
rubygems_version: 1.6.2
|
93
96
|
signing_key:
|
94
97
|
specification_version: 3
|
95
98
|
summary: "WatirGrid: Web Application Testing in Ruby across a grid network."
|
96
|
-
test_files:
|
97
|
-
|
98
|
-
- examples/basic/example_webdriver.rb
|
99
|
-
- examples/basic/example_webdriver_remote.rb
|
100
|
-
- examples/cucumber/step_definitions/example_steps.rb
|
101
|
-
- examples/cucumber/support/env.rb
|
102
|
-
- examples/parallel/cucumber/step_definitions/example_steps.rb
|
103
|
-
- examples/parallel/cucumber/support/env.rb
|
104
|
-
- spec/grid_control_spec.rb
|
105
|
-
- spec/grid_management_spec.rb
|
106
|
-
- spec/memory_spec.rb
|
107
|
-
- spec/selenium_webdriver_spec.rb
|
108
|
-
- spec/spec_helper.rb
|
109
|
-
- spec/webdriver_spec.rb
|
99
|
+
test_files: []
|
100
|
+
|
@@ -1,34 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
2
|
-
require 'watirgrid'
|
3
|
-
require 'extensions/remote'
|
4
|
-
|
5
|
-
# Here's some basic examples in plain Ruby with Watirgrid and WebDriver Remote / HtmlUnit
|
6
|
-
|
7
|
-
# Start a Controller using defaults
|
8
|
-
controller = Controller.new
|
9
|
-
controller.start
|
10
|
-
|
11
|
-
# Start 50 Providers with WebDriver Remote
|
12
|
-
1.upto(50) do
|
13
|
-
provider = Provider.new(:browser_type => 'webdriver_remote')
|
14
|
-
provider.start
|
15
|
-
end
|
16
|
-
|
17
|
-
# Start another Grid
|
18
|
-
@grid = Watir::Grid.new
|
19
|
-
@grid.start(:take_all => true)
|
20
|
-
threads = []
|
21
|
-
@grid.browsers.each_with_index do |browser, index|
|
22
|
-
sleep 0.5 # let's sleep a little to give a more natural rampup
|
23
|
-
threads << Thread.new do
|
24
|
-
require 'selenium/server'
|
25
|
-
include Selenium
|
26
|
-
|
27
|
-
b = browser[:object].new_browser(:htmlunit)
|
28
|
-
t = Time.now
|
29
|
-
b.goto("http://90kts.local/")
|
30
|
-
puts "#{Thread.current.object_id} : #{b.title} : Elapsed #{Time.now - t}"
|
31
|
-
b.close
|
32
|
-
end
|
33
|
-
end
|
34
|
-
threads.each {|thread| thread.join}
|