fix selenium issues i18n

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174421 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-22 22:19:00 +00:00
parent 0157bc252d
commit 604d5117e8
3 changed files with 47 additions and 19 deletions

View 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." );
}

View 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 )

View 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 );