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

Commit

Permalink
Merge branch 'integration/master' into doc-stats-cache
Browse files Browse the repository at this point in the history
Conflicts:
	zanata-war/src/main/java/org/zanata/action/VersionHomeAction.java
	zanata-war/src/main/java/org/zanata/service/impl/DocumentStateCacheImpl.java
  • Loading branch information
Alex Eng committed Aug 14, 2014
2 parents 7969c9f + 2b5db8a commit d688758
Show file tree
Hide file tree
Showing 546 changed files with 20,072 additions and 13,262 deletions.
89 changes: 78 additions & 11 deletions functional-test/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>server</artifactId>
<version>3.4.3-SNAPSHOT</version>
<version>3.5.0-SNAPSHOT</version>
</parent>
<artifactId>functional-test</artifactId>
<!--if we want to use pom packaging, we need to explicitly enable some plugins and various things-->
Expand Down Expand Up @@ -36,6 +36,8 @@
<ds.connection.url>jdbc:mysql://localhost:${mysql.port}/${ds.database}?characterEncoding=UTF-8</ds.connection.url>
<ds.driver.class>com.mysql.jdbc.Driver</ds.driver.class>

<guava.version>15.0</guava.version>

<!-- target zanata instance will be built by war overlay -->
<zanata.test.war.name>zanata-test-${project.version}</zanata.test.war.name>
<!-- zanata-war package phase will copy the war to this location. Jenkins will override this -->
Expand Down Expand Up @@ -66,6 +68,36 @@
<smtp.port>2552</smtp.port>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.cssparser</groupId>
<artifactId>cssparser</artifactId>
<version>0.9.13</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.assertj</groupId>
Expand Down Expand Up @@ -164,12 +196,6 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
<scope>${hibernate.scope}</scope>
</dependency>

Expand Down Expand Up @@ -208,6 +234,12 @@
<version>0.3</version>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>


<!-- to use rest client in test -->
<dependency>
<groupId>org.zanata</groupId>
Expand All @@ -217,6 +249,16 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
Expand Down Expand Up @@ -307,7 +349,6 @@
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
Expand All @@ -318,6 +359,10 @@
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
<exclusions>
<exclusion>
<artifactId>jakarta-regexp</artifactId>
<groupId>jakarta-regexp</groupId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
Expand Down Expand Up @@ -352,7 +397,7 @@

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<artifactId>annotations</artifactId>
</dependency>

<!-- the war itself. See zanata-war pom.xml dependency:copy -->
Expand Down Expand Up @@ -632,9 +677,12 @@
<properties>
<property>
<name>listener</name>
<value>org.zanata.util.ScreenshotEnabledTestRunListener</value>
<value>org.zanata.util.ScreenshotEnabledTestRunListener,org.zanata.util.FeatureInventoryRecorder</value>
</property>
</properties>
<systemPropertyVariables>
<featureInventoryLocation>${project.build.directory}/feature-inventory</featureInventoryLocation>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -685,6 +733,11 @@
<exclude>**/pom.xml</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources/feature-inventory</directory>
<filtering>false</filtering>
<targetPath>${project.build.directory}/feature-inventory</targetPath>
</testResource>
</testResources>
<plugins>
<plugin>
Expand Down Expand Up @@ -721,7 +774,6 @@
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<failOnWarning>true</failOnWarning>
<usedDependencies combine.children="append">
<usedDependency>mysql:mysql-connector-java</usedDependency>
<usedDependency>org.apache.solr:solr-core</usedDependency>
Expand All @@ -737,6 +789,21 @@
</configuration>
</plugin>

<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<configuration>
<rules>
<bannedDependencies>
<excludes combine.children="append">
<!-- use xalan:xalan -->
<exclude>jakarta-regexp:jakarta-regexp</exclude>
</excludes>
<searchTransitive>true</searchTransitive>
</bannedDependencies>
</rules>
</configuration>
</plugin>

<!--we want to run tests in integration phase-->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
20 changes: 16 additions & 4 deletions functional-test/src/main/java/org/zanata/page/BasePage.java
Expand Up @@ -30,6 +30,7 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.zanata.page.account.RegisterPage;
import org.zanata.page.account.SignInPage;
import org.zanata.page.administration.AdministrationPage;
Expand Down Expand Up @@ -88,11 +89,13 @@ public DashboardBasePage goToMyDashboard() {
}

public ProjectsPage goToProjects() {
clickNavMenuItem(projectsLink);
clickNavMenuItem(getDriver().findElement(By.id("projects_link")));
return new ProjectsPage(getDriver());
}

