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

Commit

Permalink
Slightly change the wording on the signup/login pages, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
djansen-redhat committed Jul 4, 2014
1 parent 5c8b761 commit 64af89c
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 3 deletions.
Expand Up @@ -119,7 +119,7 @@ public RegisterPage clearFields() {

/*
* Pass in a map of strings, to be entered into the registration fields.
* Fields: name, email, username, password, confirmpassword, captcha
* Fields: name, email, username, password, confirmpassword
*/
public RegisterPage setFields(Map<String, String> fields) {
return clearFields()
Expand All @@ -140,4 +140,26 @@ public WebElement apply(WebDriver driver) {
return getErrors();
}

public String getPageTitle() {
return getDriver().findElement(By.className("heading--sub"))
.getText();
}

public SignInPage goToSignIn() {
getDriver().findElement(By.linkText("Log In")).click();
return new SignInPage(getDriver());
}

public RegisterPage clickPasswordShowToggle() {
getDriver().findElement(By.className("js-form-password-toggle")).click();
return new RegisterPage(getDriver());
}

public String getPassword() {
return passwordField.getAttribute("value");
}

public String getPasswordFieldType() {
return passwordField.getAttribute("type");
}
}
Expand Up @@ -81,4 +81,13 @@ public ResetPasswordPage goToResetPassword() {
return new ResetPasswordPage(getDriver());
}

public RegisterPage goToRegister() {
getDriver().findElement(By.linkText("Sign Up")).click();
return new RegisterPage(getDriver());
}

public String getPageTitle() {
return getDriver().findElement(By.className("heading--sub"))
.getText();
}
}
Expand Up @@ -34,6 +34,7 @@
import org.zanata.feature.testharness.TestPlan.BasicAcceptanceTest;
import org.zanata.feature.testharness.TestPlan.DetailedTest;
import org.zanata.page.account.RegisterPage;
import org.zanata.page.account.SignInPage;
import org.zanata.page.utility.HomePage;
import org.zanata.util.AddUsersRule;
import org.zanata.util.HasEmailRule;
Expand Down Expand Up @@ -173,6 +174,57 @@ public void requiredFields() throws Exception {
.as("Value is required shows for all fields");
}

@Feature(summary = "The user can access the login page from the register " +
"page, and vice versa",
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 0)
@Test
public void signUpToLoginAndBack() {
RegisterPage registerPage = new BasicWorkFlow()
.goToHome()
.clickSignInLink()
.goToRegister();

assertThat(registerPage.getPageTitle())
.isEqualTo("Sign up with Zanata")
.as("The user is sent to the register page");

SignInPage signInPage = registerPage.goToSignIn();

assertThat(signInPage.getPageTitle())
.isEqualTo("Log in with your username")
.as("The user is sent to the log in page");
}

@Feature(summary = "The user can toggle the entered password visible and " +
"masked",
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 0)
@Test
public void togglePasswordVisible() {
RegisterPage registerPage = new BasicWorkFlow()
.goToHome()
.goToRegistration()
.enterPassword("mypassword");

assertThat(registerPage.getPasswordFieldType())
.isEqualTo("password")
.as("The password field starts as masked");

registerPage = registerPage.clickPasswordShowToggle();

assertThat(registerPage.getPasswordFieldType())
.isEqualTo("text")
.as("The password field is now not masked");

registerPage = registerPage.clickPasswordShowToggle();

assertThat(registerPage.getPasswordFieldType())
.isEqualTo("password")
.as("The password field is again masked");
assertThat(registerPage.getPassword())
.isEqualTo("mypassword")
.as("The password field did not lose the entered text");
}

@Feature(summary = "The user must enter at least one alphanumeric " +
"character in their username",
bugzilla = 981498)
Expand Down
4 changes: 2 additions & 2 deletions zanata-war/src/main/resources/messages.properties
Expand Up @@ -691,7 +691,7 @@ jsf.TermsOfUse=Terms of Use
jsf.register.LoginUsingOpenId=You can also login using Open Id <a href='sign_in'>Here</a>.
jsf.PleaseContactAdministrationToGetRegistrationLink=Please contact administration to get registration link.

jsf.register.WithZanata=Sign up with your username
jsf.register.WithZanata=Sign up with Zanata
jsf.register.FullName.label=Full Name
jsf.register.WithOther.label=or sign up using an existing account
jsf.register.agreeToTOS=By signing up for Zanata, you agree to our <a href="#{applicationConfiguration.termsOfUseUrl}" target="_blank">#{messages['jsf.TermsOfUse']}</a>.
Expand All @@ -713,7 +713,7 @@ jsf.ChangePassword=Change Password
jsf.login.openid=Open ID
jsf.login.WithZanata.label=Log in with your username
jsf.login.DontHaveAnAccount.label=Don't have an account?
jsf.login.OrLoginUsing.label=or log in using an existing account
jsf.login.OrLoginUsing.label=or log in with

jsf.UsernameNotAvailable=Username "#{userAction.username}" is not available
jsf.ActivateAccount=Activate Account
Expand Down

0 comments on commit 64af89c

Please sign in to comment.