Java Code Examples for org.apache.wicket.util.tester.FormTester#setValue()

The following examples show how to use org.apache.wicket.util.tester.FormTester#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegistrationPageTest.java    From the-app with Apache License 2.0 6 votes vote down vote up
@Ignore("not ready yet") @Test
public void testSaveInvalid() {
    wicketTester.startPage(RegistrationPage.class);
    FormTester formTester = wicketTester.newFormTester("registration");
    formTester.setValue("firstname", "Max");
    formTester.setValue("lastname", "Müller");
    formTester.setValue("username", "Max.M");
    formTester.setValue("email", "[email protected]");
    formTester.setValue("password", "passsword123");
    formTester.setValue("repeatPassword", "password123");
    formTester.setValue("city", "München");
    formTester.setValue("street", "Lindwurmstr. 33");
    formTester.setValue("zip", "81369");

    formTester.submit();

    //verify(userService, times(0));
    wicketTester.assertErrorMessages("The entered Passwords do not match");
}
 
Example 2
Source File: AbstractTypesITCase.java    From syncope with Apache License 2.0 6 votes vote down vote up
protected void createPlainSchema(final String key) {
    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);

    FormTester formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:"
            + "accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:form:view:details:key:textField", key);
    formTester.setValue("content:form:view:details:type:dropDownChoiceField", "3");
    TESTER.executeAjaxEvent("body:content:tabbedPanel:panel:accordionPanel:tabs:0:"
            + "body:content:outerObjectsRepeater:0:outer:form:content:form:buttons:next", Constants.ON_CLICK);

    formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:"
            + "accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer:form");
    formTester.submit("content:form:buttons:finish");

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();
}
 
Example 3
Source File: RegistrationPageTest.java    From AppStash with Apache License 2.0 6 votes vote down vote up
@Test
public void testSaveInvalid() {
    wicketTester.startPage(RegistrationPage.class);
    FormTester formTester = wicketTester.newFormTester("registration");
    formTester.setValue("firstname", "Max");
    formTester.setValue("lastname", "Müller");
    formTester.setValue("username", "Max.M");
    formTester.setValue("email", "[email protected]");
    formTester.setValue("password", "passsword123");
    formTester.setValue("repeatPassword", "password123");
    formTester.setValue("city", "München");
    formTester.setValue("street", "Lindwurmstr. 33");
    formTester.setValue("zip", "81369");

    formTester.submit();

    //verify(userService, times(0));
    wicketTester.assertErrorMessages("The entered Passwords do not match");
}
 
Example 4
Source File: CustomerCreatePageIntTest.java    From wicket-spring-boot with Apache License 2.0 6 votes vote down vote up
@Test
public void assert_error_when_create_existing_customer(){
	getTester().startPage(CustomerCreatePage.class);
	getTester().assertRenderedPage(CustomerCreatePage.class);
	getTester().debugComponentTrees();
	FormTester formTester = getTester().newFormTester("form");
	
	//user is created via liquibase as initial data
	String usernameOfExistingUser = "frodo";
	formTester.setValue(borderPath("username"), usernameOfExistingUser);
	formTester.setValue(borderPath("firstname"), "newFirstname");
	formTester.setValue(borderPath("lastname"), "newLastname");
	formTester.setValue(borderPath("password"), "newPassword");
	formTester.submit("submit");
	
	getTester().assertErrorMessages("Username already exists!");
	
}
 
