Search in sources :

Example 46 with FormTester

use of org.apache.wicket.util.tester.FormTester in project wicket by apache.

the class FormPageTest method formAndLinkAreSubmitted.

/**
 */
@Test
public void formAndLinkAreSubmitted() {
    tester.startPage(FormPage.class);
    FormPage page = (FormPage) tester.getLastRenderedPage();
    Assert.assertFalse(page.isSubmitLinkSubmitted());
    Assert.assertFalse(page.isFormSubmitted());
    FormTester formTester = tester.newFormTester("form");
    formTester.submitLink("link", true);
    page = (FormPage) tester.getLastRenderedPage();
    Assert.assertTrue(page.isFormSubmitted());
    Assert.assertTrue(page.isSubmitLinkSubmitted());
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.Test)

Example 47 with FormTester

use of org.apache.wicket.util.tester.FormTester in project wicket by apache.

the class FormPageTest method formIsSubmitted.

/**
 */
@Test
public void formIsSubmitted() {
    tester.startPage(FormPage.class);
    FormPage page = (FormPage) tester.getLastRenderedPage();
    Assert.assertFalse(page.isSubmitLinkSubmitted());
    Assert.assertFalse(page.isFormSubmitted());
    FormTester formTester = tester.newFormTester("form");
    formTester.submit();
    page = (FormPage) tester.getLastRenderedPage();
    Assert.assertTrue(page.isFormSubmitted());
    Assert.assertFalse(page.isSubmitLinkSubmitted());
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.Test)

Example 48 with FormTester

use of org.apache.wicket.util.tester.FormTester in project wicket by apache.

the class ValidatorStringResourceLoaderTest method formValidator.

@Test
public void formValidator() {
    tester.startPage(new FormValidatorPage());
    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("field1", "value1");
    formTester.setValue("field2", "value2");
    formTester.submit();
    tester.assertErrorMessages("Form Validator loaded OK");
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.Test)

Example 49 with FormTester

use of org.apache.wicket.util.tester.FormTester in project wicket by apache.

the class ValidatorStringResourceLoaderTest method interfaceValidator.

/**
 * Tests that resource bundle is properly loaded for implementations of
 * IValidator need to be wrapped in ValidatorAdapter
 *
 * https://issues.apache.org/jira/browse/WICKET-4379
 */
@Test
public void interfaceValidator() {
    tester.startPage(new ValidatorLoaderPage(new InterfaceValidator()));
    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("passwd", "anything");
    formTester.submit();
    tester.assertErrorMessages("Interface error loaded OK");
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.Test)

Example 50 with FormTester

use of org.apache.wicket.util.tester.FormTester in project syncope by apache.

the class PoliciesITCase method createPullPolicy.

private void createPullPolicy(final String description) {
    TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:2:link");
    TESTER.clickLink("body:content:tabbedPanel:panel:container:content:add");
    TESTER.assertComponent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer", Modal.class);
    Component modal = TESTER.getComponentFromLastRenderedPage("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer");
    FormTester formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:fields:0:field:textField", description);
    TESTER.executeAjaxEvent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:dialog:footer:inputs:0:submit", Constants.ON_CLICK);
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    closeCallBack(modal);
    Component component = findComponentByProp("description", "body:content:tabbedPanel:panel:container:content:" + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", description);
    assertNotNull(component);
    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink("body:content:tabbedPanel:panel:outerObjectsRepeater:1:outer:container:content:" + "togglePanelContainer:container:actions:actions:actionRepeater:0:action:action");
    TESTER.assertComponent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer", Modal.class);
    TESTER.assertModelValue("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form" + ":content:fields:0:field:textField", description);
    TESTER.executeAjaxEvent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:dialog:footer:buttons:0:button", Constants.ON_CLICK);
    assertNotNull(findComponentByProp("description", "body:content:tabbedPanel:panel:container:content:" + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", description));
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Component(org.apache.wicket.Component)

Aggregations

FormTester (org.apache.wicket.util.tester.FormTester)207 Test (org.junit.Test)122 Test (org.junit.jupiter.api.Test)54 Component (org.apache.wicket.Component)50 WicketTester (org.apache.wicket.util.tester.WicketTester)14 AbstractInitializedGuiIntegrationTest (com.evolveum.midpoint.web.AbstractInitializedGuiIntegrationTest)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 Test (org.testng.annotations.Test)9 List (java.util.List)8 ListModel (org.apache.wicket.model.util.ListModel)7 ArrayList (java.util.ArrayList)6 File (org.apache.wicket.util.file.File)4 OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)3 ButtonAjaxBehavior (com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)3 LocalDate (java.time.LocalDate)3 Cookie (javax.servlet.http.Cookie)3 Page (org.apache.wicket.Page)3 LocalDateConverter (org.apache.wicket.util.convert.converter.LocalDateConverter)3 Ignore (org.junit.Ignore)3 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)2