Search in sources :

Example 1 with ButtonAjaxBehavior

use of com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior in project openmeetings by apache.

the class TestLoginUI method showRegister.

private FormTester showRegister() {
    tester.startPage(SignInPage.class);
    tester.assertRenderedPage(SignInPage.class);
    ButtonAjaxBehavior b = getButtonBehavior("signin", "register");
    tester.executeBehavior(b);
    return tester.newFormTester(PATH_REGISTER);
}
Also used : ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)

Example 2 with ButtonAjaxBehavior

use of com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior in project openmeetings by apache.

the class TestInstall method testInstall.

@Test
public void testInstall() {
    InstallWizardPage page = tester.startPage(InstallWizardPage.class);
    tester.assertRenderedPage(InstallWizardPage.class);
    InstallWizard wiz = (InstallWizard) page.get(WIZARD_PATH);
    assertNull("Model should be null", wiz.getWizardModel().getActiveStep());
    // welcome step
    tester.executeBehavior((AbstractAjaxBehavior) page.getBehaviorById(0));
    assertNotNull("Model should NOT be null", wiz.getWizardModel().getActiveStep());
    ButtonAjaxBehavior prev = getButtonBehavior(tester, WIZARD_PATH, "PREV");
    // check enabled, add check for other buttons on other steps
    assertFalse("Prev button should be disabled", prev.getButton().isEnabled());
    ButtonAjaxBehavior next = getButtonBehavior(tester, WIZARD_PATH, "NEXT");
    ButtonAjaxBehavior finish = getButtonBehavior(tester, WIZARD_PATH, SUBMIT);
    // DB step
    tester.executeBehavior(next);
    FormTester wizardTester = tester.newFormTester("wizard:form");
    wizardTester.select("view:form:dbType", 1);
    checkErrors(tester, 0);
    // user step
    tester.executeBehavior(next);
    checkErrors(tester, 0);
    wizardTester.setValue("view:username", adminUsername);
    wizardTester.setValue("view:password", userpass);
    wizardTester.setValue("view:email", email);
    String[] tzIds = TimeZone.getAvailableIDs();
    wizardTester.select("view:timeZone", rnd.nextInt(tzIds.length));
    wizardTester.setValue("view:group", group);
    // cfg+smtp step
    tester.executeBehavior(next);
    checkErrors(tester, 0);
    wizardTester.setValue("view:smtpPort", "25");
    wizardTester.select("view:defaultLangId", 0);
    // converters step
    tester.executeBehavior(next);
    checkErrors(tester, 0);
    wizardTester.setValue("view:docDpi", "150");
    wizardTester.setValue("view:docQuality", "90");
    // crypt step
    tester.executeBehavior(next);
    // not checking errors
    if (countErrors(tester) > 0) {
        tester.cleanupFeedbackMessages();
        wizardTester.setValue("view:docDpi", "150");
        wizardTester.setValue("view:docQuality", "90");
        // skip errors
        tester.executeBehavior(next);
    }
    wizardTester.setValue("view:cryptClassName", SCryptImplementation.class.getName());
    // install step
    tester.executeBehavior(next);
    checkErrors(tester, 0);
    tester.executeBehavior(finish);
    checkErrors(tester, 0);
}
Also used : SCryptImplementation(org.apache.openmeetings.util.crypt.SCryptImplementation) FormTester(org.apache.wicket.util.tester.FormTester) ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior) AbstractSpringTest(org.apache.openmeetings.AbstractSpringTest) Test(org.junit.Test)

Example 3 with ButtonAjaxBehavior

use of com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior in project openmeetings by apache.

the class AbstractWicketTester method getButtonBehavior.

public static <T extends Serializable> ButtonAjaxBehavior getButtonBehavior(WicketTester tester, String path, String name) {
    Args.notNull(path, "path");
    Args.notNull(name, "name");
    @SuppressWarnings("unchecked") AbstractDialog<T> dialog = (AbstractDialog<T>) tester.getComponentFromLastRenderedPage(path);
    List<ButtonAjaxBehavior> bl = dialog.getBehaviors(ButtonAjaxBehavior.class);
    for (ButtonAjaxBehavior bb : bl) {
        if (name.equals(bb.getButton().getName())) {
            return bb;
        }
    }
    fail(String.format("Button '%s' not found for dialog '%s'", name, path));
    return null;
}
Also used : AbstractDialog(com.googlecode.wicket.jquery.ui.widget.dialog.AbstractDialog) ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)

