Search in sources :

Example 81 with FormTester

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

the class PoliciesITCase method createComposeDeletePullPolicy.

@Test
public void createComposeDeletePullPolicy() {
    final String description = "Pull Policy To Be Composed";
    createPullPolicy(description);
    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:2:action:action");
    TESTER.assertComponent("body:content:tabbedPanel:panel:outerObjectsRepeater:5:outer", Modal.class);
    Component modal = TESTER.getComponentFromLastRenderedPage("body:content:tabbedPanel:panel:outerObjectsRepeater:5:outer");
    FormTester formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:5:outer:form");
    TESTER.executeAjaxEvent("body:content:tabbedPanel:panel:outerObjectsRepeater:5:outer:form:content:" + "correlationRules:multiValueContainer:innerForm:content:panelPlus:add", Constants.ON_CLICK);
    component = findComponentById("body:content:tabbedPanel:panel:outerObjectsRepeater:5:outer:form:content:" + "correlationRules:multiValueContainer:innerForm:content:view:0:panel:rule", "dropDownChoiceField");
    assertNotNull(component);
    formTester.setValue(component, "0");
    TESTER.executeAjaxEvent(component, Constants.ON_CHANGE);
    formTester.setValue(component, "0");
    TESTER.clickLink("body:content:tabbedPanel:panel:outerObjectsRepeater:5:outer:dialog:footer:inputs:0:submit");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    closeCallBack(modal);
    deletePullPolicy(description);
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Component(org.apache.wicket.Component) Test(org.junit.jupiter.api.Test)

Example 82 with FormTester

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

the class PoliciesITCase method issueSYNCOPE1030.

@Test
public void issueSYNCOPE1030() {
    final String description = "SYNCOPE-1030";
    // Create account policy
    createAccountPolicy(description);
    composeDefaultAccountPolicy(description);
    // goto realms
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.assertRenderedPage(Realms.class);
    // edit root realm
    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);
    // set new account policy
    TESTER.assertLabel("body:content:body:outerObjectsRepeater:0:outer:form:content:form:view:details:container:" + "accountPolicy:field-label", "Account Policy");
    FormTester formTester = TESTER.newFormTester("body:content:body:outerObjectsRepeater:0:outer:form:content:form");
    formTester.select("view:details:container:accountPolicy:dropDownChoiceField", 0);
    formTester.submit("buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    TESTER.executeAjaxEvent("body:content:body:outerObjectsRepeater:0:outer:form:content:action:actionRepeater:0:action:action", Constants.ON_CLICK);
    // create user with a valid account name
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");
    Component component = findComponentByProp("username", "body:content:body:container:content:tabbedPanel:panel:searchResult:container:content:" + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
    assertNotNull(component);
    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:" + "1:outer:container:content:togglePanelContainer:container:actions:actions:actionRepeater:1:" + "action:action");
    TESTER.assertComponent("body:content:body:container:content:tabbedPanel:panel:searchResult:" + "outerObjectsRepeater:0:outer:form:content:form:view:username:textField", TextField.class);
    formTester = TESTER.newFormTester("body:content:body:container:content:tabbedPanel:panel:searchResult:" + "outerObjectsRepeater:0:outer:form:content:form");
    assertNotNull(formTester);
    formTester.submit("buttons:next");
    formTester = TESTER.newFormTester("body:content:body:container:content:tabbedPanel:panel:searchResult:" + "outerObjectsRepeater:0:outer:form:content:form");
    assertNotNull(formTester);
    formTester.submit("buttons:next");
    formTester = TESTER.newFormTester("body:content:body:container:content:tabbedPanel:panel:searchResult:" + "outerObjectsRepeater:0:outer:form:content:form");
    assertNotNull(formTester);
    formTester.submit("buttons:next");
    formTester = TESTER.newFormTester("body:content:body:container:content:tabbedPanel:panel:searchResult:" + "outerObjectsRepeater:0:outer:form:content:form");
    assertNotNull(formTester);
    formTester.setValue("view:plainSchemas:tabs:0:body:content:schemas:6:panel:textField", "rossini 1030");
    formTester.setValue("view:plainSchemas:tabs:0:body:content:schemas:14:panel:textField", "ross1030@apace.org");
    formTester.submit("buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:searchResult:" + "outerObjectsRepeater:0:outer:form:content:action:actionRepeater:0:action:action");
    component = findComponentByProp("username", "body:content:body:container:content:tabbedPanel:panel:searchResult:container:content:" + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini_clone");
    assertNotNull(component);
    // delete the new user
    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.getRequest().addParameter("confirm", "true");
    TESTER.clickLink(TESTER.getComponentFromLastRenderedPage("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:" + "1:outer:container:content:togglePanelContainer:container:actions:actions:actionRepeater:8:" + "action:action"));
    TESTER.executeAjaxEvent(TESTER.getComponentFromLastRenderedPage("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:" + "1:outer:container:content:togglePanelContainer:container:actions:actions:actionRepeater:8:" + "action:action"), Constants.ON_CLICK);
    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
    component = findComponentByProp("username", "body:content:body:container:content:tabbedPanel:panel:searchResult:container:content:" + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini_clone");
    assertNull(component);
    // delete default policy
    TESTER.clickLink("body:configurationLI:configurationUL:policiesLI:policies");
    TESTER.assertRenderedPage(Policies.class);
    deleteAccountPolicy(description);
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Component(org.apache.wicket.Component) Test(org.junit.jupiter.api.Test)

Example 83 with FormTester

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

the class TestLoginUI method testCompleteRegister.

// complex test
@Test
public void testCompleteRegister() throws ReflectiveOperationException, SecurityException {
    // set activation properties
    List<Configuration> cfgs = cfgDao.get(CONFIG_EMAIL_AT_REGISTER, CONFIG_EMAIL_VERIFICATION);
    for (Configuration c : cfgs) {
        c.setValueB(true);
        cfgDao.update(c, null);
    }
    try {
        tester.startPage(SignInPage.class);
        tester.assertRenderedPage(SignInPage.class);
        // number uid is used to prevent password validation errors
        String uid = String.valueOf(Math.abs(rnd.nextLong()));
        performRegister(uid, "warn.notverified");
        // activate
        User u = userDao.getByLogin(getLogin(uid), User.Type.user, null);
        assertNotNull(u);
        assertFalse(u.getRights().contains(User.Right.Login));
        tester.startPage(ActivatePage.class, new PageParameters().add(ActivatePage.ACTIVATION_PARAM, u.getActivatehash()));
        tester.assertRenderedPage(SignInPage.class);
        // check activated
        u = userDao.getByLogin(getLogin(uid), User.Type.user, null);
        assertNotNull(u);
        assertNull(u.getActivatehash());
        assertTrue(u.getRights().contains(User.Right.Login));
        checkLogin(getEmail(uid), userpass);
        // logout
        Locale loc = tester.getSession().getLocale();
        tester.getSession().invalidateNow();
        tester.getSession().setLocale(loc);
        // forget by 'random'
        performForget(uid);
        // reset password
        u = userDao.getByEmail(getEmail(uid));
        assertNotNull(u);
        assertNotNull(u.getResethash());
        tester.startPage(ResetPage.class, new PageParameters().add(ResetPage.RESET_PARAM, u.getResethash()));
        tester.assertRenderedPage(ResetPage.class);
        // check reset
        String passwd = "q1W@e3r4t5";
        FormTester resetTester = tester.newFormTester("resetPassword:form");
        resetTester.setValue("password", passwd);
        resetTester.setValue("confirmPassword", passwd);
        resetTester.submit("submit");
        checkErrors(0);
        tester.assertLabel("resetPassword:confirmReset:container:message", getEscapedString("332"));
    } finally {
        for (Configuration c : cfgs) {
            c.setValueB(false);
            cfgDao.update(c, null);
        }
    }
}
Also used : Locale(java.util.Locale) User(org.apache.openmeetings.db.entity.user.User) Configuration(org.apache.openmeetings.db.entity.basic.Configuration) FormTester(org.apache.wicket.util.tester.FormTester) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) Test(org.junit.Test)

Example 84 with FormTester

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

the class TestLoginUI method testEmptyLogin.

@Test
public void testEmptyLogin() {
    tester.startPage(SignInPage.class);
    tester.assertRenderedPage(SignInPage.class);
    FormTester formTester = tester.newFormTester("signin:signin");
    formTester.submit("submit");
    checkErrors(2);
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.Test)

Example 85 with FormTester

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

the class TestLoginUI method testEmptyRegister.

@Test
public void testEmptyRegister() {
    FormTester formTester = showRegister();
    formTester.submit("submit");
    checkErrors(8);
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) Test(org.junit.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