spec/webdriver_spec.rb in watirgrid-1.1.3.pre vs spec/webdriver_spec.rb in watirgrid-1.1.3
- old
+ new
@@ -15,31 +15,23 @@
after(:all) do
@controller.stop
end
- it 'should take the last provider on the grid and execute some Watir code in WebDriver with Firefox' do
- grid = Watir::Grid.new(:ring_server_port => 12356)
- grid.start(:quantity => 1, :take_all => true)
- threads = []
- grid.browsers.each do |browser|
- threads << Thread.new do
- browser[:hostname].should == `hostname`.strip
- browser[:architecture].should == Config::CONFIG['arch']
- browser[:browser_type].should == 'webdriver'
- b = browser[:object].new_browser(:firefox)
- b.goto("http://www.google.com")
- b.text_field(:name, 'q').set("watirgrid")
- b.button(:name, "btnI").click
- b.close
- end
+ it 'should control a grid in WebDriver with Firefox' do
+ Watir::Grid.control(:ring_server_port => 12356, :browser_type => 'firefox') do |browser, index|
+ p "I am browser index #{index}"
+ browser.goto "http://google.com"
+ p browser.title
+ browser.close
end
- threads.each {|thread| thread.join}
- grid.size.should == 1
end
- it 'should find no more providers on the grid' do
- grid = Watir::Grid.new(:ring_server_port => 12356)
- grid.start(:read_all => true)
- grid.size.should == 0
+ it 'should iterate over a grid in WebDriver with Chrome' do
+ grid = Watir::Grid.new(:ring_server_port => 12356, :browser_type => 'chrome')
+ grid.start(:initiate => true)
+ grid.iterate do |browser|
+ browser.goto "http://google.com"
+ browser.close
+ end
end
end