Example 4 with ButtonAjaxBehavior

use of com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior in project openmeetings by apache.

the class TestCalendar method testEventCreate.

@Test
public void testEventCreate() throws OmException {
    testArea(regularUsername, p -> {
        Menu menu = (Menu) p.get(PATH_MENU);
        Assert.assertNotNull(menu);
        tester.getRequest().setParameter("hash", menu.getItemList().get(0).getItems().get(1).getId());
        tester.executeBehavior((AbstractAjaxBehavior) menu.getBehaviorById(0));
        tester.assertComponent(PATH_CHILD, CalendarPanel.class);
        CalendarPanel cal = (CalendarPanel) p.get(PATH_CHILD);
        tester.executeAllTimerBehaviors(cal);
        User u = userDao.getByLogin(regularUsername, User.Type.user, null);
        // test create month
        tester.getRequest().setParameter("allDay", String.valueOf(false));
        tester.getRequest().setParameter("startDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
        tester.getRequest().setParameter("endDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
        tester.getRequest().setParameter("viewName", CalendarView.month.name());
        // select-event
        tester.executeBehavior((AbstractAjaxBehavior) cal.get("form:calendar").getBehaviorById(0));
        FormTester appTester = tester.newFormTester(PATH_APPOINTMENT_DLG_FRM);
        // check inviteeType:groupContainer:groups is invisible for regular user
        String title = String.format("title%s", UUID.randomUUID());
        appTester.setValue("title", title);
        ButtonAjaxBehavior save = getButtonBehavior(PATH_APPOINTMENT_DLG, "save");
        tester.executeBehavior(save);
        List<Appointment> appts = appointmentDao.searchByTitle(u.getId(), title);
        assertEquals("Appointment should be created", 1, appts.size());
        assertEquals("Appointment should be created", title, appts.get(0).getTitle());
    });
}
Also used : CalendarPanel(org.apache.openmeetings.web.user.calendar.CalendarPanel) Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) User(org.apache.openmeetings.db.entity.user.User) FormTester(org.apache.wicket.util.tester.FormTester) Menu(com.googlecode.wicket.jquery.ui.widget.menu.Menu) ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior) Test(org.junit.Test)

Example 5 with ButtonAjaxBehavior

use of com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior in project openmeetings by apache.

the class TestLoginUI method performRegister.

private void performRegister(String uid, String lbl) throws ReflectiveOperationException, SecurityException {
    ButtonAjaxBehavior b1 = getButtonBehavior("signin", "register");
    tester.executeBehavior(b1);
    FormTester formTester = tester.newFormTester(PATH_REGISTER);
    formTester.setValue("login", getLogin(uid));
    formTester.setValue("email", getEmail(uid));
    formTester.setValue("firstName", String.format("first%s", uid));
    formTester.setValue("lastName", String.format("last%s", uid));
    formTester.setValue("password", userpass);
    formTester.setValue("confirmPassword", userpass);
    formTester.setValue("captcha:captchaText", getCaptcha("register:form:captcha:captcha"));
    formTester.submit("submit");
    checkErrors(0);
    tester.assertLabel("register:confirmRegistration:container:message", getEscapedString(lbl));
    ButtonAjaxBehavior b2 = getButtonBehavior("register:confirmRegistration", "OK");
    tester.executeBehavior(b2);
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)

Aggregations

ButtonAjaxBehavior (com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)5 FormTester (org.apache.wicket.util.tester.FormTester)3 Test (org.junit.Test)2 AbstractDialog (com.googlecode.wicket.jquery.ui.widget.dialog.AbstractDialog)1 Menu (com.googlecode.wicket.jquery.ui.widget.menu.Menu)1 AbstractSpringTest (org.apache.openmeetings.AbstractSpringTest)1 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)1 User (org.apache.openmeetings.db.entity.user.User)1 SCryptImplementation (org.apache.openmeetings.util.crypt.SCryptImplementation)1 CalendarPanel (org.apache.openmeetings.web.user.calendar.CalendarPanel)1