use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class StatelessAjaxSubmitLinkTest method testSubmitForm.
@Test
public void testSubmitForm() throws Exception {
tester.startPage(StatelessPage.class);
FormTester formTester = tester.newFormTester("inputForm");
formTester.setValue("name", "myname");
formTester.setValue("surname", "mysurname");
tester.executeAjaxEvent("inputForm:submit", "click");
String response = tester.getLastResponseAsString();
boolean isAjaxResponse = response.contains(XmlPartialPageUpdate.START_ROOT_ELEMENT) && response.contains(XmlPartialPageUpdate.END_ROOT_ELEMENT);
assertTrue(isAjaxResponse);
boolean formAjaxSubmit = response.contains(StatelessPage.FORM_SUBMIT) && response.contains(StatelessPage.AJAX_SUBMIT);
assertTrue(formAjaxSubmit);
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class MarkupVariationTest method changeVariationBeforeRendering.
/**
* https://issues.apache.org/jira/browse/WICKET-6231
*/
@Test
public void changeVariationBeforeRendering() throws Exception {
tester.startPage(new VariationPage());
FormTester formTester = tester.newFormTester("p:a_form");
formTester.submit();
tester.assertContainsNot("One");
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class EnclosureTest method testRender9a.
/**
* @throws Exception
*/
@Test
public void testRender9a() throws Exception {
Class<? extends Page> clazz = EnclosurePage_9.class;
executePage(new EnclosurePage_9(), "EnclosurePageExpectedResult_9.html");
EnclosurePage_9 page = (EnclosurePage_9) tester.getLastRenderedPage();
page.reset();
FormTester formTester = tester.newFormTester("form");
tester.getRequest().getPostParameters().setParameterValue(((CheckBox) page.get("form:input")).getInputName(), "true");
page.get("form:label").setVisible(true);
formTester.submit();
tester.assertRenderedPage(clazz);
assertResultPage("EnclosurePageExpectedResult_9-4.html");
assertTrue(page.inputOnBeforeRender);
assertTrue(page.inputValidate);
assertTrue(page.labelOnBeforeRender);
page.reset();
tester.getRequest().getPostParameters().setParameterValue(((CheckBox) page.get("form:input")).getInputName(), "true");
page.get("form:label").setVisible(false);
tester.submitForm("form");
tester.assertRenderedPage(clazz);
assertResultPage("EnclosurePageExpectedResult_9-2-1.html");
// It should be FALSE, but because of auto-component etc. it doesn't
// assertFalse(page.inputOnBeforeRender);
assertTrue(page.inputOnBeforeRender);
// It should be FALSE, but because of auto-component etc. it doesn't
// assertFalse(page.inputValidate);
assertTrue(page.inputValidate);
assertFalse(page.labelOnBeforeRender);
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class FormPage2Test method formAndLinkAreSubmitted.
/**
*/
@Test
public void formAndLinkAreSubmitted() {
tester.startPage(FormPage2.class);
FormPage2 page = (FormPage2) tester.getLastRenderedPage();
Assert.assertFalse(page.isSubmitLinkSubmitted());
Assert.assertFalse(page.isFormSubmitted());
FormTester formTester = tester.newFormTester("form");
formTester.submitLink("link", false);
page = (FormPage2) tester.getLastRenderedPage();
Assert.assertTrue(page.isFormSubmitted());
Assert.assertTrue(page.isSubmitLinkSubmitted());
}
use of org.apache.wicket.util.tester.FormTester in project wicket by apache.
the class FormPage2Test method formIsSubmitted.
/**
*/
@Test
public void formIsSubmitted() {
tester.startPage(FormPage2.class);
FormPage2 page = (FormPage2) tester.getLastRenderedPage();
Assert.assertFalse(page.isSubmitLinkSubmitted());
Assert.assertFalse(page.isFormSubmitted());
FormTester formTester = tester.newFormTester("form");
formTester.submit();
page = (FormPage2) tester.getLastRenderedPage();
Assert.assertTrue(page.isFormSubmitted());
Assert.assertFalse(page.isSubmitLinkSubmitted());
}
Aggregations