# feature tests for Forms
# revision: $Revision: 1.0 $
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'unittests/setup'
class TC_Forms2 < Test::Unit::TestCase # Note: there is no TC_Forms
include FireWatir
def setup
$ff.goto($htmlRoot + "forms2.html")
end
def test_Form_Exists
assert($ff.form(:name, "test2").exists?)
assert(!$ff.form(:name, "missing").exists?)
assert($ff.form("test2").exists?)
assert(!$ff.form( "missing").exists?)
assert($ff.form(:index, 1).exists?)
assert(!$ff.form(:index, 88).exists?)
assert($ff.form(:method, "get").exists?)
assert(!$ff.form(:method, "missing").exists?)
assert($ff.form(:id, 'f2').exists?)
assert(!$ff.form(:id, 'missing').exists?)
assert($ff.form(:action, /pass.html/).exists?)
assert(!$ff.form(:action, "missing").exists?)
end
def test_ButtonInForm
assert($ff.form(:name, "test2").button(:caption , "Submit").exists?)
end
# The following tests from bug 2261
def test_form_html
assert_equal("\n
\n".downcase(),
$ff.form(:name, 'test2').html.downcase())
end
def test_form_flash
assert_nothing_raised{ $ff.form(:name, 'test2').flash }
end
def test_form_sub_element
assert_equal('Click Me', $ff.form(:index, 1).button(:name, 'b1').value)
end
end
class TC_Form_Display < Test::Unit::TestCase
include FireWatir
include MockStdoutTestCase
def test_showforms
$ff.goto($htmlRoot + "forms2.html")
$stdout = @mockout
$ff.showForms
assert_equal(<