[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit WebFormTest.java,1.22,1.23 WebLinkTest.j
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-01 14:59:03
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv9683/test/com/meterware/httpunit Modified Files: WebFormTest.java WebLinkTest.java Log Message: Support link.click and form.submit Index: WebFormTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- WebFormTest.java 24 Jul 2002 17:32:08 -0000 1.22 +++ WebFormTest.java 1 Aug 2002 14:58:59 -0000 1.23 @@ -65,6 +65,20 @@ } + public void testSubmitFromForm() throws Exception { + defineWebPage( "Form", "<form method=GET id=main action = 'tryMe'>" + + "<Input type=text Name=name>" + + "<input type=\"checkbox\" name=second checked>Enabled" + + "</form>" ); + defineResource( "/tryMe?name=master&second=on", "You made it!" ); + WebResponse wr = _wc.getResponse( getHostPath() + "/Form.html" ); + WebForm form = wr.getFormWithID( "main" ); + form.setParameter( "name", "master" ); + form.submit(); + 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>" + Index: WebLinkTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebLinkTest.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- WebLinkTest.java 30 Jul 2002 13:17:49 -0000 1.21 +++ WebLinkTest.java 1 Aug 2002 14:58:59 -0000 1.22 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -166,7 +166,7 @@ assertEquals( "Num links in next page", 1, nextPage.getLinks().length ); link = nextPage.getLinks()[0]; - wc.sendRequest( link.getRequest() ); + link.click(); assertEquals( "Title of next page", "Initial", wc.getFrameContents( link.getTarget() ).getTitle() ); } |