]> source.dussan.org Git - archiva.git/commitdiff
fix selenium issues i18n
authorOlivier Lamy <olamy@apache.org>
Thu, 22 Sep 2011 22:19:00 +0000 (22:19 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 22 Sep 2011 22:19:00 +0000 (22:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174421 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java

index 33aab3c9ca19272b8ed3875254054d86a94c373b..bc555afac6c0496b55d2227b2f566d8938d3fd73 100644 (file)
@@ -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." );
     }
 
index ca5fe6334c5cbfdafd494ab08cf21e73e7f11030..71684ca958e9b7c6c226dfb539b0173eb19e41b2 100644 (file)
@@ -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 )
index fc747ba4ddc3b64839093a001f9e7905551d09f3..95d3b5301c6d66498991fdea2539b608e39b9c0d 100644 (file)
@@ -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 );