Sha256: f39454828f1313730cd6e34715f51382d162b871c5c0af12d04fe8394c407549

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

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

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

class TC_TableCell_XPath < Test::Unit::TestCase
  include Watir
  
  def setup
    gotoTableCellPage
  end
  
  def gotoTableCellPage
    $ie.goto($htmlRoot + "tableCell_using_xpath.html")
  end
  
  def testCellExists
    # There is no <image> with @src='rectangle.jpg'. So image will not be there.
    assert(! $ie.cell(:xpath , "//img[@src='images\/rectangle.jpg']/../").exists?  )
    # Select the parent element of image with src='square.jpg' which is a tablecell.
    assert(       $ie.cell(:xpath , "//img[@src='images\/square.jpg']/../").exists?  )
    assert(       $ie.cell(:xpath , "//img[@src='images\/triangle.jpg']/../").exists?  )
    puts "Selected table cell with text 'Table Cell with image of triangle.'"
    puts $ie.cell(:xpath , "//img[@src='images\/triangle.jpg']/../").to_s
  end
  
  def testCell_properties
    assert_equal(1 , $ie.cell(:xpath , "//img[@src='images\/square.jpg']/../").colspan) 
    assert_equal(2 , $ie.cell(:xpath , "//img[@src='images\/triangle.jpg']/../").colspan) 
    assert_equal(3 , $ie.cell(:xpath , "//img[@src='images\/circle.jpg']/../").colspan) 
    assert_equal(4 , $ie.cell(:xpath , "//img[@src='images\/button.jpg']/../").colspan) 
    
    # to string tests -- output should be verified!
    puts $ie.cell(:xpath , "//img[@src='images\/square.jpg']/../").to_s
    puts $ie.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.5.2 unittests/table_cell_using_xpath_test.rb
watir-1.5.4 unittests/table_cell_using_xpath_test.rb
watir-1.5.3 unittests/table_cell_using_xpath_test.rb