diff options
10 files changed, 72 insertions, 41 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index c3039ae97..5dce4b304 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -38,7 +38,7 @@ <cargo.install.dir>cargo-installs</cargo.install.dir> <maxWaitTimeInMs>60000</maxWaitTimeInMs> <!-- TODO: review how appropriate the memory settings are - should work with less --> - <cargo.jvm.args>-Xmx512m -XX:MaxPermSize=256m -Duser.language=en</cargo.jvm.args> + <cargo.jvm.args>-Xmx512m -XX:MaxPermSize=256m</cargo.jvm.args> <seleniumPluginVersion>2.0-SNAPSHOT</seleniumPluginVersion> </properties> @@ -383,8 +383,6 @@ <systemProperties> <appserver.base>${project.build.directory}/appserver-base</appserver.base> <appserver.home>${project.build.directory}/appserver-base</appserver.home> - <user.language>en</user.language> - <user.region>US</user.region> </systemProperties> </container> <configuration> @@ -584,7 +582,7 @@ <cargo.jvm.args> -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${cargo.debug.port} - -Xmx512m -XX:MaxPermSize=256m -Duser.language=en + -Xmx512m -XX:MaxPermSize=256m </cargo.jvm.args> <cargo.debug.port>8000</cargo.debug.port> <!-- wait an unusual amount of time (1hr) to allow debugging to occur --> diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java index 71bf8a844..779cdee87 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java @@ -58,9 +58,8 @@ public class ArchivaAdminTest getSelenium().open( baseUrl ); String title = getSelenium().getTitle(); - //assertElementPresent( "adminCreateForm" ); + // if not admin user created create one if (isElementPresent( "adminCreateForm" )) - //if ( title.endsWith( "Create Admin User" ) ) { assertCreateAdmin(); String fullname = getProperty( "ADMIN_FULLNAME" ); @@ -69,10 +68,10 @@ public class ArchivaAdminTest String password = getProperty( "ADMIN_PASSWORD" ); submitAdminData( fullname, mail, password ); assertUserLoggedIn( username ); - //submit(); - //clickLinkWithText( "Logout" ); clickLinkWithLocator( "logoutLink" ); } + + // take care about repositories : internal } }
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java index a451328a1..d47ff84ce 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/SearchTest.java @@ -24,27 +24,32 @@ import java.io.File; import org.apache.archiva.web.test.parent.AbstractSearchTest; import org.testng.annotations.Test; -@Test( groups = { "search" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } ) +@Test( groups = { "search" }, dependsOnGroups = {"about"}, sequential = true) public class SearchTest extends AbstractSearchTest { + @Test(alwaysRun = true) public void testSearchNonExistingArtifact() throws Exception { searchForArtifact( getProperty( "SEARCH_BAD_ARTIFACT" ) ); - assertTextPresent( "No results found" ); + //assertTextPresent( "No results found" ); + assertElementPresent( "//span[@class=\'errorMessage\']" ); } // TODO: make search tests more robust especially when comparing/asserting number of hits + @Test(alwaysRun = true) public void testSearchExistingArtifact() { searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) ); - assertTextPresent( "Results" ); - assertTextPresent( "Hits: 1 to 1 of 1" ); + //assertTextPresent( "Results" ); + assertElementPresent( "resultsBox" ); + assertTextPresent( "1 to 1 of 1" ); assertLinkPresent( "test" ); } + @Test(alwaysRun = true) public void testViewSearchedArtifact() { searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) ); @@ -54,7 +59,8 @@ public class SearchTest clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" ); assertPage( "Apache Archiva \\ Browse Repository" ); } - + + @Test(alwaysRun = true) public void testSearchWithMultipleKeywords() { String groupId = getProperty( "ADD_REMOVE_GROUPID" ); @@ -79,18 +85,21 @@ public class SearchTest assertTextPresent( "No results found" ); } + @Test(alwaysRun = true) public void testSearchNonExistingArtifactInAdvancedSearch() { searchForArtifactAdvancedSearch( null, getProperty( "SEARCH_BAD_ARTIFACT" ), null, null, null, null ); assertTextPresent( "No results found" ); } + @Test(alwaysRun = true) public void testSearchNoSearchCriteriaSpecifiedInAdvancedSearch() { searchForArtifactAdvancedSearch( null, null, null, null, null, null ); assertTextPresent( "Advanced Search - At least one search criteria must be provided." ); } + @Test(alwaysRun = true) public void testSearchExistingArtifactUsingAdvancedSearchArtifactId() { searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, @@ -100,6 +109,7 @@ public class SearchTest assertLinkPresent( "test" ); } + @Test(alwaysRun = true) public void testSearchExistingArtifactUsingAdvancedSearchGroupId() { searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null, @@ -109,6 +119,7 @@ public class SearchTest assertLinkPresent( "test" ); } + @Test(alwaysRun = true) public void testSearchExistingArtifactAllCriteriaSpecifiedInAdvancedSearch() { searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), getProperty( "ARTIFACT_ARTIFACTID" ) , getProperty( "ARTIFACT_VERSION" ), @@ -118,6 +129,7 @@ public class SearchTest assertLinkPresent( "test" ); } + @Test(alwaysRun = true) public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository() { searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java index 8cef498e9..6893ed036 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java @@ -103,7 +103,6 @@ public abstract class AbstractArchivaTest public void goToLoginPage() { getSelenium().open( baseUrl ); - //clickLinkWithText( "Login" ); clickLinkWithLocator( "loginLink" ); assertLoginPage(); } @@ -270,7 +269,7 @@ public abstract class AbstractArchivaTest public void login( String username, String password, boolean valid, String assertReturnPage ) { - if ( isLinkPresent( "Login" ) ) + if ( isElementPresent( "loginLink" ) ) { goToLoginPage(); @@ -302,8 +301,8 @@ public abstract class AbstractArchivaTest { checkField( "rememberMe" ); } - clickButtonWithValue( "Login" ); - + //clickButtonWithValue( "Login" ); + clickButtonWithLocator( "loginSubmit" ); if ( validUsernamePassword ) { assertUserLoggedIn( username ); @@ -470,9 +469,14 @@ public abstract class AbstractArchivaTest clickButtonWithValue( "Save" ); } + public void goToHomePage() + { + getSelenium().open( ""); + } // Upload Artifact public void goToAddArtifactPage() { + // must be logged as admin getSelenium().open( "/archiva/upload.action" ); assertAddArtifactPage(); } @@ -504,6 +508,7 @@ public abstract class AbstractArchivaTest public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom, String artifactFilePath, String repositoryId ) { + login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) ); goToAddArtifactPage(); setFieldValue( "groupId", groupId ); setFieldValue( "artifactId", artifactId ); @@ -534,9 +539,10 @@ public abstract class AbstractArchivaTest } setFieldValue( "artifact", path ); - selectValue( "repositoryId", repositoryId ); + selectValue( "upload_repositoryId", repositoryId ); - clickButtonWithValue( "Submit" ); + //clickButtonWithValue( "Submit" ); + clickButtonWithLocator( "uploadSubmit" ); } public void goToRepositoriesPage() diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java index 1d3bf8071..4383efce4 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSearchTest.java @@ -25,12 +25,15 @@ public abstract class AbstractSearchTest // Search public void goToSearchPage() { - if ( !"Apache Archiva \\ Quick Search".equals( getTitle() ) ) + goToHomePage(); + //if ( !"Apache Archiva \\ Quick Search".equals( getTitle() ) ) + if ( isElementPresent( "quickSearchBox" ) ) { - clickLinkWithText( "Search" ); + //clickLinkWithText( "Search" ); + clickLinkWithLocator( "menuSearchLink" ); getSelenium().waitForPageToLoad( maxWaitTimeInMs ); - - assertPage( "Apache Archiva \\ Quick Search" ); + assertElementPresent( "quickSearchSubmit" ); + //assertPage( "Apache Archiva \\ Quick Search" ); } } @@ -38,7 +41,7 @@ public abstract class AbstractSearchTest { assertPage( "Apache Archiva \\ Quick Search" ); assertTextPresent( "Search for" ); - assertElementPresent( "quickSearch_q" ); + assertElementPresent( "quickSearchSubmit" ); assertButtonWithValuePresent( "Search" ); // assertLinkPresent( "Advanced Search" ); assertTextPresent( "Enter your search terms. A variety of data will be searched for your keywords." ); @@ -50,11 +53,12 @@ public abstract class AbstractSearchTest goToSearchPage(); getSelenium().type( "dom=document.forms[1].elements[0]", artifactId ); - clickButtonWithValue( "Search" ); + //clickButtonWithValue( "Search" ); + clickButtonWithLocator( "quickSearchSubmit" ); } - public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version, - String repositoryId, String className, String rowCount ) + public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version, String repositoryId, + String className, String rowCount ) { goToSearchPage(); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index f5e5a4e72..c30fba72f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -72,8 +72,7 @@ public abstract class AbstractSeleniumTest if ( getSelenium() == null ) { - DefaultSelenium s = - new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl ); + DefaultSelenium s = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl ); s.start(); s.setTimeout( maxWaitTimeInMs ); selenium.set( s ); @@ -255,6 +254,7 @@ public abstract class AbstractSeleniumTest getSelenium().select( locator, "label=" + value ); } + public void assertOptionPresent( String selectField, String[] options ) { assertElementPresent( selectField ); @@ -371,6 +371,21 @@ public abstract class AbstractSeleniumTest } } + public void clickButtonWithLocator( String locator ) + { + clickButtonWithLocator( locator, true ); + } + + public void clickButtonWithLocator( String locator, boolean wait ) + { + assertElementPresent( locator ); + getSelenium().click( locator ); + if ( wait ) + { + waitPage(); + } + } + public void setFieldValues( Map<String, String> fieldMap ) { Map.Entry<String, String> entry; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp index 92c7b8841..1ec4aba5f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp @@ -81,7 +81,7 @@ <div id="topSearchBox"> <s:form method="get" action="quickSearch" namespace="/" validate="true"> - <s:textfield label="Search for" size="30" name="q"/> + <s:textfield id="quickSearchBox" label="Search for" size="30" name="q"/> </s:form> </div> @@ -91,17 +91,17 @@ <h5>Find</h5> <ul> <li class="none"> - <my:currentWWUrl action="index" namespace="/">Search</my:currentWWUrl> + <my:currentWWUrl action="index" namespace="/" id="menuSearchLink">Search</my:currentWWUrl> </li> <s:if test="%{#application['uiOptions'].showFindArtifacts}"> <li class="none"> - <my:currentWWUrl action="findArtifact" namespace="/">Find Artifact</my:currentWWUrl> + <my:currentWWUrl action="findArtifact" namespace="/" id="menuFindArtifactLink">Find Artifact</my:currentWWUrl> </li> </s:if> <li class="none"> - <my:currentWWUrl action="browse" namespace="/">Browse</my:currentWWUrl> + <my:currentWWUrl action="browse" namespace="/" id="menuBrowseLink">Browse</my:currentWWUrl> </li> </ul> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/quickSearch.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/quickSearch.jsp index 8dbf9b438..e8f761660 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/quickSearch.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/quickSearch.jsp @@ -97,7 +97,7 @@ <s:form method="get" id="quickSearch" action="quickSearch" validate="true"> <s:textfield label="Search for" size="50" name="q"/> <s:hidden name="completeQueryString" value="%{completeQueryString}"/> - <s:submit value="Search"/> + <s:submit value="Search" id="quickSearchSubmit"/> </s:form> <p> <s:actionerror/> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp index f56224ce3..2299f9521 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp @@ -39,7 +39,7 @@ <s:form action="upload!doUpload" method="post" enctype="multipart/form-data" validate="true"> <%@ include file="/WEB-INF/jsp/include/uploadForm.jspf" %> - <s:submit/> + <s:submit id="uploadSubmit"/> </s:form> </div> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag index 333c03273..04f389866 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag @@ -21,6 +21,7 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ attribute name="action" %>
<%@ attribute name="namespace" %>
+<%@ attribute name="id" %>
<%@ attribute name="url" %>
<%@ attribute name="useParams" required="false" %>
@@ -35,7 +36,7 @@ </c:set>
<c:if test="${!empty (action) && !empty (namespace)}">
<c:set var="url">
- <s:url action="%{#attr.action}" namespace="%{#attr.namespace}"/>
+ <s:url action="%{#attr.action}" namespace="%{#attr.namespace}" id="%{#attr.id}"/>
</c:set>
</c:if>
<c:set var="text">
@@ -46,16 +47,12 @@ Current URL: <c:out value="${currentUrl}"/> --> <c:choose>
<c:when test="${currentUrl == url}">
<b>
-
${text}
-
</b>
</c:when>
<c:otherwise>
- <a href="${url}">
-
+ <a href="${url}" id="${id}">
${text}
-
</a>
</c:otherwise>
</c:choose>
|