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

Commit

Permalink
Merge branch 'master' into move-file-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Jul 19, 2013
2 parents 11c81ee + 3d2ffd0 commit f5a6a09
Show file tree
Hide file tree
Showing 99 changed files with 2,096 additions and 905 deletions.
6 changes: 3 additions & 3 deletions functional-test/pom.xml
Expand Up @@ -62,7 +62,7 @@
<!-- on jenkins, this needs to be set to empty - so that cargo can shutdown. see http://stackoverflow.com/questions/1096642/tomcat-failed-to-shutdown -->
<cargo.debug.jvm.args> -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787 -Xnoagent -Djava.compiler=NONE</cargo.debug.jvm.args>
<!-- this property can be used to control what test needs to be run by failsafe -->
<include.test.patterns>**/*TestSuite.java</include.test.patterns>
<include.test.patterns>**/AggregateTestSuite.java</include.test.patterns>
</properties>

<dependencies>
Expand Down Expand Up @@ -403,8 +403,8 @@
<!--<echo>-Dzanata.client.version=maven client version to use. Currently: ${zanata.client.version}</echo>-->
<echo>-Dzanata.sample.projects.basedir=${project.build.testOutputDirectory}/sample-projects</echo>
<echo>-Dcargo.debug.jvm.args : If not set by default will listen to port 8787. Need to set to empty on jenkins</echo>
<echo>-Dinclude.test.patterns=test filter pattern. Can be used to control what test to run. Default is **/*TestSuite.java.</echo>
<echo>-Dwebdriver.type=run tests in htmlUnit, chrome or firefox. For chrome, see also webdriver.chrome.* Default is htmlUnit.</echo>
<echo>-Dinclude.test.patterns=test filter pattern. Can be used to control what test to run. Default is **/*AggregateTestSuite.java.</echo>
<echo>-Dwebdriver.type=run tests in htmlUnit, chrome or firefox. For chrome, see also webdriver.chrome.* Default is chrome.</echo>
<echo>-Dwebdriver.display=display to run test browser in, for Xnest or otherwise. Default is :0.</echo>
<echo>-Dwebdriver.chrome.bin=full path to chrome binary.</echo>
<echo>-Dwebdriver.chrome.driver=full path to chromedriver binary.</echo>
Expand Down
Expand Up @@ -74,7 +74,6 @@ private void doSignIn(String username, String password)
usernameField.clear();
usernameField.sendKeys(username);
passwordField.sendKeys(password);
log.info("after input, username is: {}, password is: {}", usernameField.getText(), passwordField.getText());
signInButton.click();
waitForTenSec().until(new Predicate<WebDriver>()
{
Expand Down
Expand Up @@ -26,6 +26,9 @@ public class ManageLanguageTeamMemberPage extends AbstractPage
private WebElement memberPanel;

public static final int USERNAME_COLUMN = 0;
public static final int SEARCH_RESULT_SELECTED_COLUMN = 0;
public static final int SEARCH_RESULT_PERSON_COLUMN = 1;
public static final int ISTRANSLATOR_COLUMN = 3;

public ManageLanguageTeamMemberPage(WebDriver driver)
{
Expand Down Expand Up @@ -89,7 +92,7 @@ public WebElement apply(WebDriver driver)
return this;
}

public List<TableRow> searchPerson(final String personName)
public ManageLanguageTeamMemberPage searchPersonAndAddToTeam(final String personName)
{
final WebElement addUserPanel = getDriver().findElement(By.id("userAddPanel_container"));

Expand All @@ -104,52 +107,58 @@ public WebElement apply(WebDriver driver)
WebElement searchButton = getDriver().findElement(By.id("searchForm:searchBtn"));
searchButton.click();

WebElement searchResultTable = waitForTenSec().until(new Function<WebDriver, WebElement>()
return waitForTenSec().until(new Function<WebDriver, ManageLanguageTeamMemberPage>()
{
@Override
public WebElement apply(WebDriver driver)
public ManageLanguageTeamMemberPage apply(WebDriver driver)
{
WebElement table = driver.findElement(By.id("resultForm:personTable"));
List<TableRow> tableRows = WebElementUtil.getTableRows(getDriver(), table);
//we want to wait until search result comes back
if (tableRows.isEmpty() || !tableRows.get(0).getCellContents().get(0).contains(personName))
if (tableRows.isEmpty() || !tableRows.get(0).getCellContents().get(SEARCH_RESULT_PERSON_COLUMN).contains(personName))
{
log.debug("waiting for search result refresh...");
return null;
}
return table;

return addToTeam(tableRows.get(0));
}
});

return WebElementUtil.getTableRows(getDriver(), searchResultTable);
}

public ManageLanguageTeamMemberPage addToTeam(TableRow personRow)
private ManageLanguageTeamMemberPage addToTeam(TableRow personRow)
{
List<WebElement> cells = personRow.getCells();
final String personUsername = personRow.getCellContents().get(0);
final String personUsername = personRow.getCellContents().get(SEARCH_RESULT_PERSON_COLUMN);
log.info("username to be added: {}", personUsername);
WebElement lastColumn = cells.get(cells.size() - 1);
if (!lastColumn.getText().contains("Already in Team"))
WebElement selectRowToUpdateCheckBox = personRow.getCells().get(SEARCH_RESULT_SELECTED_COLUMN).findElement(By.tagName("input"));
WebElement isTranslatorCheckBox = personRow.getCells().get(ISTRANSLATOR_COLUMN).findElement(By.tagName("input"));

if (!isTranslatorCheckBox.isSelected())
{
WebElement addButton = lastColumn.findElement(By.xpath(".//input[@value='Add']"));
if(!selectRowToUpdateCheckBox.isSelected())
{
selectRowToUpdateCheckBox.click();
}

isTranslatorCheckBox.click();

WebElement addButton = getDriver().findElement(By.id("resultForm:addSelectedBtn"));
addButton.click();
WebElement closeButton = getDriver().findElement(By.id("searchForm:closeBtn"));
closeButton.click();
// we need to wait for the page to refresh
WebElementUtil.waitForSeconds(getDriver(), 5).until(new Predicate<WebDriver>()
{
@Override
public boolean apply(WebDriver driver)
{
By byId = By.id("memberPanel:threads");
List<String> usernameColumn = WebElementUtil.getColumnContents(getDriver(), byId, USERNAME_COLUMN);
log.info("username column: {}", usernameColumn);
return usernameColumn.contains(personUsername);
}
});
return new ManageLanguageTeamMemberPage(getDriver());
}
return this;
// we need to wait for the page to refresh
return refreshPageUntil(this, new Predicate<WebDriver>()
{
@Override
public boolean apply(WebDriver driver)
{
By byId = By.id("memberPanel:threads");
List<String> usernameColumn = WebElementUtil.getColumnContents(getDriver(), byId, USERNAME_COLUMN);
log.info("username column: {}", usernameColumn);
return usernameColumn.contains(personUsername);
}
});
}
}
Expand Up @@ -36,7 +36,6 @@

public class ManageUserAccountPage extends AbstractPage
{

@FindBy(id = "userdetailForm:passwordField:password")
private WebElement passwordField;

Expand All @@ -52,10 +51,10 @@ public class ManageUserAccountPage extends AbstractPage
@FindBy(id = "userdetailForm:userdetailCancel")
private WebElement cancelButton;

private Map<String, String> roleMap;

// username field will trigger ajax call and become stale
private By usernameBy = By.id("userdetailForm:usernameField:username");

private Map<String, String> roleMap;

public ManageUserAccountPage(WebDriver driver)
{
Expand Down
@@ -0,0 +1,42 @@
/*
* 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.feature;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.zanata.feature.account.RegisterTestSuite;
import org.zanata.feature.administration.AdministrationTestSuite;
import org.zanata.feature.glossary.GlossaryTestSuite;
import org.zanata.feature.security.SecurityTestSuite;
import org.zanata.feature.startNewProject.CreateSampleProjectTestSuite;
import org.zanata.feature.versionGroup.VersionGroupTestSuite;

@RunWith(Suite.class)
@Suite.SuiteClasses({
RegisterTestSuite.class,
AdministrationTestSuite.class,
GlossaryTestSuite.class,
SecurityTestSuite.class,
CreateSampleProjectTestSuite.class,
VersionGroupTestSuite.class
})
public class AggregateTestSuite {
}
@@ -0,0 +1,33 @@
/*
* 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.feature;
/**
* Interface for the execution of the Basic Acceptance Tests (BAT) category.
*
* Tests in this category exercise features only so far as to demonstrate that the feature works,
* and perhaps have a single handled negative case.
* BAT suites should not exceed an agreed interval (e.g. approximately 10 minutes) in order to
* maintain a positive GitHub workflow.
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
* @see "http://junit.org/javadoc/4.9/org/junit/experimental/categories/Categories.html"
*/
public interface BasicAcceptanceTest { }
@@ -0,0 +1,34 @@
/*
* 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.feature;

import org.junit.experimental.categories.Categories;
import org.junit.runner.RunWith;

/**
* Extend the full test suite, but filter by the Basic Acceptance Test category
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Categories.class)
@Categories.IncludeCategory(BasicAcceptanceTest.class)
public class BasicAcceptanceTestSuite extends AggregateTestSuite {
}
@@ -0,0 +1,33 @@
/*
* 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.feature;
/**
* Interface for the execution of the Concordion Tests category.
*
* Tests in this category exercise features to a limited point,in order to validate the feature
* in a given use case and generate what is, effectively, a user manual.
* These tests are of a low priority due to the specific system requirements, e.g. actions which
* result in screenshots require a single display environment.
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
* @see "http://junit.org/javadoc/4.9/org/junit/experimental/categories/Categories.html"
*/
public interface ConcordionTest { }
@@ -0,0 +1,34 @@
/*
* 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.feature;

import org.junit.experimental.categories.Categories;
import org.junit.runner.RunWith;

/**
* Filter by the Concordion Test category
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Categories.class)
@Categories.IncludeCategory(ConcordionTest.class)
public class ConcordionTestSuite extends AggregateTestSuite {
}
31 changes: 31 additions & 0 deletions functional-test/src/test/java/org/zanata/feature/DetailedTest.java
@@ -0,0 +1,31 @@
/*
* 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.feature;
/**
* Interface for the execution of the detailed tests category.
*
* Tests that fall under this category exercise features more so than the Basic Acceptance Tests
* (BAT), but are time constrained and are as such not in the "Long" test collection.
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
* @see "http://junit.org/javadoc/4.9/org/junit/experimental/categories/Categories.html"
*/
public interface DetailedTest { }
@@ -0,0 +1,14 @@
package org.zanata.feature;

import org.junit.experimental.categories.Categories;
import org.junit.runner.RunWith;

/**
* Extend the full test suite, but filter by the Detailed Test category
*
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Categories.class)
@Categories.IncludeCategory(DetailedTest.class)
public class DetailedTestSuite extends AggregateTestSuite {
}

0 comments on commit f5a6a09

Please sign in to comment.