Sha256: b28456960fbadd159e49d472511c3865fffc7cd1b54ac8e83f1921f0e9aa3e82

Contents?: true

Size: 974 Bytes

Versions: 33

Compression:

Stored size: 974 Bytes

Contents

# feature tests for Goto

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

class TC_error_checker < Test::Unit::TestCase

  def test_simple_checker
    button_checker = Proc.new do |ie|
      raise RuntimeError, "text 'buttons' is missing"  if ! ie.contains_text(/buttons/)
    end

    browser.add_checker button_checker
    assert_raises( RuntimeError ) { goto_page('forms3.html') }
    assert_nothing_raised { goto_page('buttons1.html') }
  ensure
    browser.disable_checker button_checker
    assert_nothing_raised { goto_page('forms3.html') }
  end

  def test_browser_close_with_failing_checker
    failing_checker = lambda {|ie| raise "Browser should be closed without throwing this exception!"}
    ie = Watir::IE.new
    ie.add_checker failing_checker
    assert_nothing_raised {ie.close}
  ensure
    ie.disable_checker failing_checker
    ie.close if ie.exists?
  end

end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
watir-classic-3.0.0 unittests/errorchecker_test.rb
watir-3.0.0.rc3 unittests/errorchecker_test.rb
watir-3.0.0.rc2 unittests/errorchecker_test.rb
watir-3.0.0.rc1 unittests/errorchecker_test.rb
watir-2.0.4 unittests/errorchecker_test.rb
watir-2.0.3 unittests/errorchecker_test.rb
watir-2.0.2 unittests/errorchecker_test.rb
watir-2.0.2.rc1 unittests/errorchecker_test.rb
watir-2.0.1 unittests/errorchecker_test.rb
watir-2.0.0 unittests/errorchecker_test.rb
watir-2.0.0.rc3 unittests/errorchecker_test.rb
watir-2.0.0.rc2 unittests/errorchecker_test.rb
watir-1.9.2 unittests/errorchecker_test.rb
watir-1.9.2.rc1 unittests/errorchecker_test.rb
watir-1.9.1 unittests/errorchecker_test.rb
watir-1.9.1.rc1 unittests/errorchecker_test.rb
watir-1.9.0 unittests/errorchecker_test.rb
watir-1.9.0.rc7 unittests/errorchecker_test.rb
watir-1.9.0.rc6 unittests/errorchecker_test.rb
watir-1.9.0.rc5 unittests/errorchecker_test.rb