grid 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +6 -4
  2. data/VERSION +1 -1
  3. data/grid.gemspec +1 -1
  4. data/lib/grid.rb +9 -1
  5. metadata +3 -3
data/README.rdoc CHANGED
@@ -173,17 +173,19 @@ Very little modification is needed to your existing test scripts. Essentially yo
173
173
  require 'watir-webdriver'
174
174
  browser = Watir::Browser.new :firefox
175
175
  browser.goto("http://www.google.com")
176
- browser.text_field(:name, 'q').set("watirgrid")
177
- browser.button(:name, "btnI").click
176
+ browser.text_field(:name, 'q').set("gridinit")
177
+ browser.button(:name => "btnG").click
178
+ browser.close
178
179
 
179
180
  *New Code*
180
181
  require 'grid'
181
182
  Grid.control(
182
- :controller_uri => 'druby://ec2-50-17-120-217.compute-1.amazonaws.com:11235') do |browser, id|
183
+ :controller_uri => 'druby://ec2-50-17-172-40.compute-1.amazonaws.com:11235') do |browser, id|
183
184
  puts "My remote browser id is #{id}"
184
185
  browser.goto("http://www.google.com")
185
186
  browser.text_field(:name, 'q').set("watirgrid")
186
- browser.button(:name, "btnI").click
187
+ browser.button(:name => "btnG").click
188
+ browser.close
187
189
  end
188
190
 
189
191
  In this example, we required the 'grid' gem and controlled a Grid object with the "control" method. This method requires the *:controller_uri* parameter obtained from step 3 and is passed a block of your existing watir code. The same method will yield an individual browser object (same as a Watir browser object) as well as a thread ID which you can use to help identify which node your code is executed on.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/grid.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{grid}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tim Koopmans"]
data/lib/grid.rb CHANGED
@@ -15,6 +15,7 @@ class Grid
15
15
  # It involves some general block thuggery and could
16
16
  # honestly benefit from some brutal refactoring...
17
17
  def self.control(params = {}, &block)
18
+ $stdout.flush
18
19
  log = Logger.new(STDOUT, 'daily')
19
20
  log.level = params[:loglevel] || Logger::DEBUG
20
21
  grid = Watir::Grid.new(params)
@@ -25,6 +26,7 @@ class Grid
25
26
  grid.browsers.each_with_index do |browser, index|
26
27
  sleep rampup(grid.size, params)
27
28
  threads << Thread.new do
29
+ $stdout.flush
28
30
  start = ::Time.now
29
31
  log.debug("Browser #{index+1}##{Thread.current.object_id} start : #{::Time.now}")
30
32
  log.debug("Browser #{index+1}##{Thread.current.object_id} architecture : #{browser[:architecture]}")
@@ -36,7 +38,13 @@ class Grid
36
38
  log.debug("Browser #{index+1}##{Thread.current.object_id} elapsed : #{(::Time.now - start).to_i} secs")
37
39
  end
38
40
  end
39
- threads.each {|thread| thread.join}
41
+ begin
42
+ threads.each {|thread| thread.join}
43
+ rescue => e
44
+ puts e.inspect
45
+ puts e.backtrace
46
+ grid.release_tuples
47
+ end
40
48
  grid.release_tuples
41
49
  end
42
50
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Koopmans