Hi Pieter,
The fix is taking a little longer than I expected. If you comment out
two lines of code in WebConversationFactory then the client.clickLink()
on a commandLink will work (at least with MyFaces 1.1). The two lines are:
HTMLParserFactory.useJTidyParser();
HttpUnitOptions.setScriptingEnabled(false);
The problem is, that will break AJAX support. So I'm not sure what the
final solution will be.
Stan
Pieter Kuijpers wrote:
I'm trying to test a commandLink in a page with
ClientFacade.clickLink,
but this does not seem to be working.
link.jsp:
<html
xmlns="http://www.w3.org/1999/xhtml">
<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
<title>Link test</title>
</head>
<body>
<h:form>
<h:commandLink id="link" value="click me"
action="target"/>
</h:form>
</body>
</f:view>
</html>
target.jsp:
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
<title>Link test successful</title>
</head>
<body>
Success.
</body>
</html>
Test code:
public class LinkTest extends TestCase {
public void testClickLink() throws Exception {
ClientFacade client = new ClientFacade("/link.faces");
client.clickLink("link");
assertEquals("Link test successful",
client.getWebResponse().getTitle());
}
}
The HTML that is returned using client.getWebResponse().getText is that
of link.jsp. When I try the same test by hand, it is working OK.
How is this supposed to work?
Thanks,
Pieter Kuijpers.
------------------------------------------------------------------------
_______________________________________________
jsfunit-dev mailing list
jsfunit-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jsfunit-dev