Example 5
Source File: SecurityQuestionsITCase.java    From syncope with Apache License 2.0 6 votes vote down vote up
private static void createSecurityQuestion(final String name) {
    TESTER.clickLink("body:content:tabbedPanel:panel:container:content:add");

    TESTER.assertComponent(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer", Modal.class);

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:securityQuestionDetailsPanel:container:form:content:textField",
            name);

    TESTER.clickLink(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:dialog:footer:inputs:0:submit");

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();

    TESTER.clickLink("body:configurationLI:configurationUL:securityLI:security");
    TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:3:link");
}
 
Example 6
Source File: RegistrationComponentTest.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Test
public void testRegistrationPanel() {
    DefaultRegistrationPanel panel = new DefaultRegistrationPanel("panel", new ODocumentWrapperModel<>(usersService.createUser()));
    tester.startComponentInPage(panel);

    FormTester formTester = tester.newFormTester("panel:form", false);
    formTester.setValue("firstName", testUser.getFirstName());
    formTester.setValue("lastName", testUser.getLastName());
    formTester.setValue("email", testUser.getEmail());
    formTester.setValue("password", testUser.getPassword());
    formTester.setValue("confirmPassword", testUser.getPassword());

    tester.clickLink("panel:form:registerButton:command", true);

    OrienteerUser user = panel.getModelObject();
    assertEquals(testUser.getFirstName(), user.getFirstName());
    assertEquals(testUser.getLastName(), user.getLastName());
    assertEquals(testUser.getEmail(), user.getEmail());
    assertEquals(testUser.getName(), user.getName());
    assertEquals(testUser.getPassword(), user.getPassword());
    assertEquals(testUser.getAccountStatus(), user.getAccountStatus());
}
 
Example 7
Source File: AbstractTypesITCase.java    From syncope with Apache License 2.0 6 votes vote down vote up
protected void createRelationshipType(final String name) {
    browsingToRelationshipType();

    TESTER.clickLink("body:content:tabbedPanel:panel:container:content:add");

    TESTER.assertComponent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer",
            Modal.class);

    final FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:relationshipTypeDetails:container:form:key:textField", name);
    formTester.setValue(
            "content:relationshipTypeDetails:container:form:description:textField", "test relationshipType");

    TESTER.clickLink(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:dialog:footer:inputs:0:submit");

    assertSuccessMessage();
    TESTER.clearFeedbackMessages();

    TESTER.assertRenderedPage(Types.class);
}
 
Example 8
Source File: SecurityQuestionsITCase.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Test
public void update() {
    createSecurityQuestion("What's your preferred color?");
    Component result = findComponentByProp("content", "body:content:tabbedPanel:panel:container:content:"
            + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
            "What's your preferred color?");

    assertNotNull(result);

    TESTER.executeAjaxEvent(result.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:1:outer:container:content:"
            + "togglePanelContainer:container:actions:actions:actionRepeater:0:action:action");

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:securityQuestionDetailsPanel:container:form:content:textField",
            "What's your preferred car?");

    TESTER.clickLink(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:dialog:footer:inputs:0:submit");

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();
}
 
Example 9
Source File: EnduserITCase.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Test
public void mustChangePassword() {
    UserTO mustchangepassword = userService.read("mustchangepassword");
    userService.update(new UserUR.Builder(mustchangepassword.getKey()).
            mustChangePassword(new BooleanReplacePatchItem.Builder().value(Boolean.TRUE).build()).build());

    TESTER.startPage(Login.class);
    doLogin("mustchangepassword", "password123");

    TESTER.assertRenderedPage(MustChangePassword.class);

    final String changePwdForm = "changePassword";
    TESTER.assertComponent(changePwdForm + ":username", TextField.class);
    TESTER.assertComponent(changePwdForm + ":password:passwordField", PasswordTextField.class);
    TESTER.
            assertComponent(changePwdForm + ":confirmPassword:passwordField", PasswordTextField.class);
    TESTER.assertModelValue(changePwdForm + ":username", "mustchangepassword");

    FormTester formTester = TESTER.newFormTester(changePwdForm);

    assertNotNull(formTester);
    // 1. set new password
    formTester.setValue(findComponentById(changePwdForm + ":password", "passwordField"), "password124");
    // 2. confirm password
    formTester.setValue(findComponentById(changePwdForm + ":confirmPassword", "passwordField"),
            "password124");
    // 3. submit form
    TESTER.executeAjaxEvent(changePwdForm + ":submit", Constants.ON_CLICK);

    TESTER.assertRenderedPage(Login.class);
    TESTER.assertComponent("login:username", TextField.class);

    TESTER.cleanupFeedbackMessages();

    doLogin("mustchangepassword", "password124");
    TESTER.assertComponent(WIZARD_FORM + ":view:username:textField", TextField.class);
}
 
Example 10
Source File: ReportsITCase.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Test
public void update() {
    createReport("updateReport");
    Component result = findComponentByProp(
            "name", "body:content:tabbedPanel:panel:firstLevelContainer:first:container:"
            + "content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "updateReport");

    assertNotNull(result);

    TESTER.executeAjaxEvent(result.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:1:outer:"
            + "container:content:togglePanelContainer:container:actions:actions:actionRepeater:0:action:action");

    TESTER.assertModelValue(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:"
            + "0:outer:dialog:header:header-label", "Edit Report updateReport");

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:form:view:template:dropDownChoiceField", "1");

    formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.submit("content:form:buttons:finish");

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();

    delete("updateReport");
}
 
Example 11
Source File: RestorePasswordComponentTest.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
private void fillAndSubmitRestorePasswordPanel(String password) {
    FormTester formTester = tester.newFormTester("container:restorePanel:form");
    formTester.setValue("password", password);
    formTester.setValue("confirmPassword", password);

    tester.clickLink("container:restorePanel:form:restoreButton:command", true);

    tester.assertVisible("container:restoreSuccessMessage");
    tester.assertInvisible("container:restorePanel");
}
 
Example 12
Source File: OrienteerMainTest.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Before
public void performLogin()
{
	tester.startPage(SchemaPage.class);
	if(tester.getLastRenderedPage() instanceof LoginPage)
	{
		FormTester formTester = tester.newFormTester("container:loginPanel:form");
		IOrientDbSettings settings = ((OrienteerWebApplication)tester.getApplication()).getOrientDbSettings();
           formTester.setValue("username", settings.getAdminUserName());
           formTester.setValue("password", settings.getAdminPassword());
           tester.clickLink("container:loginPanel:form:loginButtonsPanel:loginButton:command", true);
	}
	tester.assertRenderedPage(SchemaPage.class);
}
 
Example 13
Source File: WicketBaseIntTest.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
private void login(String username, String password) {
	SecureWebSession session = (SecureWebSession) tester.getSession();
	session.signOut();
	tester.startPage(LoginPage.class);
	FormTester formTester = tester.newFormTester("loginForm");
	formTester.setValue("username", username);
	formTester.setValue("password", password);
	formTester.submit();
	tester.assertNoErrorMessage();
	tester.assertRenderedPage(tester.getApplication().getHomePage());
}
 
Example 14
Source File: TestLoginUI.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
private void checkLogin(String login, String pass) {
	FormTester formTester = tester.newFormTester("signin:signin");
	formTester.setValue("credentials:login", login);
	formTester.setValue("credentials:pass", pass);
	formTester.submit("submit");

	tester.assertNoErrorMessage();
	tester.assertRenderedPage(MainPage.class);
	WebSession ws = (WebSession)tester.getSession();
	assertTrue(ws.isSignedIn(), "Login should be successful");
}
 
Example 15
Source File: TestInstall.java    From openmeetings with Apache License 2.0 4 votes vote down vote up
@Test
public void testInstall() {
	InstallWizardPage page = tester.startPage(InstallWizardPage.class);
	tester.assertRenderedPage(InstallWizardPage.class);
	InstallWizard wiz = (InstallWizard)page.get(WIZARD_PATH);
	assertFalse(wiz.isEnabled(), "Wizard should be disabled");
	AjaxClientInfoBehavior clientInfo = page.getBehaviors(AjaxClientInfoBehavior.class).get(0);
	tester.executeBehavior(clientInfo);
	assertTrue(wiz.isEnabled(), "Wizard should be enabled");
	assertNotNull(wiz.getWizardModel().getActiveStep(), "Model should NOT be null");

	WizardButton prev = getWizardButton("previous");
	//check enabled, add check for other buttons on other steps
	assertFalse(prev.isEnabled(), "Prev button should be disabled");
	WizardButton next = getWizardButton("next");
	AbstractAjaxBehavior finish = (AbstractAjaxBehavior)getWizardButton("finish").getBehaviorById(0);
	FormTester wizardTester = tester.newFormTester(FORM_PATH);
	wizardTester.submit(next);
	wizardTester = tester.newFormTester(FORM_PATH);
	wizardTester.select("view:form:dbType", 1);
	checkErrors(tester, 0);
	wizardTester.submit(next); //user step
	checkErrors(tester, 0);
	wizardTester = tester.newFormTester(FORM_PATH);
	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);
	wizardTester.submit(next); //cfg+smtp step
	checkErrors(tester, 0);
	wizardTester = tester.newFormTester(FORM_PATH);
	wizardTester.setValue("view:smtpPort", "25");
	wizardTester.select("view:defaultLangId", 0);
	wizardTester.submit(next); //converters step
	checkErrors(tester, 0);
	wizardTester = tester.newFormTester(FORM_PATH);
	wizardTester.setValue("view:docDpi", "150");
	wizardTester.setValue("view:docQuality", "90");
	wizardTester.submit(next); //crypt step
	// not checking errors
	if (countErrors(tester) > 0) {
		tester.cleanupFeedbackMessages();
		wizardTester = tester.newFormTester(FORM_PATH);
		wizardTester.setValue("view:docDpi", "150");
		wizardTester.setValue("view:docQuality", "90");
		wizardTester.submit(next); //skip errors
	}
	wizardTester = tester.newFormTester(FORM_PATH);
	wizardTester.setValue("view:cryptClassName", SCryptImplementation.class.getName());
	wizardTester.submit(next); //install step
	checkErrors(tester, 0);
	tester.executeBehavior(finish);
	checkErrors(tester, 0);
}
 
Example 16
Source File: LinkedAccountsITCase.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Test
public void createLinkedAccountAndMergeWithUser() {
    // Locate and select first user
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    Component verdiUserComponent = findComponentByProp("username", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "verdi");
    assertNotNull(verdiUserComponent);
    TESTER.executeAjaxEvent(verdiUserComponent.getPageRelativePath(), Constants.ON_CLICK);

    // Click action menu to bring up merge window
    TESTER.clickLink(TAB_PANEL + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
            + "actions:actions:actionRepeater:6:action:action");
    // Search for user
    TESTER.executeAjaxEvent(USER_SEARCH_FORM + "content:panelPlus:add", Constants.ON_CLICK);
    FormTester formTester = TESTER.newFormTester(USER_SEARCH_FORM);

    DropDownChoice<?> type = (DropDownChoice<?>) TESTER.getComponentFromLastRenderedPage(USER_SEARCH_FORM
            + "content:view:0:panel:container:type:dropDownChoiceField");
    TESTER.executeAjaxEvent(USER_SEARCH_FORM + "content:view:0:panel:container:type:dropDownChoiceField",
            Constants.ON_CHANGE);
    type.setModelValue(new String[] { "ATTRIBUTE" });
    type.setDefaultModelObject(SearchClause.Type.ATTRIBUTE);

    formTester.setValue("content:view:0:panel:container:property:textField", "username");
    TESTER.executeAjaxEvent(formTester.getForm().
            get("content:view:0:panel:container:property:textField"), Constants.ON_KEYDOWN);
    formTester.setValue("content:view:0:panel:container:value:textField", user.getUsername());
    TESTER.executeAjaxEvent(formTester.getForm().
            get("content:view:0:panel:container:value:textField"), Constants.ON_KEYDOWN);

    TESTER.cleanupFeedbackMessages();
    Component searchButton = formTester.getForm().
            get("content:view:0:panel:container:operatorContainer:operator:search");
    TESTER.clickLink(searchButton);
    TESTER.executeAjaxEvent(searchButton.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.assertNoErrorMessage();

    // Locate result in data table
    Component comp = findComponentByProp("username", TAB_PANEL + SEARCH_PANEL + RESULT_DATA_TABLE, user.
            getUsername());
    TESTER.executeAjaxEvent(comp.getPageRelativePath(), Constants.ON_CLICK);

    // Select user
    TESTER.clickLink(TAB_PANEL + SEARCH_PANEL + SELECT_USER_ACTION);

    // move onto the next panel
    TESTER.getComponentFromLastRenderedPage(TAB_PANEL + FORM + "view").setEnabled(false);
    formTester = TESTER.newFormTester(TAB_PANEL + FORM);
    formTester.submit("buttons:next");

    // Select a resource
    comp = findComponentByProp("key", TAB_PANEL + FORM + RESOURCES_DATA_TABLE + "body:rows", "resource-ldap");
    assertNotNull(comp);
    TESTER.executeAjaxEvent(comp.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(TAB_PANEL + FORM + SELECT_RESOURCE_ACTION);

    // move onto the next panel
    TESTER.getComponentFromLastRenderedPage(TAB_PANEL + FORM + "view").setEnabled(false);
    formTester = TESTER.newFormTester(TAB_PANEL + FORM);
    formTester.submit("buttons:next");

    // Finish merge
    TESTER.getComponentFromLastRenderedPage(TAB_PANEL + FORM + "view").setEnabled(false);
    formTester = TESTER.newFormTester(TAB_PANEL + FORM);
    formTester.submit("buttons:finish");

    UserService userService = SyncopeConsoleSession.get().getService(UserService.class);

    // User must have been deleted after the merge
    try {
        userService.read(user.getKey());
        fail("User must have been deleted; expect an exception here");
    } catch (final SyncopeClientException e) {
        if (e.getType() != ClientExceptionType.NotFound) {
            fail(e.getMessage());
        }
    }
    // User must include merged accounts now
    UserTO verdi = userService.read("verdi");
    assertFalse(verdi.getLinkedAccounts().isEmpty());
}
 
Example 17
Source File: PoliciesITCase.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Test
public void createUpdateDeletePullPolicy() {
    final String description = "Pull Policy To Be Updated";
    createPullPolicy(description);

    Component component = findComponentByProp("description",
            "body:content:tabbedPanel:panel:container:content:"
            + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", description);

    Component modal = TESTER.getComponentFromLastRenderedPage(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer");

    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);

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:fields:0:field:textField", description + '2');

    TESTER.clickLink(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:dialog:footer:inputs:0:submit");

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();

    closeCallBack(modal);

    component = findComponentByProp("description", "body:content:tabbedPanel:panel:container:content:"
            + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", description + '2');

    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 + '2');

    TESTER.executeAjaxEvent(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:dialog:footer:buttons:0:button",
            Constants.ON_CLICK);

    deletePullPolicy(description + '2');
}
 
Example 18
Source File: UsersITCase.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Test
public void changePassword() {
    TESTER.cleanupFeedbackMessages();

    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    Component component = findComponentByProp("username", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "vivaldi");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(TAB_PANEL
            + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
            + "actions:actions:actionRepeater:2:action:action");

    TESTER.assertLabel(TAB_PANEL + "outerObjectsRepeater:3:outer:form:content:status:resources:"
            + "firstLevelContainer:first:container:content:group:beans:0:fields:0:field", "syncope");

    FormTester formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:3:outer:form");
    formTester.setValue("content:passwordPanel:passwordInnerForm:password:passwordField", "Password345");
    formTester.setValue("content:passwordPanel:passwordInnerForm:confirmPassword:passwordField", "Password345");
    formTester.select("content:status:resources:firstLevelContainer:first:container:content:group", 0);

    TESTER.executeAjaxEvent(
            TAB_PANEL + "outerObjectsRepeater:3:outer:dialog:footer:inputs:0:submit", Constants.ON_CLICK);

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();

    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    component = findComponentByProp("username", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "vivaldi");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(TAB_PANEL
            + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
            + "actions:actions:actionRepeater:2:action:action");

    TESTER.assertLabel(TAB_PANEL + "outerObjectsRepeater:3:outer:form:content:status:resources:"
            + "firstLevelContainer:first:container:content:group:beans:0:fields:0:field", "syncope");

    formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:3:outer:form");
    formTester.setValue("content:passwordPanel:passwordInnerForm:password:passwordField", "Password123");
    formTester.setValue("content:passwordPanel:passwordInnerForm:confirmPassword:passwordField", "Password123");
    formTester.select("content:status:resources:firstLevelContainer:first:container:content:group", 0);

    TESTER.executeAjaxEvent(
            TAB_PANEL + "outerObjectsRepeater:3:outer:dialog:footer:inputs:0:submit", Constants.ON_CLICK);

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();
}
 
Example 19
Source File: EnduserITCase.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Test
public void selfCreate() {
    String username = "testUser";

    TESTER.startPage(Login.class);
    TESTER.assertRenderedPage(Login.class);

    TESTER.clickLink("self-registration");

    TESTER.assertComponent(WIZARD_FORM + ":view:username:textField", TextField.class);
    FormTester formTester = TESTER.newFormTester(WIZARD_FORM);
    assertNotNull(formTester);
    formTester.setValue("view:username:textField", username);
    TESTER.executeAjaxEvent(WIZARD_FORM + ":buttons:next", Constants.ON_CLICK);

    // check required field is correctly set
    TESTER.assertNoInfoMessage();
    TESTER.assertNoErrorMessage();

    TESTER.assertComponent(WIZARD_FORM + ":view:auxClasses:paletteField:choices", Choices.class);
    TESTER.executeAjaxEvent(WIZARD_FORM + ":buttons:next", Constants.ON_CLICK);

    TESTER.assertComponent(WIZARD_FORM + ":view:groupsContainer:groups:form:filter:textField",
            TextField.class);
    TESTER.executeAjaxEvent(WIZARD_FORM + ":buttons:next", Constants.ON_CLICK);

    TESTER.assertComponent(findComponentByMarkupId(
            WIZARD_FORM + ":view:plainSchemas:tabs:0:body:content:schemas", "fullname").getPageRelativePath()
            + ":textField",
            TextField.class);
    TESTER.assertComponent(findComponentByMarkupId(
            WIZARD_FORM + ":view:plainSchemas:tabs:0:body:content:schemas", "surname").getPageRelativePath()
            + ":textField",
            TextField.class);
    TESTER.assertComponent(findComponentByMarkupId(
            WIZARD_FORM + ":view:plainSchemas:tabs:0:body:content:schemas", "userId").getPageRelativePath()
            + ":textField",
            TextField.class);

    formTester = TESTER.newFormTester(WIZARD_FORM);
    assertNotNull(formTester);
    formTester.setValue(findComponentByMarkupId(WIZARD_FORM
            + ":view:plainSchemas:tabs:0:body:content:schemas",
            "fullname").getPageRelativePath().replace(WIZARD_FORM + ':', StringUtils.EMPTY) + ":textField",
            "User fullname");
    formTester.setValue(findComponentByMarkupId(WIZARD_FORM
            + ":view:plainSchemas:tabs:0:body:content:schemas",
            "surname").getPageRelativePath().replace(WIZARD_FORM + ':', StringUtils.EMPTY) + ":textField",
            "User surname");
    formTester.setValue(
            findComponentByMarkupId(WIZARD_FORM + ":view:plainSchemas:tabs:0:body:content:schemas", "userId").
                    getPageRelativePath().replace(WIZARD_FORM + ':', StringUtils.EMPTY) + ":textField",
            "[email protected]");

    TESTER.executeAjaxEvent(WIZARD_FORM + ":buttons:next", Constants.ON_CLICK);

    // check required fields were correctly set
    TESTER.assertNoInfoMessage();
    TESTER.assertNoErrorMessage();

    TESTER.assertComponent(WIZARD_FORM
            + ":view:derSchemas:tabs:0:body:content:schemas:0:panel:textField",
            TextField.class);

    TESTER.executeAjaxEvent(WIZARD_FORM + ":buttons:next", Constants.ON_CLICK);
    TESTER.assertComponent(WIZARD_FORM + ":view:virSchemas:tabs:0:body:content:schemas:0:panel:"
            + "multiValueContainer:innerForm:content:field-label",
            Label.class);

    TESTER.executeAjaxEvent(WIZARD_FORM + ":buttons:next", Constants.ON_CLICK);
    TESTER.assertComponent(WIZARD_FORM + ":view:resources:paletteField:choices", Choices.class);

    TESTER.executeAjaxEvent(WIZARD_FORM + ":buttons:finish", Constants.ON_CLICK);

    TESTER.assertRenderedPage(Login.class);
    TESTER.assertComponent("login:username", TextField.class);

    assertFalse(userService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
            fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo(username).query()).
            build()).getResult().isEmpty());

    assertNotNull(userService.read(username));

    TESTER.cleanupFeedbackMessages();

    // cleanup
    userService.delete(username);
}
 
Example 20
Source File: PoliciesITCase.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Test
public void createComposeDeletePasswordPolicy() {
    final String description = "Password Policy To Be Composed";
    createPasswordPolicy(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:4:outer",
            Modal.class);

    Component modal = TESTER.getComponentFromLastRenderedPage(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:4:outer");

    TESTER.clickLink(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:4:outer:form:content:container:content:add");

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:4:"
            + "outer:form:content:container:content:wizard:form");
    formTester.setValue("view:rule:dropDownChoiceField", "0");
    formTester.submit("buttons:next");

    formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:4:"
            + "outer:form:content:container:content:wizard:form");
    formTester.submit("buttons:finish");

    assertSuccessMessage();
    TESTER.cleanupFeedbackMessages();

    TESTER.clickLink(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:4:outer:form:content:container:content:utility");

    closeCallBack(modal);

    deletePasswordPolicy(description);
}