private void clickNavMenuItem(final WebElement menuItem) {
scrollToTop();
slightPause();
if (!menuItem.isDisplayed()) {
// screen is too small the menu become dropdown
getDriver().findElement(By.id("nav-main"))
Expand All @@ -104,6 +107,8 @@ public boolean apply(WebDriver input) {
return menuItem.isDisplayed();
}
});
// The notifications can sometimes get in the way
waitForTenSec().until(ExpectedConditions.elementToBeClickable(menuItem));
menuItem.click();
}

Expand All @@ -114,7 +119,7 @@ public VersionGroupsPage goToGroups() {

public GlossaryPage goToGlossary() {
// Dynamically find the link, as it is not present for every user
getDriver().findElement(By.id("glossary_link")).click();
clickNavMenuItem(getDriver().findElement(By.id("glossary_link")));
return new GlossaryPage(getDriver());
}

Expand Down Expand Up @@ -153,6 +158,7 @@ public String loggedInAs() {
}

public HomePage logout() {
scrollIntoView(userAvatar);
userAvatar.click();

clickLinkAfterAnimation(BY_SIGN_OUT);
Expand Down Expand Up @@ -218,7 +224,8 @@ public void clickLinkAfterAnimation(WebElement element) {
}

public HelpPage goToHelp() {
getDriver().findElement(By.id("help_link")).click();
WebElement help_link = getDriver().findElement(By.id("help_link"));
clickNavMenuItem(help_link);
return new HelpPage(getDriver());
}

Expand Down Expand Up @@ -279,12 +286,13 @@ public boolean apply(WebDriver input) {
waitForPageSilence();
boolean clicked = false;
try {
scrollIntoView(tab);
if (tab.isDisplayed() && tab.isEnabled()) {
tab.click();
clicked = true;
}
} catch(WebDriverException wde) {
return clicked;
return false;
}
return clicked;
}
Expand All @@ -296,4 +304,8 @@ public String getHtmlSource(WebElement webElement) {
"return arguments[0].innerHTML;", webElement);
}

public void clickElement(By findby) {
scrollIntoView(getDriver().findElement(findby));
getDriver().findElement(findby).click();
}
}
11 changes: 11 additions & 0 deletions functional-test/src/main/java/org/zanata/page/CorePage.java
Expand Up @@ -27,6 +27,7 @@
import lombok.extern.slf4j.Slf4j;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
Expand Down Expand Up @@ -60,6 +61,7 @@ public String getTitle() {
}

public HomePage goToHomePage() {
scrollToTop();
homeLink.click();
return new HomePage(getDriver());
}
Expand Down Expand Up @@ -209,4 +211,13 @@ public void slightPause() {
log.warn("Pause was interrupted");
}
}

public void scrollIntoView(WebElement targetElement) {
((JavascriptExecutor) getDriver()).executeScript(
"arguments[0].scrollIntoView(true);", targetElement);
}

public void scrollToTop() {
((JavascriptExecutor) getDriver()).executeScript("scroll(0, 0);");
}
}
Expand Up @@ -38,8 +38,19 @@
*/
public class RegisterPage extends CorePage {

public final String USERNAMEVALIDATIONERROR = "Between 3 and 20 lowercase "+
"letters, numbers and underscores only";
public static final String USERNAME_VALIDATION_ERROR =
"Between 3 and 20 lowercase letters, numbers and underscores only";

public static final String USERNAME_UNAVAILABLE_ERROR =
"This username is not available";

public static final String MALFORMED_EMAIL_ERROR =
"not a well-formed email address";

public static final String REQUIRED_FIELD_ERROR = "value is required";

public static final String USERNAME_LENGTH_ERROR =
"size must be between 3 and 20";

@FindBy(id = "loginForm:name")
private WebElement nameField;
Expand Down Expand Up @@ -108,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 @@ -129,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 @@ -32,6 +32,9 @@

@Slf4j
public class SignInPage extends CorePage {

public static final String LOGIN_FAILED_ERROR = "Login failed";

@FindBy(id = "loginForm:username")
private WebElement usernameField;

Expand Down Expand Up @@ -78,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 @@ -54,6 +54,7 @@ public AddLanguagePage(final WebDriver driver) {
public AddLanguagePage inputLanguage(String language) {
languageInput.sendKeys(language);
defocus();
waitForPageSilence();
return this;
}

Expand Down

0 comments on commit d688758

Please sign in to comment.