Sha256: 7e0c37f5601b7459159e8626e1e7514a11fd0b76acc4dbfb2f3250561287e42e

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

# Unit Test for Internet Explorer

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

class TC_ie < Test::Unit::TestCase
  include Watir::Exception
  
  def setup
    @faked_ie = TestIE.new
  end
  
  def test_waitForIE
    wait_time = 1
    #      @faked_ie.logger.level = Logger::DEBUG
    
    @faked_ie.setTimeToWait wait_time
    begin_time = Time.now
    @faked_ie.wait
    elapsed_time = Time.now - begin_time
    assert_in_delta(wait_time, elapsed_time, 0.5)
  end
  
  # is this correct? 
  def test_getLink_ByIndexReturnsNilOnNoLinks
    assert_nil(@faked_ie.tagged_element_locator('A', :index, 0))
    assert_nil(@faked_ie.tagged_element_locator('A', :index, 0))
  end
  
  def test_getLink_ByBadHow
    @faked_ie.addLink "foo"
    assert_raise(MissingWayOfFindingObjectException) do
      @faked_ie.tagged_element_locator('A', :no_such_mechanism, "verifying error handling")
    end
  end

  def test_execute_script
    script = %q[
      var x = 'something';
      var y = " else";
      x + y;
    ]
    assert_equal "something else", browser.execute_script(script)
  end
  
  # is this correct? 
  def test_getLink_ByUrlReturnsNilOnNoLinks
    assert_nil(@faked_ie.tagged_element_locator('A', :url, "whatever"))
  end
    
  # is this correct? 
  def test_getLink_ByTextReturnsNilOnNoLinks
    assert_nil(@faked_ie.tagged_element_locator('A', :text, "whatever"))
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-3.0.0.rc2 unittests/ie_test.rb
watir-3.0.0.rc1 unittests/ie_test.rb
watir-2.0.4 unittests/ie_test.rb