Sha256: b83c3ee4916b552250481f996e82e1deb7330085f4c75e035366d94332465974

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

# feature tests for Pre
# revision: $Revision: 962 $

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

class TC_Pre < Test::Unit::TestCase
  include Watir
  
  def setup
    $ie.goto($htmlRoot + "pre.html")
  end
  
  def test_Pre_Count
    assert( $ie.pres.length == 3 )
  end
  
  def test_Pre_Exists
    assert(! $ie.pre( :id, 'missingPre' ).exists? )
    assert(! $ie.pre( :index, 33 ).exists? )
    
    assert( $ie.pre( :id, '1' ).exists? )
    assert( $ie.pre( :id, /[3-9]/ ).exists? )
    
    assert(! $ie.pre( :id, /missing_pre/ ).exists? )
    
    assert( $ie.pre( :index, 1 ).exists? )
    assert( $ie.pre( :index, 2 ).exists? )
    assert( $ie.pre( :index, 3 ).exists? )
    
    assert( $ie.pre( :name, '3' ).exists? )
    assert(! $ie.pre( :name, "name_missing" ).exists? )
  end
  
  def test_simple_access
    pre = $ie.pre( :index, 1 )
    assert( pre.text.include?( "simple pre space" ) )
    assert(! pre.text.include?( "A second block" ) )
    
    assert( pre.html.include?( "id=1 name=\"1\"" ) )
    
    pre = $ie.pre( :index, 2 )
    assert( pre.text.include?( "A second block" ) )
    assert(! pre.text.include?( "this is the last block" ) )
    
    pre = $ie.pre( :index, 3 )
    assert( pre.text.include?( "continue    to work" ) )
    assert(! pre.text.include?( "Pre Tag Test" ) )
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-1.5.2 unittests/pre_test.rb
watir-1.5.4 unittests/pre_test.rb
watir-1.5.3 unittests/pre_test.rb