diff options
author | Olivier Lamy <olamy@apache.org> | 2011-06-20 17:51:46 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-06-20 17:51:46 +0000 |
commit | 41a9446b4b2cdd9c96aea1b270f11320bcf44b76 (patch) | |
tree | fde37770f49dc250c4188408f043aa6b772e4c81 /archiva-modules/archiva-web/archiva-webapp-test/src | |
parent | 2ec5d2ecd9d51b1b5d93faae0d8dea7e55d82cb3 (diff) | |
download | archiva-41a9446b4b2cdd9c96aea1b270f11320bcf44b76.tar.gz archiva-41a9446b4b2cdd9c96aea1b270f11320bcf44b76.zip |
start working on use id in selenium test rather than text which make tests locale dependant
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1137718 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webapp-test/src')
8 files changed, 32 insertions, 26 deletions
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 9ea72cbd4..71bf8a844 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 @@ -54,11 +54,13 @@ public class ArchivaAdminTest @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort ) throws Exception { - super.open( baseUrl + "/index.action?" + forceLocaleParam , browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) ); + super.open( baseUrl , browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) ); - getSelenium().open( baseUrl + "?" + forceLocaleParam ); + getSelenium().open( baseUrl ); String title = getSelenium().getTitle(); - if ( title.endsWith( "Create Admin User" ) ) + //assertElementPresent( "adminCreateForm" ); + if (isElementPresent( "adminCreateForm" )) + //if ( title.endsWith( "Create Admin User" ) ) { assertCreateAdmin(); String fullname = getProperty( "ADMIN_FULLNAME" ); @@ -67,8 +69,9 @@ public class ArchivaAdminTest String password = getProperty( "ADMIN_PASSWORD" ); submitAdminData( fullname, mail, password ); assertUserLoggedIn( username ); - submit(); - clickLinkWithText( "Logout" ); + //submit(); + //clickLinkWithText( "Logout" ); + clickLinkWithLocator( "logoutLink" ); } } diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java index 92cf7851e..4fd52916e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java @@ -103,7 +103,7 @@ public class ArtifactManagementTest addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() + "' was successfully deployed to repository 'internal'" ); - getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() + "?" + forceLocaleParam ); + getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() ); waitPage(); assertTextPresent( "<type>library</type>" ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java index 1a2b4ab80..5754a2347 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java @@ -28,7 +28,7 @@ public class AuditLogsReportTest { private void goToAuditLogReports() { - getSelenium().open( "/archiva/report/queryAuditLogReport.action?"+forceLocaleParam ); + getSelenium().open( "/archiva/report/queryAuditLogReport.action" ); } private void assertAuditLogsReportPage() diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java index 54ba9d6e7..86cd81a7d 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java @@ -36,7 +36,7 @@ import org.testng.annotations.Test; * @version $Id$ */ -@Test( groups = { "login" } ) +@Test( groups = { "login" }, dependsOnGroups = {"about"}) public class LoginTest extends AbstractArchivaTest { diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java index 99af3ed81..8197762a3 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java @@ -30,7 +30,7 @@ public class MergingRepositoriesTest public void testAddStagingRepository() { goToRepositoriesPage(); - getSelenium().open( "/archiva/admin/addRepository.action?" + forceLocaleParam ); + getSelenium().open( "/archiva/admin/addRepository.action" ); addStagingRepository( "merging-repo", "merging-repo", getRepositoryDir() + "merging-repo/", "", "Maven 2.x Repository", "0 0 * * * ?", "", "" ); assertTextPresent( "merging-repo" ); 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 80f46b025..95c499717 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 @@ -75,18 +75,19 @@ public abstract class AbstractArchivaTest public void assertCreateAdmin() { - assertPage( "Apache Archiva \\ Create Admin User" ); - assertTextPresent( "Username" ); + assertElementPresent( "adminCreateForm" ); + //assertPage( "Apache Archiva \\ Create Admin User" ); + //assertTextPresent( "Username" ); assertFieldValue( "admin", "user.username" ); - assertTextPresent( "Full Name*" ); + //assertTextPresent( "Full Name*" ); assertElementPresent( "user.fullName" ); - assertTextPresent( "Email Address*" ); + //assertTextPresent( "Email Address*" ); assertElementPresent( "user.email" ); - assertTextPresent( "Password*" ); + //assertTextPresent( "Password*" ); assertElementPresent( "user.password" ); - assertTextPresent( "Confirm Password*" ); + //assertTextPresent( "Confirm Password*" ); assertElementPresent( "user.confirmPassword" ); - assertButtonWithValuePresent( "Create Admin" ); + //assertButtonWithValuePresent( "Create Admin" ); } public void submitAdminData( String fullname, String email, String password ) @@ -101,8 +102,9 @@ public abstract class AbstractArchivaTest // Go to Login Page public void goToLoginPage() { - getSelenium().open( baseUrl + "?" + forceLocaleParam ); - clickLinkWithText( "Login" ); + getSelenium().open( baseUrl ); + //clickLinkWithText( "Login" ); + clickLinkWithLocator( "loginLink" ); assertLoginPage(); } @@ -315,11 +317,14 @@ public abstract class AbstractArchivaTest protected void assertUserLoggedIn( String username ) { - assertTextPresent( "Current User:" ); + //assertTextPresent( "Current User:" ); assertTextPresent( username ); - assertLinkPresent( "Edit Details" ); - assertLinkPresent( "Logout" ); - assertTextNotPresent( "Login" ); + //assertLinkPresent( "Edit Details" ); + assertElementPresent( "editUserLink" ); + assertElementPresent( "logoutLink" ); + //assertLinkPresent( "Logout" ); + //assertTextNotPresent( "Login" ); + assertElementNotPresent( "loginLink" ); } // User Roles diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java index 9ca751782..2b4fc1194 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java @@ -26,7 +26,7 @@ public abstract class AbstractBrowseTest // Browse public void goToBrowsePage() { - getSelenium().open( "/archiva/browse" + "?" + forceLocaleParam ); + getSelenium().open( "/archiva/browse" ); assertBrowsePage(); } 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 508889372..f5e5a4e72 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 @@ -44,8 +44,6 @@ public abstract class AbstractSeleniumTest public static String baseUrl; - public static String forceLocaleParam = "request_locale=en_US"; - public static String maxWaitTimeInMs; private static ThreadLocal<Selenium> selenium = new ThreadLocal<Selenium>(); @@ -75,7 +73,7 @@ public abstract class AbstractSeleniumTest if ( getSelenium() == null ) { DefaultSelenium s = - new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl + "?" + forceLocaleParam ); + new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl ); s.start(); s.setTimeout( maxWaitTimeInMs ); selenium.set( s ); |