Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #83 from zanata/fix-reset-password-test
Browse files Browse the repository at this point in the history
Fix reset password test
  • Loading branch information
Patrick Huang committed Jul 31, 2013
2 parents 930aee1 + db0bba4 commit f230fc6
Showing 1 changed file with 16 additions and 7 deletions.
Expand Up @@ -75,7 +75,7 @@ public void signInFailure()

@Test
@Ignore("RHBZ-987707 | Cannot intercept email yet")
public void resetPassword()
public void resetPasswordSuccessful()
{
SignInPage signInPage = new BasicWorkFlow().goToHome().clickSignInLink();
ResetPasswordPage resetPasswordPage = signInPage.gotToResetPassword();
Expand All @@ -85,7 +85,7 @@ public void resetPassword()
}

@Test
public void resetPasswordFailure()
public void resetPasswordFailureForInvalidAccount()
{
SignInPage signInPage = new BasicWorkFlow().goToHome().clickSignInLink();
ResetPasswordPage resetPasswordPage = signInPage.gotToResetPassword();
Expand All @@ -109,24 +109,33 @@ public void invalidResetPasswordFieldEntries()
resetPasswordPage = resetPasswordPage.enterUserName("b").enterEmail("b");
resetPasswordPage = resetPasswordPage.resetFailure();

assertThat("Two field errors are displayed", resetPasswordPage.waitForErrors(),
assertThat("Invalid email error is displayed", resetPasswordPage.waitForErrors(),
Matchers.hasItem(invalidEmailError));
assertThat("Username error shows",

assertThat("(One of the) Username error shows",
invalidUsernameErrors.contains(resetPasswordPage.getErrors().get(0)));

}

@Test
public void emptyResetPasswordFieldEntries()
{
String emptyUsernameError = "size must be between 3 and 20";
// Both are valid, but show seemingly at random
List<String> emptyUsernameErrors = new ArrayList<String>();
emptyUsernameErrors.add("size must be between 3 and 20");
emptyUsernameErrors.add("must match ^[a-z\\d_]{3,20}$");
String emptyEmailError = "may not be empty";

SignInPage signInPage = new BasicWorkFlow().goToHome().clickSignInLink();
ResetPasswordPage resetPasswordPage = signInPage.gotToResetPassword();
resetPasswordPage = resetPasswordPage.clearFields();
resetPasswordPage = resetPasswordPage.resetFailure();
assertThat("Two field errors are displayed", resetPasswordPage.waitForErrors(),
Matchers.contains(emptyUsernameError, emptyEmailError));

assertThat("Empty email error is displayed", resetPasswordPage.waitForErrors(),
Matchers.hasItem(emptyEmailError));

assertThat("(One of the) Username error shows",
emptyUsernameErrors.contains(resetPasswordPage.getErrors().get(0)));
}

}

0 comments on commit f230fc6

Please sign in to comment.