This is an automated email from the ASF dual-hosted git repository.
andreapatricelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 6edb4b0 [SYNCOPE-1421] enabled enduser UI tests, fit with all other
IT tests
6edb4b0 is described below
commit 6edb4b036eaf77c550e9836fb7da5e0a66e2654a
Author: Andrea Patricelli <[email protected]>
AuthorDate: Thu Jun 13 14:36:36 2019 +0200
[SYNCOPE-1421] enabled enduser UI tests, fit with all other IT tests
---
.../client/enduser/panels/SelfPwdResetPanel.java | 22 ++-
.../client/enduser/wizards/any/PlainAttrs.java | 3 +-
.../client/enduser/panels/SelfPwdResetPanel.html | 5 +-
.../syncope/fit/enduser/AbstractEnduserITCase.java | 45 +++++
.../fit/enduser/SelfRegistrationITCase.java | 190 ++++++++++++++++-----
.../java/org/apache/syncope/fit/ui/UtilityUIT.java | 10 ++
6 files changed, 227 insertions(+), 48 deletions(-)
diff --git
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.java
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.java
index 8e8cb2d..bdec2a5 100644
---
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.java
+++
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.java
@@ -28,7 +28,6 @@ import
org.apache.syncope.client.enduser.pages.BaseEnduserWebPage;
import org.apache.syncope.client.enduser.wizards.any.CaptchaPanel;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.DomainDropDown;
-import
org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -77,12 +76,12 @@ public class SelfPwdResetPanel extends Panel implements
IEventSource {
private String usernameText;
+ private String securityAnswerText;
+
private final TextField<String> securityQuestion;
private final CaptchaPanel<Void> captcha;
- protected final Model<String> securityAnswerModel = new Model<>();
-
public SelfPwdResetPanel(final String id, final PageReference pageRef) {
super(id);
@@ -137,10 +136,17 @@ public class SelfPwdResetPanel extends Panel implements
IEventSource {
};
add(reloadLink);
- AjaxTextFieldPanel securityAnswer =
- new AjaxTextFieldPanel("securityAnswer", "securityAnswer",
securityAnswerModel);
- securityAnswer.setOutputMarkupId(true);
- securityAnswer.setOutputMarkupPlaceholderTag(true);
+ TextField<String> securityAnswer =
+ new TextField<>("securityAnswer", new PropertyModel<>(this,
"securityAnswerText"), String.class);
+ securityAnswer.add(new
AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // do nothing
+ }
+ });
securityAnswer.setRequired(true);
add(securityAnswer);
@@ -166,7 +172,7 @@ public class SelfPwdResetPanel extends Panel implements
IEventSource {
} else {
try {
SyncopeEnduserSession.get().getService(UserSelfService.class).
- requestPasswordReset(usernameText,
securityAnswerModel.getObject());
+ requestPasswordReset(usernameText,
securityAnswerText);
final PageParameters parameters = new PageParameters();
parameters.add(Constants.NOTIFICATION_MSG_PARAM,
getString("self.pwd.reset.success"));
setResponsePage(getApplication().getHomePage(),
parameters);
diff --git
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java
index d0189fc..8481591 100644
---
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java
+++
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java
@@ -377,7 +377,8 @@ public class PlainAttrs extends
AbstractAttrs<PlainSchemaTO> {
}
panel.setReadOnly(readOnly);
-
+ panel.setMarkupId(StringUtils.isBlank(groupName) ? schemaTO.getKey() :
groupName + "." + schemaTO.getKey());
+
return panel;
}
diff --git
a/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.html
b/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.html
index 08c3d35..a1c884b 100644
---
a/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.html
+++
b/client/idrepo/enduser/src/main/resources/org/apache/syncope/client/enduser/panels/SelfPwdResetPanel.html
@@ -41,7 +41,10 @@ under the License.
</wicket:message><a wicket:id="reloadLink"> <wicket:message
key="reload"></wicket:message></a>)</div>
</div>
<div class="form-group input-md">
- <span wicket:id="securityAnswer">[SECURITY ANSWER]</span>
+ <label for="securityAnswer"><wicket:message
key="securityAnswer"/></label>
+ <input id="securityAnswer" type="text" wicket:id="securityAnswer"
class="form-control"
+ wicket:message="placeholder:securityAnswer"
+ autofocus="autofocus" />
</div>
<div class="form-group input-md">
<span wicket:id="captchaPanel">[CAPTCHA]</span>
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/AbstractEnduserITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/AbstractEnduserITCase.java
index cc0d2dd..b40a68b 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/AbstractEnduserITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/AbstractEnduserITCase.java
@@ -24,8 +24,10 @@ import
com.giffing.wicket.spring.boot.starter.app.classscanner.candidates.Wicket
import
com.giffing.wicket.spring.boot.starter.configuration.extensions.core.settings.general.GeneralSettingsProperties;
import
com.giffing.wicket.spring.boot.starter.configuration.extensions.external.spring.boot.actuator.WicketEndpointRepositoryDefault;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.syncope.client.enduser.SyncopeWebApplication;
import org.apache.syncope.client.enduser.commons.PreviewUtils;
import
org.apache.syncope.client.enduser.init.ClassPathScanImplementationLookup;
@@ -41,6 +43,10 @@ import
org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import
org.apache.syncope.common.keymaster.client.self.SelfKeymasterClientContext;
+import org.apache.syncope.common.lib.Attr;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.request.UserCR;
+import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
import org.apache.syncope.common.rest.api.service.UserService;
import org.apache.syncope.fit.ui.AbstractUITCase;
import org.apache.syncope.fit.ui.UtilityUIT;
@@ -56,6 +62,8 @@ public abstract class AbstractEnduserITCase extends
AbstractUITCase {
protected static UserService userService;
+ protected static SecurityQuestionService securityQuestionService;
+
protected static UtilityUIT UTILITY_UI;
@ImportAutoConfiguration(classes = { SelfKeymasterClientContext.class })
@@ -135,6 +143,39 @@ public abstract class AbstractEnduserITCase extends
AbstractUITCase {
adminClient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD);
userService = adminClient.getService(UserService.class);
+ securityQuestionService =
adminClient.getService(SecurityQuestionService.class);
+ // create test user for must change password
+ userService.create(new UserCR.Builder(SyncopeConstants.ROOT_REALM,
"mustchangepassword").
+ password("password123").
+ mustChangePassword(true).
+ plainAttr(attr("fullname", "[email protected]")).
+ plainAttr(attr("firstname", "[email protected]")).
+ plainAttr(attr("surname", "surname")).
+ plainAttr(attr("ctype", "a type")).
+ plainAttr(attr("userId", "[email protected]")).
+ plainAttr(attr("email", "[email protected]")).
+ plainAttr(attr("loginDate",
DateFormatUtils.ISO_8601_EXTENDED_DATETIME_FORMAT.format(new Date()))).
+ build());
+ // create test user for self password reset
+ userService.create(new UserCR.Builder(SyncopeConstants.ROOT_REALM,
"selfpwdreset").
+ password("password123").
+ plainAttr(attr("fullname", "[email protected]")).
+ plainAttr(attr("firstname", "[email protected]")).
+ plainAttr(attr("surname", "surname")).
+ plainAttr(attr("ctype", "a type")).
+ plainAttr(attr("userId", "[email protected]")).
+ plainAttr(attr("email", "[email protected]")).
+ plainAttr(attr("loginDate",
DateFormatUtils.ISO_8601_EXTENDED_DATETIME_FORMAT.format(new Date()))).
+ build());
+ // create test user for self update
+ userService.create(new UserCR.Builder(SyncopeConstants.ROOT_REALM,
"selfupdate").
+ password("password123").
+ plainAttr(attr("fullname", "[email protected]")).
+ plainAttr(attr("firstname", "[email protected]")).
+ plainAttr(attr("surname", "surname")).
+ plainAttr(attr("ctype", "a type")).
+ plainAttr(attr("userId", "[email protected]")).
+ build());
}
protected void doLogin(final String user, final String passwd) {
@@ -146,4 +187,8 @@ public abstract class AbstractEnduserITCase extends
AbstractUITCase {
formTester.setValue("password", passwd);
formTester.submit("submit");
}
+
+ protected static Attr attr(final String schema, final String value) {
+ return new Attr.Builder(schema).value(value).build();
+ }
}
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/SelfRegistrationITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/SelfRegistrationITCase.java
index 7c8b009..bfa2ff6 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/SelfRegistrationITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/enduser/SelfRegistrationITCase.java
@@ -18,23 +18,29 @@
*/
package org.apache.syncope.fit.enduser;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
+import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.enduser.pages.Login;
+import org.apache.syncope.client.enduser.pages.SelfPasswordReset;
+import org.apache.syncope.client.enduser.pages.MustChangePassword;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.request.BooleanReplacePatchItem;
+import org.apache.syncope.common.lib.request.StringReplacePatchItem;
+import org.apache.syncope.common.lib.request.UserUR;
+import org.apache.syncope.common.lib.to.SecurityQuestionTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.PatchOperation;
import org.apache.syncope.common.rest.api.beans.AnyQuery;
import org.apache.wicket.extensions.markup.html.form.palette.component.Choices;
import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.util.tester.FormTester;
-import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-@Disabled("WIP")
public class SelfRegistrationITCase extends AbstractEnduserITCase {
private static final String WIZARD_FORM = "body:wizard:form";
@@ -50,7 +56,7 @@ public class SelfRegistrationITCase extends
AbstractEnduserITCase {
UTILITY_UI.getTester().assertComponent(WIZARD_FORM +
":view:username:textField", TextField.class);
FormTester formTester =
UTILITY_UI.getTester().newFormTester(WIZARD_FORM);
- assertNotNull(formTester);
+ Assertions.assertNotNull(formTester);
formTester.setValue("view:username:textField", username);
UTILITY_UI.getTester().executeAjaxEvent(WIZARD_FORM + ":buttons:next",
Constants.ON_CLICK);
@@ -65,23 +71,32 @@ public class SelfRegistrationITCase extends
AbstractEnduserITCase {
TextField.class);
UTILITY_UI.getTester().executeAjaxEvent(WIZARD_FORM + ":buttons:next",
Constants.ON_CLICK);
- UTILITY_UI.getTester().assertComponent(WIZARD_FORM
- +
":view:plainSchemas:tabs:0:body:content:schemas:6:panel:textField",
+
UTILITY_UI.getTester().assertComponent(UTILITY_UI.findComponentByMarkupId(
+ WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas",
"fullname").getPageRelativePath()
+ + ":textField",
TextField.class);
- UTILITY_UI.getTester().assertComponent(WIZARD_FORM
- +
":view:plainSchemas:tabs:0:body:content:schemas:12:panel:textField",
+
UTILITY_UI.getTester().assertComponent(UTILITY_UI.findComponentByMarkupId(
+ WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas",
"surname").getPageRelativePath()
+ + ":textField",
TextField.class);
- UTILITY_UI.getTester().assertComponent(WIZARD_FORM
- +
":view:plainSchemas:tabs:0:body:content:schemas:14:panel:textField",
+
UTILITY_UI.getTester().assertComponent(UTILITY_UI.findComponentByMarkupId(
+ WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas",
"userId").getPageRelativePath()
+ + ":textField",
TextField.class);
formTester = UTILITY_UI.getTester().newFormTester(WIZARD_FORM);
- assertNotNull(formTester);
-
formTester.setValue("view:plainSchemas:tabs:0:body:content:schemas:6:panel:textField",
+ Assertions.assertNotNull(formTester);
+ formTester.setValue(UTILITY_UI.findComponentByMarkupId(WIZARD_FORM
+ + ":view:plainSchemas:tabs:0:body:content:schemas",
+ "fullname").getPageRelativePath().replace(WIZARD_FORM + ":",
StringUtils.EMPTY) + ":textField",
"User fullname");
-
formTester.setValue("view:plainSchemas:tabs:0:body:content:schemas:12:panel:textField",
+ formTester.setValue(UTILITY_UI.findComponentByMarkupId(WIZARD_FORM
+ + ":view:plainSchemas:tabs:0:body:content:schemas",
+ "surname").getPageRelativePath().replace(WIZARD_FORM + ":",
StringUtils.EMPTY) + ":textField",
"User surname");
-
formTester.setValue("view:plainSchemas:tabs:0:body:content:schemas:14:panel:textField",
+ formTester.setValue(UTILITY_UI.
+ findComponentByMarkupId(WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas", "userId").
+ getPageRelativePath().replace(WIZARD_FORM + ":",
StringUtils.EMPTY) + ":textField",
"[email protected]");
UTILITY_UI.getTester().executeAjaxEvent(WIZARD_FORM + ":buttons:next",
Constants.ON_CLICK);
@@ -107,30 +122,125 @@ public class SelfRegistrationITCase extends
AbstractEnduserITCase {
UTILITY_UI.getTester().assertRenderedPage(Login.class);
UTILITY_UI.getTester().assertComponent("login:username",
TextField.class);
- assertFalse(userService.search(new
AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+ Assertions.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));
+
+ Assertions.assertNotNull(userService.read(username));
UTILITY_UI.getTester().cleanupFeedbackMessages();
+
+ // cleanup
+ userService.delete(username);
}
@Test
public void selfPasswordReset() {
+ SecurityQuestionTO question =
securityQuestionService.read("887028ea-66fc-41e7-b397-620d7ea6dfbb");
+ UserTO selfpwdreset = userService.read("selfpwdreset");
+ userService.update(new UserUR.Builder(selfpwdreset.getKey())
+ .securityQuestion(new StringReplacePatchItem.Builder()
+ .operation(PatchOperation.ADD_REPLACE)
+ .value(question.getKey())
+ .build())
+ .securityAnswer(new StringReplacePatchItem.Builder()
+ .operation(PatchOperation.ADD_REPLACE)
+ .value("ananswer")
+ .build())
+ .build());
+
+ final String pwdResetForm = "body:content:selfPwdResetForm";
UTILITY_UI.getTester().startPage(Login.class);
UTILITY_UI.getTester().assertRenderedPage(Login.class);
UTILITY_UI.getTester().clickLink("self-pwd-reset");
+
+ UTILITY_UI.getTester().assertRenderedPage(SelfPasswordReset.class);
+
+ UTILITY_UI.getTester().assertComponent(pwdResetForm +
":selfPwdResetPanel:username", TextField.class);
+ UTILITY_UI.getTester().assertComponent(pwdResetForm +
":selfPwdResetPanel:securityQuestion", TextField.class);
+
+ FormTester formTester =
UTILITY_UI.getTester().newFormTester(pwdResetForm);
+ Assertions.assertNotNull(formTester);
+ // 1. set username to selfpwdreset
+ formTester.setValue(UTILITY_UI.findComponentById(pwdResetForm +
":selfPwdResetPanel", "username"),
+ "selfpwdreset");
+ // 2. check that the question has been populated
+ UTILITY_UI.getTester().executeAjaxEvent(pwdResetForm +
":selfPwdResetPanel:username", Constants.ON_BLUR);
+ UTILITY_UI.getTester().assertModelValue(pwdResetForm +
":selfPwdResetPanel:securityQuestion", question.
+ getContent());
+ // 3. submit form and receive an error
+ formTester = UTILITY_UI.getTester().newFormTester(pwdResetForm);
+ Assertions.assertNotNull(formTester);
+ UTILITY_UI.getTester().executeAjaxEvent(pwdResetForm +
":selfPwdResetPanel:submit", Constants.ON_CLICK);
+ UTILITY_UI.getTester().assertErrorMessages("InvalidSecurityAnswer []");
+ UTILITY_UI.getTester().cleanupFeedbackMessages();
+ // 3.1 set the correct answer
+ formTester = UTILITY_UI.getTester().newFormTester(pwdResetForm);
+ Assertions.assertNotNull(formTester);
+ UTILITY_UI.getTester().assertComponent(pwdResetForm +
":selfPwdResetPanel:securityAnswer", TextField.class);
+ formTester.setValue("selfPwdResetPanel:securityAnswer", "ananswer");
+ UTILITY_UI.getTester().executeAjaxEvent(pwdResetForm +
":selfPwdResetPanel:securityAnswer", Constants.ON_CHANGE);
+ UTILITY_UI.getTester().assertComponent(pwdResetForm +
":selfPwdResetPanel:securityAnswer",
+ TextField.class);
+ // 4. submit form
+ UTILITY_UI.getTester().assertNoFeedbackMessage(0);
+ UTILITY_UI.getTester().assertNoErrorMessage();
+ UTILITY_UI.getTester().assertComponent(pwdResetForm +
":selfPwdResetPanel:submit", Button.class);
+ UTILITY_UI.getTester().executeAjaxEvent(pwdResetForm +
":selfPwdResetPanel:submit", Constants.ON_CLICK);
+ UTILITY_UI.getTester().assertRenderedPage(Login.class);
+ UTILITY_UI.getTester().assertComponent("login:username",
TextField.class);
+
+ UTILITY_UI.getTester().cleanupFeedbackMessages();
+ }
+
+ @Test
+ public void mustChangePassword() {
+ UserTO mustchangepassword = userService.read("mustchangepassword");
+ userService.update(new UserUR.Builder(mustchangepassword.getKey())
+ .mustChangePassword(new BooleanReplacePatchItem.Builder()
+ .operation(PatchOperation.ADD_REPLACE)
+ .value(Boolean.TRUE).build()).build());
+
+ UTILITY_UI.getTester().startPage(Login.class);
+ doLogin("mustchangepassword", "password123");
+
+ UTILITY_UI.getTester().assertRenderedPage(MustChangePassword.class);
+
+ final String changePwdForm = "changePassword";
+ UTILITY_UI.getTester().assertComponent(changePwdForm + ":username",
TextField.class);
+ UTILITY_UI.getTester().assertComponent(changePwdForm +
":password:passwordField", PasswordTextField.class);
+ UTILITY_UI.getTester().
+ assertComponent(changePwdForm +
":confirmPassword:passwordField", PasswordTextField.class);
+ UTILITY_UI.getTester().assertModelValue(changePwdForm + ":username",
"mustchangepassword");
+
+ FormTester formTester =
UTILITY_UI.getTester().newFormTester(changePwdForm);
+
+ Assertions.assertNotNull(formTester);
+ // 1. set new password
+ formTester.setValue(UTILITY_UI.findComponentById(changePwdForm +
":password", "passwordField"), "password124");
+ // 2. confirm password
+ formTester.setValue(UTILITY_UI.findComponentById(changePwdForm +
":confirmPassword", "passwordField"),
+ "password124");
+ // 3. submit form
+ UTILITY_UI.getTester().executeAjaxEvent(changePwdForm + ":submit",
Constants.ON_CLICK);
+
+ UTILITY_UI.getTester().assertRenderedPage(Login.class);
+ UTILITY_UI.getTester().assertComponent("login:username",
TextField.class);
+
+ UTILITY_UI.getTester().cleanupFeedbackMessages();
+
+ doLogin("mustchangepassword", "password124");
+ UTILITY_UI.getTester().assertComponent(WIZARD_FORM +
":view:username:textField", TextField.class);
}
@Test
public void selfUpdate() {
- String username = "puccini";
- String newEmail = "[email protected]";
+ String username = "selfupdate";
+ String newEmail = "[email protected]";
UTILITY_UI.getTester().startPage(Login.class);
- doLogin(username, "password");
+ doLogin(username, "password123");
UTILITY_UI.getTester().assertComponent(WIZARD_FORM +
":view:username:textField", TextField.class);
UTILITY_UI.getTester().executeAjaxEvent(WIZARD_FORM + ":buttons:next",
Constants.ON_CLICK);
@@ -142,22 +252,29 @@ public class SelfRegistrationITCase extends
AbstractEnduserITCase {
TextField.class);
UTILITY_UI.getTester().executeAjaxEvent(WIZARD_FORM + ":buttons:next",
Constants.ON_CLICK);
- UTILITY_UI.getTester().assertComponent(WIZARD_FORM
- +
":view:plainSchemas:tabs:0:body:content:schemas:6:panel:textField",
+
UTILITY_UI.getTester().assertComponent(UTILITY_UI.findComponentByMarkupId(
+ WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas",
"fullname").getPageRelativePath()
+ + ":textField",
TextField.class);
- UTILITY_UI.getTester().assertComponent(WIZARD_FORM
- +
":view:plainSchemas:tabs:0:body:content:schemas:12:panel:textField",
+
UTILITY_UI.getTester().assertComponent(UTILITY_UI.findComponentByMarkupId(
+ WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas",
"surname").getPageRelativePath()
+ + ":textField",
TextField.class);
- UTILITY_UI.getTester().assertComponent(WIZARD_FORM
- +
":view:plainSchemas:tabs:0:body:content:schemas:14:panel:textField",
+
UTILITY_UI.getTester().assertComponent(UTILITY_UI.findComponentByMarkupId(
+ WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas",
"userId").getPageRelativePath()
+ + ":textField",
TextField.class);
FormTester formTester =
UTILITY_UI.getTester().newFormTester(WIZARD_FORM);
- assertNotNull(formTester);
- UTILITY_UI.getTester().assertComponent(WIZARD_FORM
- +
":view:plainSchemas:tabs:0:body:content:schemas:4:panel:textField",
+ Assertions.assertNotNull(formTester);
+
UTILITY_UI.getTester().assertComponent(UTILITY_UI.findComponentByMarkupId(
+ WIZARD_FORM +
":view:plainSchemas:tabs:0:body:content:schemas", "email").getPageRelativePath()
+ + ":textField",
TextField.class);
-
formTester.setValue("view:plainSchemas:tabs:0:body:content:schemas:4:panel:textField",
newEmail);
+ formTester.setValue(UTILITY_UI.findComponentByMarkupId(WIZARD_FORM
+ + ":view:plainSchemas:tabs:0:body:content:schemas",
+ "email").getPageRelativePath().replace(WIZARD_FORM + ":",
StringUtils.EMPTY) + ":textField",
+ newEmail);
UTILITY_UI.getTester().executeAjaxEvent(WIZARD_FORM + ":buttons:next",
Constants.ON_CLICK);
@@ -181,13 +298,10 @@ public class SelfRegistrationITCase extends
AbstractEnduserITCase {
UTILITY_UI.getTester().assertRenderedPage(Login.class);
UTILITY_UI.getTester().assertComponent("login:username",
TextField.class);
-
assertTrue(userService.read(username).getPlainAttr("email").get().getValues().get(0).equals(newEmail));
+ Assertions.assertEquals("active",
userService.read(username).getStatus());
+ Assertions.assertEquals(newEmail,
userService.read(username).getPlainAttr("email").get().getValues().get(0));
UTILITY_UI.getTester().cleanupFeedbackMessages();
}
- @Test
- public void mustChangePassword() {
-
- }
}
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/ui/UtilityUIT.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/ui/UtilityUIT.java
index 93dea13..342d0c6 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/ui/UtilityUIT.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/ui/UtilityUIT.java
@@ -83,6 +83,16 @@ public class UtilityUIT {
}
});
}
+
+ public Component findComponentByMarkupId(final String searchPath, final
String markupId) {
+ Component component =
tester.getComponentFromLastRenderedPage(searchPath);
+ return (component instanceof MarkupContainer ?
MarkupContainer.class.cast(component) : component.getPage()).
+ visitChildren(Component.class, (final Component object, final
IVisit<Component> visit) -> {
+ if (object.getMarkupId().equals(markupId)) {
+ visit.stop(object);
+ }
+ });
+ }
public void closeCallBack(final Component modal) {
modal.getBehaviors().stream().