Sha256: bfc49b0a77a9fd65c97f8f9d00e469a1af71fe79d15051a996d40c05e4fc18a9

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require File.dirname(__FILE__) + '/../../lib/watirloo/firewatir_ducktape'

# TESTS FIXME kill all browsers before and after the test
require 'test/spec'

describe 'firefox.new has option key :attach that does not start new browser' do
  
  before :each do
    @b = FireWatir::Firefox.start 'file:///' + File.dirname(__FILE__) + '/../html/person.html'
    sleep 5
  end
  
  after :each do
    @b.close
    sleep 5
  end
  
  it 'new with option :atach => true attaches to existing window and does not start new window' do
    @b.title.should == 'Person'
    b = FireWatir::Firefox.new :attach => true
    b.title.should == 'Person'
  end
  
  it 'why does attach instance method throw exception when only one window exists on the desktop' do
    assert_raise(Watir::Exception::NoMatchingWindowFoundException) do
      b = @b.attach :title, 'Person'
    end
  end
  
  it 'why does attach instance method throw exception when attaching to original window while another exists' do
    b = FireWatir::Firefox.start 'file:///' + File.dirname(__FILE__) + '/../html/census.html'
    sleep 3
    assert_raise(Watir::Exception::NoMatchingWindowFoundException) do
      c = b.attach :title, 'Person' #attach to the setup window
    end
  end
  
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
marekj-watirloo-0.0.2 test/firewatir/attach_instance_test.rb
marekj-watirloo-0.0.3 test/firewatir/attach_instance_test.rb
marekj-watirloo-0.0.5 spec/firewatir/attach_instance_test.rb
watirloo-0.0.7 spec/firewatir/attach_instance_test.rb