# feature tests for Forms
# revision: $Revision: 1.0 $
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
require 'unittests/setup'
class TC_Forms2 < Test::Unit::TestCase # Note: there is no TC_Forms
def setup
goto_page("forms2.html")
end
def test_Form_Exists
assert(browser.form(:name, "test2").exists?)
assert_false(browser.form(:name, "missing").exists?)
assert(browser.form("test2").exists?)
assert_false(browser.form( "missing").exists?)
assert(browser.form(:index, 1).exists?)
assert_false(browser.form(:index, 88).exists?)
assert(browser.form(:method, "get").exists?)
assert_false(browser.form(:method, "missing").exists?)
assert(browser.form(:id, 'f2').exists?)
assert_false(browser.form(:id, 'missing').exists?)
assert(browser.form(:action, /pass.html/).exists?)
assert_false(browser.form(:action, "missing").exists?)
end
def test_ButtonInForm
assert(browser.form(:name, "test2").button(:caption , "Submit").exists?)
end
# The following tests from bug 2261
tag_method :test_form_html, :fails_on_ie
def test_form_html
assert_equal("\n
\n".downcase(),
browser.form(:name, 'test2').html.downcase())
end
def test_form_flash
assert_nothing_raised{ browser.form(:name, 'test2').flash }
end
def test_form_sub_element
assert_equal('Click Me', browser.form(:index, 1).button(:name, 'b1').value)
end
end
class TC_Form_Display < Test::Unit::TestCase
include CaptureIOHelper
def test_showforms
goto_page("forms2.html")
actual = capture_stdout { browser.showForms }
assert_equal(<