Hi,

you have to use a new FormTester instance after executing the Ajax event:

...............
        formTester = tester.newFormTester(path)
    formTester.select("field1", "aaaa"); // required field
        formTester.select("field2", "bbbb"); // required field
        .....
        formTester.select("firstDropDownSelect", 0);
wicketTester.executeAjaxEvent("detailsForm:firstDropDownSelect","change");
        formTester.select("secondDropDownSelect", 0);

        formTester = tester.newFormTester(path);
        formTester.submit()
...............

Executing a request (e.g. via executeAjaxEvent) 'consumes' the current request and WicketTester sets up a new 'empty' request.

A new FormTester will fill the parameters of that new request with the current state of your components.

Hope this helps
Sven



Hi,

you have to use a new FormTester instance after executing the Ajax event:

...............
    formTester = tester.newFormTester(path)
    formTester.select("field1", "aaaa"); // required field
    formTester.select("field2", "bbbb"); // required field
    .....
    formTester.select("firstDropDownSelect", 0);
wicketTester.executeAjaxEvent("detailsForm:firstDropDownSelect","change");
    formTester.select("secondDropDownSelect", 0);

    formTester = tester.newFormTester(path)
    formTester.submit()
...............

Executing a request (e.g. via executeAjaxEvent) 'consumes' the current request and a new one is set up by WicketTester.

Otherwise the values of the form




On 01.06.20 09:59, leodali83 wrote:
Hello everybody,
I'm developing a web application built on Wicket 8.

Now i'm testing a form containing 2 DropDownChoice, the selection of the
first one should refresh elements to be choose on the second through the
Ajax "change" event.
When i submit my form and I test feedback messages displayed during the
process, the form seems to have lost all the other field setted before the 2
drop downs below:

...............
                 formTester.select("field1", "aaaa"); // required field
                 formTester.select("field2", "bbbb"); // required field
                 .....
                formTester.select("firstDropDownSelect", 0);
                wicketTester.executeAjaxEvent("detailsForm:firstDropDownSelect",
"change");
                formTester.select("secondDropDownSelect", 0);
...............

The Wicket Tester fails the test stating "field1" and "field2" are required
fields, although I setted it correctly... :/

If I try the same behaviour interactively, it works fine.

What am I missing from my test?

Thanks in advance for any suggestions,
Leonardo

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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


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

Reply via email to