Kamil created WICKET-6442:
-----------------------------

             Summary: WicketTester#clickLink is not handling buttons
                 Key: WICKET-6442
                 URL: https://issues.apache.org/jira/browse/WICKET-6442
             Project: Wicket
          Issue Type: Bug
          Components: wicket
            Reporter: Kamil


WicketTester#clickLink javadoc says:
{code}
When clicking an AjaxSubmitLink the form, which the AjaxSubmitLink is attached 
to is first submitted, and then the onSubmit method on AjaxSubmitLink is 
invoked. If you have changed some values in the form during your test, these 
will also be submitted. This should not be used as a replacement for the {@link 
FormTester} to test your forms. It should be used to test that the code in your 
onSubmit method in AjaxSubmitLink actually works.
{code}

And this is exactly what I want to do - just test the code in my "onSubmit" 
method.
One difference is that I'm using IndicatingAjaxButton instead of 
AjaxSubmitLink, which causes the exception being thrown:
{code}
java.lang.AssertionError: Link test:saveButton is not an instance of 
AbstractLink or IAjaxLink
        at org.junit.Assert.fail(Assert.java:88)
        at 
org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:2031)
        at 
org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:1864)
{code}

I already checked that exactly the same mechanism, that clickLink is using 
works fine for the buttons:
{code}
Component button = wicketTester.getComponentFromLastRenderedPage("saveButton");
                
wicketTester.executeBehavior(WicketTesterHelper.findAjaxEventBehavior(button, 
"click"));
{code}
so changing this method to work with button should be easy



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to