Search in sources :

Example 56 with FormTester

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

the class RealmsITCase method verifyPropagation.

@Test
public void verifyPropagation() {
    TESTER.executeAjaxEvent("body:content:realmChoicePanel:container:realms:btn", Constants.ON_CLICK);
    TESTER.executeAjaxEvent("body:content:realmChoicePanel:container:realms:dropdown-menu:buttons:2:button", Constants.ON_CLICK);
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:actions:actions:actionRepeater:1:action:action");
    TESTER.assertComponent("body:content:body:outerObjectsRepeater:0:outer", Modal.class);
    TESTER.assertModelValue("body:content:body:outerObjectsRepeater:0:outer:form:content:form:view:details:" + "container:generics:name:textField", "even");
    FormTester formTester = TESTER.newFormTester("body:content:body:outerObjectsRepeater:0:outer:form:content:form");
    formTester.setValue("view:details:container:resources:paletteField:recorder", "resource-ldap-orgunit");
    formTester.submit("buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    // ----------------------------------
    // Check for propagation results
    // ----------------------------------
    Component component = findComponentByProp("resource", "body:content:body:outerObjectsRepeater:0:outer:form:" + "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit");
    TESTER.clickLink(component.getPageRelativePath() + ":actions:actionRepeater:0:action:action");
    TESTER.assertLabel("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:0:value:oldAttribute:field-label", "__NAME__");
    TESTER.assertModelValue("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:0:value:oldAttribute:textField", null);
    TESTER.assertLabel("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:0:value:newAttribute:field-label", "__NAME__");
    TESTER.assertModelValue("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:0:value:newAttribute:textField", "ou=even,o=isp");
    TESTER.clickLink("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:back");
    assertNotNull(findComponentByProp("resource", "body:content:body:outerObjectsRepeater:0:outer:form:" + "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit"));
    // ----------------------------------
    TESTER.executeAjaxEvent("body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:" + "0:action:action", Constants.ON_CLICK);
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:actions:actions:actionRepeater:1:action:action");
    TESTER.assertComponent("body:content:body:outerObjectsRepeater:0:outer", Modal.class);
    TESTER.assertModelValue("body:content:body:outerObjectsRepeater:0:outer:form:content:form:view:details:" + "container:generics:name:textField", "even");
    formTester = TESTER.newFormTester("body:content:body:outerObjectsRepeater:0:outer:form:content:form");
    formTester.setValue("view:details:container:resources:paletteField:recorder", "");
    formTester.submit("buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    // ----------------------------------
    // Check for propagation results
    // ----------------------------------
    component = findComponentByProp("resource", "body:content:body:outerObjectsRepeater:0:outer:form:" + "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit");
    TESTER.clickLink(component.getPageRelativePath() + ":actions:actionRepeater:0:action:action");
    TESTER.assertLabel("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:4:value:oldAttribute:field-label", "ou");
    TESTER.assertModelValue("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:4:value:oldAttribute:textField", "even");
    TESTER.assertLabel("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:4:value:newAttribute:field-label", "ou");
    TESTER.assertModelValue("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:second:remoteObject:propView:4:value:newAttribute:textField", null);
    TESTER.clickLink("body:content:body:outerObjectsRepeater:0:outer:form:content:customResultBody:" + "secondLevelContainer:back");
    assertNotNull(findComponentByProp("resource", "body:content:body:outerObjectsRepeater:0:outer:form:" + "content:customResultBody:firstLevelContainer:first:container", "resource-ldap-orgunit"));
    // ----------------------------------
    TESTER.executeAjaxEvent("body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:" + "0:action:action", Constants.ON_CLICK);
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Component(org.apache.wicket.Component) Test(org.junit.jupiter.api.Test)

Example 57 with FormTester

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

the class RealmsITCase method addUserTemplate.

@Test
public void addUserTemplate() {
    TESTER.executeAjaxEvent("body:content:realmChoicePanel:container:realms:btn", Constants.ON_CLICK);
    TESTER.executeAjaxEvent("body:content:realmChoicePanel:container:realms:dropdown-menu:buttons:4:button", Constants.ON_CLICK);
    TESTER.assertLabel("body:content:realmChoicePanel:container:realm", "/odd");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:actions:actions:actionRepeater:2:action:action");
    TESTER.assertComponent("body:content:toggleTemplates", TogglePanel.class);
    FormTester formTester = TESTER.newFormTester("body:content:toggleTemplates:container:content:togglePanelContainer:templatesForm");
    formTester.setValue("type:dropDownChoiceField", "0");
    formTester.submit("changeit");
    TESTER.assertComponent("body:content:templateModal", Modal.class);
    formTester = TESTER.newFormTester("body:content:templateModal:form:content:form");
    formTester.setValue("view:username:textField", "'k' + firstname");
    formTester.submit("buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    TESTER.assertLabel("body:content:realmChoicePanel:container:realm", "/odd");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:actions:actions:actionRepeater:2:action:action");
    TESTER.assertComponent("body:content:toggleTemplates", TogglePanel.class);
    formTester = TESTER.newFormTester("body:content:toggleTemplates:container:content:togglePanelContainer:templatesForm");
    formTester.setValue("type:dropDownChoiceField", "0");
    formTester.submit("changeit");
    TESTER.assertComponent("body:content:templateModal", Modal.class);
    TESTER.assertModelValue("body:content:templateModal:form:content:form:view:username:textField", "'k' + firstname");
    formTester = TESTER.newFormTester("body:content:templateModal:form:content:form");
    formTester.setValue("view:username:textField", "");
    formTester.submit("buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.jupiter.api.Test)

Example 58 with FormTester

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

the class ReportsITCase method createReport.

private void createReport(final String name) {
    TESTER.clickLink("body:content:tabbedPanel:panel:firstLevelContainer:first:container:content:add");
    TESTER.assertComponent("body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer", Modal.class);
    FormTester formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:form:view:name:textField", name);
    formTester.setValue("content:form:view:template:dropDownChoiceField", "0");
    formTester.submit("content:form:buttons:next");
    TESTER.assertComponent("body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater" + ":0:outer:form:content:form:view:schedule:seconds:textField", TextField.class);
    formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.submit("content:form:buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    TESTER.clickLink("body:reportsLI:reports");
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester)

Example 59 with FormTester

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

the class SchemasITCase method createPlainSchema.

@Test
public void createPlainSchema() {
    browsingToPlainSchemas();
    TESTER.clickLink("body:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:container:content:add");
    TESTER.assertComponent("body:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer", Modal.class);
    final FormTester formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:" + "accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:details:form:key:textField", "zBoolean");
    formTester.setValue("content:details:form:type:dropDownChoiceField", "3");
    TESTER.clickLink("body:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:" + "outer:dialog:footer:inputs:0:submit");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    TESTER.assertRenderedPage(Types.class);
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.jupiter.api.Test)

Example 60 with FormTester

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

the class SchemasITCase method updatePlainSchema.

@Test
public void updatePlainSchema() {
    browsingToPlainSchemas();
    Component result = findComponentByProp(KEY, PLAIN_DATATABLE_PATH, "ctype");
    TESTER.assertLabel(result.getPageRelativePath() + ":cells:1:cell", "ctype");
    assertNotNull(result);
    TESTER.executeAjaxEvent(result.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink("body:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:outerObjectsRepeater:1:outer:" + "container:content:togglePanelContainer:container:actions:actions:actionRepeater:0:action:action");
    TESTER.assertComponent("body:content:tabbedPanel:" + "panel:accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer:" + "form:content:kindForm:kind:dropDownChoiceField", DropDownChoice.class);
    FormTester formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:details:form:multivalue:checkboxField", "true");
    TESTER.clickLink("body:content:tabbedPanel:panel:" + "accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer:dialog:footer:inputs:0:submit", true);
    TESTER.assertInfoMessages("Operation executed successfully");
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Component(org.apache.wicket.Component) Test(org.junit.jupiter.api.Test)

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