Sha256: 7e0346f77166257efd719576cd71c5ac60d2fb90fe5c32461fd27112d3d87784

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

# feature tests for file Fields
# revision: $Revision: 1349 $

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

class TC_FileField < Test::Unit::TestCase
  include Watir
  
  def setup
    goto_page "fileupload.html"
  end
  
  def test_file_field_Exists
    # test for existance of 4 file area
    assert($ie.file_field(:name,"file1").exists?)
    assert($ie.file_field(:id,"file2").exists?)

    # test for missing 
    assert(!$ie.file_field(:name, "missing").exists?)   
    assert(!$ie.file_field(:name,"totallybogus").exists?)

    # pop one open and put something in it.
    file = $htmlRoot + "fileupload.html"
    file.gsub! 'file:///', ''
    file.gsub! '/', '\\'
    $ie.file_field(:name,"file1").set(file)	
    assert_equal file, $ie.file_field(:name,"file1").value

    # click the upload button
    $ie.button(:name,"upload").click
    assert($ie.text.include?("PASS"))	
  end
  
  def test_iterator
    assert_equal(6, $ie.file_fields.length)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-1.5.6 unittests/filefield_test.rb
watir-1.5.5 unittests/filefield_test.rb