Sha256: def8d59f4f9ec02d3509c84bfb556d8c662beae304850a2532ea580dfffd7141

Contents?: true

Size: 1.75 KB

Versions: 1

Compression:

Stored size: 1.75 KB

Contents

# feature tests for attaching to new Firefox windows
# revision: $Revision: 1.0 $

$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_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

1 entries across 1 versions & 1 rubygems

Version Path
firewatir-1.6.2 unittests/attach_to_new_window_test.rb