Sha256: e4fb99f42d205169a9aa8364fe3da5a64de755e9b64ae3d681db0521d0223bc3

Contents?: true

Size: 1.75 KB

Versions: 17

Compression:

Stored size: 1.75 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, :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
  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, :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

17 entries across 17 versions & 1 rubygems

Version Path
watir-1.9.0 unittests/defer_test.rb
watir-1.9.0.rc7 unittests/defer_test.rb
watir-1.9.0.rc6 unittests/defer_test.rb
watir-1.9.0.rc5 unittests/defer_test.rb
watir-1.9.0.rc4 unittests/defer_test.rb
watir-1.9.0.rc3 unittests/defer_test.rb
watir-1.9.0.rc2 unittests/defer_test.rb
watir-1.9.0.rc1 unittests/defer_test.rb
watir-1.8.1 unittests/defer_test.rb
watir-1.8.1.rc1 unittests/defer_test.rb
watir-1.8.0 unittests/defer_test.rb
watir-1.8.0.rc1 unittests/defer_test.rb
watir-1.7.1 unittests/defer_test.rb
watir-1.7.0 unittests/defer_test.rb
watir-1.7.0.rc1 unittests/defer_test.rb
watir-1.6.7 unittests/defer_test.rb
watir-1.6.7.rc1 unittests/defer_test.rb