Sha256: f14697378858a32c7730b1b34d161e8de3b91301fb6149dd07807b366952d86d

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

# feature tests for xpath table cells
# revision: $Revision$

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

class TC_TableCell_XPath < Test::Unit::TestCase
  
  def setup
    goto_page "tableCell_using_xpath.html"
  end
  
  def testCellExists
    # There is no <image> with @src='rectangle.jpg'. So image will not be there.
    assert_false( browser.cell(:xpath , "//img[@src='images\/rectangle.jpg']/../").exists?  )
    # Select the parent element of image with src='square.jpg' which is a tablecell.
    assert(       browser.cell(:xpath , "//img[@src='images\/square.jpg']/../").exists?  )
    assert(       browser.cell(:xpath , "//img[@src='images\/triangle.jpg']/../").exists?  )
    puts "Selected table cell with text 'Table Cell with image of triangle.'"
    puts browser.cell(:xpath , "//img[@src='images\/triangle.jpg']/../").to_s
  end
  
  def testCell_properties
    assert_equal(1 , browser.cell(:xpath , "//img[@src='images\/square.jpg']/../").colspan) 
    assert_equal(2 , browser.cell(:xpath , "//img[@src='images\/triangle.jpg']/../").colspan) 
    assert_equal(3 , browser.cell(:xpath , "//img[@src='images\/circle.jpg']/../").colspan) 
    assert_equal(4 , browser.cell(:xpath , "//img[@src='images\/button.jpg']/../").colspan) 
    
    # to string tests -- output should be verified!
    puts browser.cell(:xpath , "//img[@src='images\/square.jpg']/../").to_s
    puts browser.cell(:xpath , "//img[@src='images\/triangle.jpg']/../").to_s
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-1.6.6 unittests/table_cell_using_xpath_test.rb
watir-1.6.6.rc2 unittests/table_cell_using_xpath_test.rb
watir-1.6.6.rc1 unittests/table_cell_using_xpath_test.rb