As far as i understood this, FormTester submit is only for pushing the data from component to model. If you wait for the component to be executed the js event
has to be executed.

Is it working if you do an WicketTester.executeAjaxEvent("id", "onclick"); ?

Cheers
Per

Hi all,

I am testing a form with FormTester and WicketTester.
When I test error messages which are send by form validation, test works
well :
tester.assertErrorMessages(new String[] {"Le champ 'Identifiant' est
obligatoire."});

but when I test error message which is send by my submit ajaxButton, test
fail : no error is sent.
When I test application manually, this error appears in feedBackPanel.
I don't understand why error is not sent when application is used by
wicketTester.

This is my submit button code :
         AjaxButton submitbutton = new AjaxButton("ajaxSubmitLogin") {

             @Override
             protected void onSubmit(AjaxRequestTarget target, Form<?>  form)
{
                 Membre modelObject = (Membre) form.getModelObject();
                 Membre membre;

                 membre = serviceIdentif.identifier(modelObject.getId(),
modelObject.getPassword());
                 if(membre == null)
                     error("Identifiant ou mot de passe incorrect");
                 else
                     setResponsePage(TableauBordPage.class);
             }

             @Override
             protected void onError(AjaxRequestTarget target, Form<?>  form) {
                 target.addComponent(feedBackPanel);
             }
         }

and my test code
         FormTester formTester =
tester.newFormTester(loginForm.getPageRelativePath());
         formTester.setValue("membreId", "benj");
         formTester.setValue("password", "password");
         formTester.submit("ajaxSubmitLogin");

         tester.assertErrorMessages(new String[] {"Identifiant ou mot de
passe incorrect"});



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

Reply via email to