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 33aab3c9c..bc555afac 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 @@ -82,7 +82,7 @@ public class ArtifactManagementTest @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) public void testAddArtifactNoFilePath() { - addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId(), false ); + addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId(), true ); assertTextPresent( "Please add a file to upload." ); } 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 ca5fe6334..71684ca95 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 @@ -204,10 +204,12 @@ public abstract class AbstractArchivaTest public void assertUserRolesPage() { - assertPage( "Apache Archiva \\ [Admin] User Edit" ); - assertTextPresent( "[Admin] User Roles" ); - assertTextPresent( "Username" ); - assertTextPresent( "Full Name" ); + //assertPage( "Apache Archiva \\ [Admin] User Edit" ); + //[Admin] RĂ´les de l'utilisateur + + assertTextPresent( "[Admin] User Roles", "[Admin] R\u00F4les de l'utilisateur" ); + assertTextPresent( "Username", "Nom d'utilisateur" ); + assertTextPresent( "Full Name", "Nom complet" ); String userRoles = "Guest,Registered User,System Administrator,User Administrator,Global Repository Observer,Global Repository Manager,Repository Observer,Repository Manager,internal"; String[] arrayRole = userRoles.split( "," ); @@ -219,11 +221,10 @@ public abstract class AbstractArchivaTest public void assertDeleteUserPage( String username ) { - assertPage( "Apache Archiva \\ [Admin] User Delete" ); // TODO - assertTextPresent( "[Admin] User Delete" ); + assertTextPresent( "[Admin] User Delete", "[Admin] Suppression de l'utilisateur", "L'utilisateur suivant va \u00EAtre supprim\u00E9:" ); assertTextPresent( "The following user will be deleted:" ); - assertTextPresent( "Username: " + username ); - assertButtonWithValuePresent( "Delete User" ); + assertTextPresent( "Username: " + username , "Nom d'utilisateur:" + username); + assertButtonWithIdPresent( "userDeleteSubmit" ); } public void createUser( String userName, String fullName, String email, String password, boolean valid ) @@ -236,7 +237,8 @@ public abstract class AbstractArchivaTest { // login( getAdminUsername() , getAdminPassword() ); getSelenium().open( "/archiva/security/userlist.action" ); - clickButtonWithValue( "Create New User" ); + clickButtonWithLocator( "userCreateButton", true ); + //clickButtonWithValue( "Create New User" ); assertCreateUserPage(); setFieldValue( "user.username", userName ); setFieldValue( "user.fullName", fullName ); @@ -246,7 +248,9 @@ public abstract class AbstractArchivaTest submit(); assertUserRolesPage(); - clickButtonWithValue( "Submit" ); + + //clickButtonWithValue( "Submit" ); + clickButtonWithName( "submitRolesButton", true ); if ( valid ) { @@ -382,19 +386,21 @@ public abstract class AbstractArchivaTest public void assertCreateUserPage() { - assertPage( "Apache Archiva \\ [Admin] User Create" ); - assertTextPresent( "[Admin] User Create" ); - assertTextPresent( "Username*:" ); + //assertPage( "Apache Archiva \\ [Admin] User Create" ); + //assertTextPresent( "[Admin] User Create" ); + assertTextPresent( "Username*:", "Nom d'utilisateur*:" ); assertElementPresent( "user.username" ); - assertTextPresent( "Full Name*:" ); + assertTextPresent( "Full Name*:", "Nom complet*:" ); assertElementPresent( "user.fullName" ); - assertTextPresent( "Email Address*:" ); + assertTextPresent( "Email Address*:", "Adresse email*:" ); assertElementPresent( "user.email" ); - assertTextPresent( "Password*:" ); + assertTextPresent( "Password*:", "Mot de passe*:" ); assertElementPresent( "user.password" ); - assertTextPresent( "Confirm Password*:" ); + assertTextPresent( "Confirm Password*:", "Confirmer le mot de passe*" ); assertElementPresent( "user.confirmPassword" ); - assertButtonWithValuePresent( "Create User" ); + //assertButtonWithValuePresent( "Create User" ); + //assertButtonWithIdPresent( "userCreateSubmit" ); + assertElementNotPresent( "userCreateSubmit" ); } public void assertLeftNavMenuWithRole( String role ) 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 fc747ba4d..95d3b5301 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 @@ -170,6 +170,23 @@ public abstract class AbstractSeleniumTest Assert.assertTrue( getSelenium().isTextPresent( text ), "'" + text + "' isn't present." ); } + /** + * one of text args must be in the page so use en and fr text (olamy use en locale :-) ) + * + * @param texts + */ + public void assertTextPresent( String... texts ) + { + boolean present = false; + StringBuilder sb = new StringBuilder(); + for ( String text : texts ) + { + present = present || getSelenium().isTextPresent( text ); + sb.append( " " + text + " " ); + } + Assert.assertTrue( present, "'one of the following test " + sb.toString() + "' isn't present." ); + } + public void assertTextNotPresent( String text ) { Assert.assertFalse( getSelenium().isTextPresent( text ), "'" + text + "' is present." ); @@ -319,6 +336,11 @@ public abstract class AbstractSeleniumTest return isElementPresent( "//button[@id='" + text + "']" ) || isElementPresent( "//input[@id='" + text + "']" ); } + public void clickButtonWithName( String text, boolean wait ) + { + clickLinkWithXPath( "//input[@name='" + text + "']", wait ); + } + public void clickButtonWithValue( String text ) { clickButtonWithValue( text, true );