Sha256: cc3391ef69f9ca5df65a3956febfb7513fbead481e65be5a847f94f617a3d8c7

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

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

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

class TC_FileField < Test::Unit::TestCase
  include Watir
  
  def goto_page
    $ie.goto($htmlRoot + "fileupload.html")
  end
  
  def test_file_field_Exists
    goto_page

    # 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
    goto_page
    assert_equal(6, $ie.file_fields.length)
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

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