You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rob Audenaerde <ro...@gmail.com> on 2017/11/20 12:33:40 UTC

WicketTester#testComponentInPage and executeBehavior

Hi all,

I try to test a AjaxLink-based component using:

MyComponent myComponent = new MyComponent("id");
wicketTester.startComponentInPage( myComponent);

MyComponent contains some AjaxLinks, I want to click on them by:

(uses a visitor to find the first child)
AjaxLink on = getFirstChild(myComponent, AjaxLink.class)
executeAjaxEvent( on, "click" );

However, this gives me:

org.apache.wicket.WicketRuntimeException: No Page found for component
[VcAjaxLink [Component id = sortza]]

What is the correct wat to execute ajax behaviors in this approach?

Thanks in advance,
-Rob

Re: WicketTester#testComponentInPage and executeBehavior

Posted by Rob Audenaerde <ro...@gmail.com>.
Hi Sven,

Thanks for replying,

The difference is this, in the example you send the component is referenced
by its path:


On Mon, Nov 20, 2017 at 10:05 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> here's an example usage:
>
> https://github.com/apache/wicket/blob/master/wicket-core/
> src/test/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavi
> orTest.java#L47
>
> Please check what's different in your case.
>
> Have fun
> Sven
>
>
>
> Am 20.11.2017 um 13:33 schrieb Rob Audenaerde:
>
>> Hi all,
>>
>> I try to test a AjaxLink-based component using:
>>
>> MyComponent myComponent = new MyComponent("id");
>> wicketTester.startComponentInPage( myComponent);
>>
>> MyComponent contains some AjaxLinks, I want to click on them by:
>>
>> (uses a visitor to find the first child)
>> AjaxLink on = getFirstChild(myComponent, AjaxLink.class)
>> executeAjaxEvent( on, "click" );
>>
>> However, this gives me:
>>
>> org.apache.wicket.WicketRuntimeException: No Page found for component
>> [VcAjaxLink [Component id = sortza]]
>>
>> What is the correct wat to execute ajax behaviors in this approach?
>>
>> Thanks in advance,
>> -Rob
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: WicketTester#testComponentInPage and executeBehavior

Posted by Rob Audenaerde <ro...@gmail.com>.
Hi Sven,

Thanks for replying,

The difference is this, in the example you send the component is referenced
by its path:

tester.executeAjaxEvent("form:select", "inputchange change");

While I reference it by the component:

tester.executeAjaxEvent( on, "click" );


I'll try digging in the source to see what happens.

On Mon, Nov 20, 2017 at 10:05 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> here's an example usage:
>
> https://github.com/apache/wicket/blob/master/wicket-core/
> src/test/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavi
> orTest.java#L47
>
> Please check what's different in your case.
>
> Have fun
> Sven
>
>
>
> Am 20.11.2017 um 13:33 schrieb Rob Audenaerde:
>
>> Hi all,
>>
>> I try to test a AjaxLink-based component using:
>>
>> MyComponent myComponent = new MyComponent("id");
>> wicketTester.startComponentInPage( myComponent);
>>
>> MyComponent contains some AjaxLinks, I want to click on them by:
>>
>> (uses a visitor to find the first child)
>> AjaxLink on = getFirstChild(myComponent, AjaxLink.class)
>> executeAjaxEvent( on, "click" );
>>
>> However, this gives me:
>>
>> org.apache.wicket.WicketRuntimeException: No Page found for component
>> [VcAjaxLink [Component id = sortza]]
>>
>> What is the correct wat to execute ajax behaviors in this approach?
>>
>> Thanks in advance,
>> -Rob
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: WicketTester#testComponentInPage and executeBehavior

Posted by Sven Meier <sv...@meiers.net>.
Hi,

here's an example usage:

https://github.com/apache/wicket/blob/master/wicket-core/src/test/java/org/apache/wicket/ajax/form/OnChangeAjaxBehaviorTest.java#L47

Please check what's different in your case.

Have fun
Sven


Am 20.11.2017 um 13:33 schrieb Rob Audenaerde:
> Hi all,
>
> I try to test a AjaxLink-based component using:
>
> MyComponent myComponent = new MyComponent("id");
> wicketTester.startComponentInPage( myComponent);
>
> MyComponent contains some AjaxLinks, I want to click on them by:
>
> (uses a visitor to find the first child)
> AjaxLink on = getFirstChild(myComponent, AjaxLink.class)
> executeAjaxEvent( on, "click" );
>
> However, this gives me:
>
> org.apache.wicket.WicketRuntimeException: No Page found for component
> [VcAjaxLink [Component id = sortza]]
>
> What is the correct wat to execute ajax behaviors in this approach?
>
> Thanks in advance,
> -Rob
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org