Sha256: 1a32a6f6414c784cdb44669db8b302e0fe50dc86daddcef084408d3d82a2acb4

Contents?: true

Size: 1.89 KB

Versions: 4

Compression:

Stored size: 1.89 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Grid" do

  let!(:grid) do
    params={}
    params[:controller_uri] = "druby://ec2-50-16-63-81.compute-1.amazonaws.com:11235"
    params[:browser] = "chrome"
    params[:quantity] = 5
    grid = Grid.new(params)
  end

  it "should be able to check the size of a grid" do
    grid.size.should == 5
  end

  it "should be able setup browsers on the grid" do
    grid.setup
    grid.browsers.first.should be_an_instance_of(DRb::DRbObject)
    grid.teardown
  end

  it "should be able to get information about individual providers on the grid" do
    grid.providers.first[:hostname].should_not be_empty
    grid.providers.first[:architecture].should_not be_empty
  end

  it "should be able to iterate over the grid" do
    grid.setup
    grid.iterate do |browser|
      2.times do # because we want to iterate more than once for each browser
        browser.goto "altentee.com"
        browser.title.should =~ /The Automation Company/
        # if using webdriver_performance we can get performance metrics
        browser.performance.summary[:response_time].should > 0
      end
    end
    grid.teardown
  end

  it "should be able to iterate over the grid with an index" do
    grid.setup
    grid.iterate_with_index do |browser, index|
      browser.goto "watirgrid.com"
      browser.performance.summary[:dom_processing].should > 0
    end
    grid.teardown
  end

  it "should be able to control the grid using shorthand method" do
    params={}
    params[:controller_uri] = "druby://ec2-50-16-63-81.compute-1.amazonaws.com:11235"
    params[:browser] = "chrome" # type of webdriver browser to spawn
    params[:quantity] = 5 # max number of browsers to use
    params[:rampup] = 10 # seconds
    Grid.control(params) do |browser, index|
      browser.goto "gridinit.com"
      browser.performance.summary[:time_to_first_byte].should > 0
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
grid-0.4.3 spec/grid_spec.rb
grid-0.4.2 spec/grid_spec.rb
grid-0.4.1 spec/grid_spec.rb
grid-0.4.0 spec/grid_spec.rb