Sha256: f8668aa18ca96e1703cd2af89e503e763ea79e4b48a45c0656b1fb14b1b8b34e

Contents?: true

Size: 1.56 KB

Versions: 23

Compression:

Stored size: 1.56 KB

Contents

# feature tests for file Fields

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
require 'unittests/setup'

class TC_FileField < Test::Unit::TestCase


  def setup
    goto_page("fileupload.html")
  end

  def test_fileField_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_false(browser.file_field(:name, "missing").exists?)
    assert_false(browser.file_field(:name,"totallybogus").exists?)
    #pop one open and put something in it.
    browser.file_field(:name,"file3").set($htmlRoot + "fileupload.html")
    #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)
    arrFileFields = browser.file_fields
    assert_equal("file1", arrFileFields[1].name)
    assert_equal("file2", arrFileFields[2].id)
    assert_equal("disabled", arrFileFields[3].name)
    assert_equal("file3", arrFileFields[4].name)
    assert_equal("beforetest", arrFileFields[5].name)
    assert_equal("aftertest", arrFileFields[6].name)
    arrFileFields.each do |fileField|
      assert_equal("file", fileField.type)
    end
  end
  
  def test_file_field_onchange
    assert_equal("", browser.file_field(:name, 'file3').alt)
    browser.file_field(:name,"file3").set($htmlRoot + "fileupload.html")
    assert_equal("changed", browser.file_field(:name, 'file3').alt)
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
firewatir-1.9.4 unittests/filefield_test.rb
firewatir-1.9.3 unittests/filefield_test.rb
firewatir-1.9.2 unittests/filefield_test.rb
firewatir-1.9.2.rc1 unittests/filefield_test.rb
firewatir-1.9.1 unittests/filefield_test.rb
firewatir-1.9.1.rc1 unittests/filefield_test.rb
firewatir-1.9.0 unittests/filefield_test.rb
firewatir-1.9.0.rc7 unittests/filefield_test.rb
firewatir-1.9.0.rc6 unittests/filefield_test.rb
firewatir-1.9.0.rc5 unittests/filefield_test.rb
firewatir-1.9.0.rc4 unittests/filefield_test.rb
firewatir-1.9.0.rc3 unittests/filefield_test.rb
firewatir-1.9.0.rc2 unittests/filefield_test.rb
firewatir-1.9.0.rc1 unittests/filefield_test.rb
firewatir-1.8.1 unittests/filefield_test.rb
firewatir-1.8.1.rc1 unittests/filefield_test.rb
firewatir-1.8.0 unittests/filefield_test.rb
firewatir-1.8.0.rc1 unittests/filefield_test.rb
firewatir-1.7.1 unittests/filefield_test.rb
firewatir-1.7.0 unittests/filefield_test.rb