Fix LoginForm.registerLink

(cherry picked from commit 6414232)
This commit is contained in:
Vaclav Muzikar 2016-02-08 13:51:14 +01:00
parent 97d0f39346
commit ec2cfba670
2 changed files with 6 additions and 7 deletions

View file

@ -42,7 +42,7 @@ public class LoginForm extends Form {
// @FindBy(name = "cancel") // @FindBy(name = "cancel")
// private WebElement cancelButton; // private WebElement cancelButton;
@FindBy(linkText = "Register") @FindBy(xpath = "//div[@id='kc-registration']/span/a")
private WebElement registerLink; private WebElement registerLink;
@FindBy(linkText = "Forgot Password?") @FindBy(linkText = "Forgot Password?")
private WebElement forgottenPassword; private WebElement forgottenPassword;

View file

@ -70,8 +70,9 @@ public class RegistrationTest extends AbstractAccountManagementTest {
} }
public void assertMessageAttributeMissing(String attributeName) { public void assertMessageAttributeMissing(String attributeName) {
assertTrue(testRealmRegistrationPage.getFeedbackText() String feedbackTest = testRealmRegistrationPage.getFeedbackText();
.contains("Please specify " + attributeName + ".")); String contains = "Please specify " + attributeName + ".";
assertTrue("'" + contains + "' doesn't contain '" + feedbackTest + "'", feedbackTest.contains(contains));
} }
@Test @Test
@ -84,8 +85,7 @@ public class RegistrationTest extends AbstractAccountManagementTest {
public void invalidEmail() { public void invalidEmail() {
newUser.setEmail("invalid.email.value"); newUser.setEmail("invalid.email.value");
testRealmRegistrationPage.register(newUser); testRealmRegistrationPage.register(newUser);
assertTrue(testRealmRegistrationPage.getFeedbackText() assertEquals("Invalid email address.", testRealmRegistrationPage.getFeedbackText());
.equals("Invalid email address."));
assertUserDoesntExistWithAdminClient(newUser); assertUserDoesntExistWithAdminClient(newUser);
} }
@ -121,8 +121,7 @@ public class RegistrationTest extends AbstractAccountManagementTest {
public void notMatchingPasswords() { public void notMatchingPasswords() {
testRealmRegistrationPage.setValues(newUser, "not-matching-password"); testRealmRegistrationPage.setValues(newUser, "not-matching-password");
testRealmRegistrationPage.submit(); testRealmRegistrationPage.submit();
assertTrue(testRealmRegistrationPage.getFeedbackText() assertEquals("Password confirmation doesn't match.", testRealmRegistrationPage.getFeedbackText());
.equals("Password confirmation doesn't match."));
testRealmRegistrationPage.register(newUser); testRealmRegistrationPage.register(newUser);
assertUserExistsWithAdminClient(newUser); assertUserExistsWithAdminClient(newUser);