[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit WebFormTest.java,1.23,1.24
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-13 17:57:50
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv25269/test/com/meterware/httpunit Modified Files: WebFormTest.java Log Message: Added Button.submit to submit a form from a button Index: WebFormTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- WebFormTest.java 1 Aug 2002 14:58:59 -0000 1.23 +++ WebFormTest.java 13 Aug 2002 17:57:47 -0000 1.24 @@ -79,6 +79,23 @@ } + public void testSubmitFromButton() throws Exception { + defineWebPage( "Form", "<form method=GET id=main action = 'tryMe'>" + + "<Input type=text Name=name>" + + "<input type=\"checkbox\" name=second checked>Enabled" + + "<input type=submit name=save value=none>" + + "<input type=submit name=save value=all>" + + "</form>" ); + defineResource( "/tryMe?name=master&second=on&save=all", "You made it!" ); + WebResponse wr = _wc.getResponse( getHostPath() + "/Form.html" ); + WebForm form = wr.getFormWithID( "main" ); + form.setParameter( "name", "master" ); + SubmitButton button = form.getSubmitButton( "save", "all" ); + button.click(); + assertEquals( "Expected response", "You made it!", _wc.getCurrentPage().getText() ); + } + + public void testFindNoForm() throws Exception { defineWebPage( "NoForms", "This has no forms but it does" + "have <a href=\"/other.html\">an active link</A>" + |