Sha256: 4e5228da0b55ce3e70bd1c203e2121516bdf85cbf8afb620933aa70d7821852e

Contents?: true

Size: 1.59 KB

Versions: 2

Compression:

Stored size: 1.59 KB

Contents

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

# revision: $Revision: 1348 $

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'unittests/setup'
require 'unittests/buttons_test.rb'

class TC_Defer < Test::Unit::TestCase
  def teardown
    @ie_new.close if defined?(@ie_new)
    $ie.goto('about:blank')
  end
  def test_binding_to_newly_loaded_page
    @ie_new = Watir::IE.new
    text_field = @ie_new.text_field(:name, 'text1')
    button = @ie_new.button(:value, 'Clear Events Box')
    div = @ie_new.div(:name, 'divvy')
    @ie_new.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 = $ie.text_field(:name, 'text1')
    button = $ie.button(:value, 'Clear Events Box')
    div = $ie.div(:name, 'divvy')
    $ie.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
  def test_exists
    @ie_new = Watir::IE.new
    text_field = @ie_new.text_field(:name, 'text1')
    button = @ie_new.button(:value, 'Clear Events Box')
    div = @ie_new.div(:name, 'divvy')
    assert(!text_field.exists?)
    assert(!button.exists?)
    @ie_new.goto($htmlRoot + "textfields1.html")
    assert(text_field.exists?)
    assert(button.exists?)
    assert(div.exists?)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-1.5.6 unittests/defer_test.rb
watir-1.5.5 unittests/defer_test.rb