Sha256: 04d9df3107dfd8d09937585418749bacf17605282bc666f756de37215b471209

Contents?: true

Size: 1.84 KB

Versions: 14

Compression:

Stored size: 1.84 KB

Contents

# tests of deferring when a Watir object is bound to a com object (lazy evaluation)

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

class TC_Defer < Test::Unit::TestCase
  def teardown
    @new_browser.close if defined?(@new_browser)
    browser.goto('about:blank')
  end
  tag_method :test_binding_to_newly_loaded_page, :fails_on_firefox, :fails_on_ie, :attach
  def test_binding_to_newly_loaded_page
    @new_browser = Watir::Browser.new
    text_field = @new_browser.text_field(:name, 'text1')
    button = @new_browser.button(:value, 'Clear Events Box')
    div = @new_browser.div(:name, 'divvy')
    @new_browser.goto($htmlRoot + "textfields1.html")
    assert_equal('Hello World', text_field.value)
    assert_equal('Clear Events Box', button.value)
    assert_equal('Div Text', div.text)
  end
  tag_method :test_binding_to_refreshed_page, :fails_on_ie
  def test_binding_to_refreshed_page
    goto_page "textfields1.html"
    text_field = browser.text_field(:name, 'text1')
    button = browser.button(:value, 'Clear Events Box')
    div = browser.div(:name, 'divvy')
    browser.refresh
    assert_equal('Hello World', text_field.value)
    assert(text_field.enabled?)
    assert_equal('Clear Events Box', button.value)
    assert_equal('Div Text', div.text)
  end
  tag_method :test_exists, :fails_on_firefox, :fails_on_ie, :attach
  def test_exists
    @new_browser = Watir::Browser.new
    text_field = @new_browser.text_field(:name, 'text1')
    button = @new_browser.button(:value, 'Clear Events Box')
    div = @new_browser.div(:name, 'divvy')
    assert_false(text_field.exists?)
    assert_false(button.exists?)
    @new_browser.goto($htmlRoot + "textfields1.html")
    assert(text_field.exists?)
    assert(button.exists?)
    assert(div.exists?)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
watir-3.0.0.rc2 unittests/defer_test.rb
watir-3.0.0.rc1 unittests/defer_test.rb
watir-2.0.4 unittests/defer_test.rb
watir-2.0.3 unittests/defer_test.rb
watir-2.0.2 unittests/defer_test.rb
watir-2.0.2.rc1 unittests/defer_test.rb
watir-2.0.1 unittests/defer_test.rb
watir-2.0.0 unittests/defer_test.rb
watir-2.0.0.rc3 unittests/defer_test.rb
watir-2.0.0.rc2 unittests/defer_test.rb
watir-1.9.2 unittests/defer_test.rb
watir-1.9.2.rc1 unittests/defer_test.rb
watir-1.9.1 unittests/defer_test.rb
watir-1.9.1.rc1 unittests/defer_test.rb