Sha256: d9daa15772c3a2971756fc059661dc3e0bac6b3bc13194a78537ba33922d7d8a

Contents?: true

Size: 1.43 KB

Versions: 21

Compression:

Stored size: 1.43 KB

Contents

# feature tests for Links with multiple attributes

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

class TC_Links_Multi < Test::Unit::TestCase
  
  def setup
    goto_page 'links_multi.html'
  end
  
  def test_existing
    assert_match(/not.html/, browser.link(:class, 'Papa').href)
    assert_match(/mama.html/, browser.link(:text, 'click').href)
  end

  def test_class_alias
    assert_match(/not.html/, browser.link(:class_name, 'Papa').href)
  end
  
  def test_hash_syntax
    assert_match(/not.html/, browser.link(:class => 'Papa').href)
    assert_match(/mama.html/, browser.link(:text => 'click').href)
  end
  
  def test_class_and_text
    assert_match(/papa.html/, browser.link(:class => 'Papa', :text => 'click').href)
  end
  
  def test_class_and_index
    assert_match(/papa.html/, browser.link(:class => 'Papa', :index => 2).href)
  end  

  def test_not_found_single
    exception = assert_raise(UnknownObjectException) do
      browser.link(:id, 'Missing').href
    end
    assert_equal('Unable to locate element, using :id, "Missing"', exception.message)
  end
  
  def test_not_found_with_multi
    exception = assert_raise(UnknownObjectException) do
      browser.link(:class => 'Missing', :index => 2).href
    end
    assert_equal('Unable to locate element, using {:class=>"Missing", :index=>2}', exception.message)
  end
  
end

Version data entries

21 entries across 21 versions & 1 rubygems

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