Sha256: f41881cad3aba124e1c129a23e267e72b3c26ede23bbabccea8d57e73d64ed9b

Contents?: true

Size: 1.97 KB

Versions: 23

Compression:

Stored size: 1.97 KB

Contents

# feature tests for attaching to new Firefox windows

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
require 'unittests/setup'

class TC_NewWindow < Test::Unit::TestCase
    tags :fails_on_ie

    def setup
      goto_page("new_browser.html")
    end

    def test_simply_attach_to_new_window_using_title
        browser.link(:text, 'New Window').click
        begin 
          ff_new = browser.attach(:title, 'Pass Page')
        rescue Watir::Exception::NoMatchingWindowFoundException
          raise $!, "Attach failed, check your Firefox settings: http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-ffsettings" 
        end
        assert(ff_new.text.include?('PASS'))
        ff_new.close
        #browser.link(:text, 'New Window').click
    end
    
    def test_simply_attach_to_new_window_using_url
        browser.link(:text, 'New Window').click
        begin
          ff_new = browser.attach(:url, /pass\.html/)
        rescue Watir::Exception::NoMatchingWindowFoundException
          raise $!, "Attach failed, check your Firefox settings: http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-ffsettings" 
        end
        assert(ff_new.text.include?('PASS'))
        ff_new.close
        #browser.link(:text, 'New Window').click
    end

    def test_attach_to_new_window_with_same_title_as_parent
        browser.link(:text, 'New Browser Window').click
        ff_new = browser.attach(:title, 'New Browser Launcher')
        assert(ff_new.text.include?('PASS'))
        ff_new.close
    end
     
    def test_new_window_exists
        assert_raises(NoMatchingWindowFoundException , "NoMatchingWindowFoundException was supposed to be thrown" ) {   browser.attach(:title, "missing_title")   }  
        assert_raises(NoMatchingWindowFoundException , "NoMatchingWindowFoundException was supposed to be thrown" ) {   browser.attach(:url, "missing_url")   }  
    end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
firewatir-1.9.4 unittests/attach_to_new_window_test.rb
firewatir-1.9.3 unittests/attach_to_new_window_test.rb
firewatir-1.9.2 unittests/attach_to_new_window_test.rb
firewatir-1.9.2.rc1 unittests/attach_to_new_window_test.rb
firewatir-1.9.1 unittests/attach_to_new_window_test.rb
firewatir-1.9.1.rc1 unittests/attach_to_new_window_test.rb
firewatir-1.9.0 unittests/attach_to_new_window_test.rb
firewatir-1.9.0.rc7 unittests/attach_to_new_window_test.rb
firewatir-1.9.0.rc6 unittests/attach_to_new_window_test.rb
firewatir-1.9.0.rc5 unittests/attach_to_new_window_test.rb
firewatir-1.9.0.rc4 unittests/attach_to_new_window_test.rb
firewatir-1.9.0.rc3 unittests/attach_to_new_window_test.rb
firewatir-1.9.0.rc2 unittests/attach_to_new_window_test.rb
firewatir-1.9.0.rc1 unittests/attach_to_new_window_test.rb
firewatir-1.8.1 unittests/attach_to_new_window_test.rb
firewatir-1.8.1.rc1 unittests/attach_to_new_window_test.rb
firewatir-1.8.0 unittests/attach_to_new_window_test.rb
firewatir-1.8.0.rc1 unittests/attach_to_new_window_test.rb
firewatir-1.7.1 unittests/attach_to_new_window_test.rb
firewatir-1.7.0 unittests/attach_to_new_window_test.rb