Sha256: 132e33ce0804970476e173dedcfbbbb48c276c76f460819c4649a11ad3158ba2

Contents?: true

Size: 1.23 KB

Versions: 33

Compression:

Stored size: 1.23 KB

Contents

# feature tests for Links

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

class TC_Links_XPath < Test::Unit::TestCase
  
  def setup
    goto_page "links1.html"
  end
  
  def test_link_exists
    assert(browser.link(:xpath, "//a[contains(.,'test1')]/").exists?)
    assert(browser.link(:xpath, "//a[contains(., /TEST/i)]/").exists?)   
    assert_false(browser.link(:xpath, "//a[contains(.,'missing')]/").exists?)
    
    assert_false(browser.link(:xpath, "//a[@url='alsomissing.html']/").exists?)
    
    assert(browser.link(:xpath, "//a[@id='link_id']/").exists?)
    assert_false(browser.link(:xpath, "//a[@id='alsomissing']/").exists?)
    
    assert(browser.link(:xpath, "//a[@name='link_name']/").exists?)
    assert_false(browser.link(:xpath, "//a[@name='alsomissing']/").exists?)
    assert(browser.link(:xpath, "//a[@title='link_title']/").exists?)
  end
  
  def test_link_click
    browser.link(:xpath, "//a[contains(.,'test1')]/").click
    assert(browser.text.include?("Links2-Pass"))
  end
  
  def test_link_with_text_call
    browser.link(:xpath, "//a[text()='test1']").click
    assert(browser.text.include?("Links2-Pass"))
  end
  
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
watir-1.9.0.rc4 unittests/links_xpath_test.rb
watir-1.9.0.rc3 unittests/links_xpath_test.rb
watir-1.9.0.rc2 unittests/links_xpath_test.rb
watir-1.9.0.rc1 unittests/links_xpath_test.rb
watir-1.8.1 unittests/links_xpath_test.rb
watir-1.8.1.rc1 unittests/links_xpath_test.rb
watir-1.8.0 unittests/links_xpath_test.rb
watir-1.8.0.rc1 unittests/links_xpath_test.rb
watir-1.7.1 unittests/links_xpath_test.rb
watir-1.7.0 unittests/links_xpath_test.rb
watir-1.7.0.rc1 unittests/links_xpath_test.rb
watir-1.6.7 unittests/links_xpath_test.rb
watir-1.6.7.rc1 unittests/links_xpath_test.rb