This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'origin/master' into tm-import
Conflicts: pom.xml zanata-model/pom.xml zanata-war/src/main/java/org/zanata/rest/service/ExportTUStrategy.java zanata-war/src/main/java/org/zanata/rest/service/TMXStreamingOutput.java zanata-war/src/main/resources/db/changelogs/db.changelog-3.1.xml zanata-war/src/main/webapp-jboss/WEB-INF/classes/META-INF/persistence.xml zanata-war/src/main/webapp/WEB-INF/pages.xml zanata-war/src/test/resources/org/zanata/test/model/ClearAllTables.dbunit.xml
- Loading branch information
Showing
259 changed files
with
8,122 additions
and
3,625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 192 additions & 0 deletions
192
functional-test/src/main/java/org/zanata/page/account/RegisterPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
/* | ||
* Copyright 2013, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.page.account; | ||
|
||
|
||
import com.google.common.base.Function; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.zanata.page.AbstractPage; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a> | ||
*/ | ||
@Slf4j | ||
public class RegisterPage extends AbstractPage | ||
{ | ||
|
||
@FindBy(id = "registerForm:nameField:name") | ||
private WebElement nameField; | ||
|
||
@FindBy(id = "registerForm:emailField:email") | ||
private WebElement emailField; | ||
|
||
@FindBy(id = "registerForm:usernameField:username") | ||
private WebElement usernameField; | ||
|
||
@FindBy(id = "registerForm:passwordField:password") | ||
private WebElement passwordField; | ||
|
||
@FindBy(id = "registerForm:passwordConfirmField:passwordConfirm") | ||
private WebElement confirmPasswordField; | ||
|
||
@FindBy(id = "registerForm:captcha:verifyCaptcha") | ||
private WebElement captchaField; | ||
|
||
@FindBy(id = "registerForm:agreedToTerms:agreedToTerms") | ||
private WebElement termsCheckbox; | ||
|
||
@FindBy(id = "registerForm:registerButton") | ||
private WebElement registerButton; | ||
|
||
public RegisterPage(WebDriver driver) | ||
{ | ||
super(driver); | ||
List<String> elements = new ArrayList<String>(); | ||
elements.add("registerForm:nameField:name"); | ||
elements.add("registerForm:emailField:email"); | ||
elements.add("registerForm:usernameField:username"); | ||
elements.add("registerForm:passwordField:password"); | ||
elements.add("registerForm:passwordConfirmField:passwordConfirm"); | ||
elements.add("registerForm:captcha:verifyCaptcha"); | ||
elements.add("registerForm:agreedToTerms:agreedToTerms"); | ||
elements.add("registerForm:registerButton"); | ||
waitForPage(elements); | ||
} | ||
|
||
public RegisterPage enterName(String name) | ||
{ | ||
nameField.sendKeys(name); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public RegisterPage enterUserName(String userName) | ||
{ | ||
usernameField.sendKeys(userName); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public RegisterPage enterEmail(String email) | ||
{ | ||
emailField.sendKeys(email); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public RegisterPage enterPassword(String password) | ||
{ | ||
passwordField.sendKeys(password); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public RegisterPage enterConfirmPassword(String confirmPassword) | ||
{ | ||
confirmPasswordField.sendKeys(confirmPassword); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public RegisterPage enterCaptcha(String captcha) | ||
{ | ||
captchaField.sendKeys(captcha); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public RegisterPage clickTerms() | ||
{ | ||
termsCheckbox.click(); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
// TODO: Add a "signup success" page | ||
public AbstractPage register() | ||
{ | ||
registerButton.click(); | ||
return new AbstractPage(getDriver()); | ||
} | ||
|
||
public RegisterPage registerFailure() | ||
{ | ||
registerButton.click(); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public RegisterPage clearFields() | ||
{ | ||
nameField.clear(); | ||
emailField.clear(); | ||
usernameField.clear(); | ||
passwordField.clear(); | ||
confirmPasswordField.clear(); | ||
captchaField.clear(); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
/* | ||
Pass in a map of strings, to be entered into the registration fields. | ||
Fields: name, email, username, password, confirmpassword, captcha | ||
*/ | ||
public RegisterPage setFields(Map<String, String> fields) | ||
{ | ||
clearFields(); | ||
enterName(fields.get("name")); | ||
enterEmail(fields.get("email")); | ||
enterUserName(fields.get("username")); | ||
enterPassword(fields.get("password")); | ||
enterConfirmPassword(fields.get("confirmpassword")); | ||
enterCaptcha(fields.get("captcha")); | ||
return new RegisterPage(getDriver()); | ||
} | ||
|
||
public List<String> waitForErrors() | ||
{ | ||
waitForTenSec().until(new Function<WebDriver, WebElement>() | ||
{ | ||
@Override | ||
public WebElement apply(WebDriver driver) | ||
{ | ||
return getDriver().findElement(By.xpath("//span[@class='errors']")); | ||
} | ||
}); | ||
return getErrors(); | ||
} | ||
|
||
/* | ||
* Wait for all necessary entities to be available | ||
*/ | ||
private void waitForPage(List<String> elements) { | ||
for (final String element : elements) { | ||
waitForTenSec().until(new Function<WebDriver, WebElement>() | ||
{ | ||
@Override | ||
public WebElement apply(WebDriver driver) | ||
{ | ||
return getDriver().findElement(By.id(element)); | ||
} | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.