Sha256: cfed304165797906e5bd8c1f7a8fc47c0ef734bf447ef5e96ad4e42b0da6f03d

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

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

describe 'Utility Functions for the Grid' do
  before(:all) do
    @controller = Controller.new(
      :ring_server_port => 12353,
      :loglevel => Logger::ERROR)
    @controller.start
    1.upto(1) do 
      provider = Provider.new(
        :ring_server_port => 12353, 
        :loglevel => Logger::ERROR, :browser_type => 'safari')
      provider.start
    end
    grid = Watir::Grid.new(:ring_server_port => 12353)
    grid.start(:read_all => true)
    @browser = grid.browsers[0]
  end
  
  after(:all) do
    @controller.stop
  end

  it 'should get the logged-in user for the remote provider' do
    @browser[:object].get_logged_in_user.should == `whoami`.chomp
  end

  it 'should enumerate any running browsers on the remote provider' do
    @browser[:object].get_running_browsers(['firefox-bin']).size.should == 0
  end

  it 'should be able to start a new firefox browser' do
    @browser[:object].start_firefox_jssh
    sleep 5
    @browser[:object].get_running_browsers(['firefox-bin']).size.should == 1
  end
  
  it 'should be able to kill all firefox browsers' do
    @browser[:object].kill_browser('firefox-bin')
    @browser[:object].get_running_browsers(['firefox-bin']).size.should == 0
  end
  
  it 'should be able to start a new firefox browser specified by path' do
    @browser[:object].start_firefox_jssh
      ("/Applications/Firefox.app/Contents/MacOS/firefox-bin")
    sleep 5
    @browser[:object].get_running_browsers(['firefox-bin']).size.should == 1
  end
  
  it 'should be able to kill all browsers' do
    @browser[:object].kill_all_browsers
    @browser[:object].get_running_browsers.size.should == 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watirgrid-0.0.9 spec/utilities_spec.rb