<commit_before># feature tests for file Fields
# revision: $Revision$

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
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<commit_msg>test now also runs using firewatir<commit_after># feature tests for file Fields
# revision: $Revision$

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
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(browser.file_field(:name,"file1").exists?)
    assert(browser.file_field(:id,"file2").exists?)

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

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

    # click the upload button
    browser.button(:name,"upload").click
    assert(browser.text.include?("PASS"))	
  end
  
  def test_iterator
    assert_equal(6, browser.file_fields.length)
  end
  
end
{'fraction_non_alphanumeric': 0.14537854156990246, 'fraction_numerical': 0.00557361820715281, 'mean_word_length': 3.765486725663717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '649512', 'n_tokens_mistral': 739, 'n_tokens_neox': 719, 'n_words': 148}