start working on fixing issue with selenium tests

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1165351 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-05 16:34:57 +00:00
parent b2fb3e0465
commit 31ee82d0d9
4 changed files with 67 additions and 44 deletions

View File

@ -210,6 +210,7 @@
<value>${excluded.groups}</value>
</property>
</properties>
<runOrder>alphabetical</runOrder>
</configuration>
<executions>
<execution>
@ -253,7 +254,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>unzip-archiva-webapp</id>

View File

@ -142,21 +142,21 @@ public class ArtifactManagementTest
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deleted from repository 'internal'" );
}
@Test( alwaysRun = true )
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactNoGroupId()
{
deleteArtifact( " ", "delete", "1.0", "internal" );
assertTextPresent( "You must enter a groupId." );
}
@Test( alwaysRun = true )
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactNoArtifactId()
{
deleteArtifact( "delete", " ", "1.0", "internal" );
assertTextPresent( "You must enter an artifactId." );
}
@Test( alwaysRun = true)
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactNoVersion()
{
deleteArtifact( "delete", "delete", " ", "internal" );
@ -164,7 +164,7 @@ public class ArtifactManagementTest
assertTextPresent( "You must enter a version." );
}
@Test( alwaysRun = true)
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactInvalidVersion()
{
deleteArtifact( "delete", "delete", "asdf", "internal" );
@ -172,7 +172,7 @@ public class ArtifactManagementTest
}
// HTML select should have the proper value, else it will cause a selenium error: Option with label 'customValue' not found
@Test( alwaysRun = true)
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactInvalidValues()
{
deleteArtifact( "<> \\/~+[ ]'\"", "<> \\/~+[ ]'\"", "<>", "internal" );
@ -183,7 +183,7 @@ public class ArtifactManagementTest
"Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
}
@Test( alwaysRun = true)
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactInvalidGroupId()
{
deleteArtifact( "<> \\/~+[ ]'\"", "delete", "1.0", "internal" );
@ -191,7 +191,7 @@ public class ArtifactManagementTest
"Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
}
@Test( alwaysRun = true)
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactInvalidArtifactId()
{
deleteArtifact( "delete", "<> \\/~+[ ]'\"", "1.0", "internal" );

View File

@ -1,10 +1,10 @@
package org.apache.archiva.web.test.parent;
import org.apache.archiva.web.test.XPathExpressionUtil;
import java.io.File;
import java.io.IOException;
import org.apache.archiva.web.test.XPathExpressionUtil;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -103,7 +103,17 @@ public abstract class AbstractArchivaTest
public void goToLoginPage()
{
getSelenium().open( baseUrl );
clickLinkWithLocator( "loginLink" );
// are we already logged in ?
if ( isElementPresent( "logoutLink" ) )
{
// so logout
clickLinkWithLocator( "logoutLink" );
clickLinkWithLocator( "loginLink" );
}
else if ( isElementPresent( "loginLink" ) )
{
clickLinkWithLocator( "loginLink" );
}
assertLoginPage();
}
@ -202,7 +212,9 @@ public abstract class AbstractArchivaTest
"Guest,Registered User,System Administrator,User Administrator,Global Repository Observer,Global Repository Manager,Repository Observer,Repository Manager,internal";
String[] arrayRole = userRoles.split( "," );
for ( String userroles : arrayRole )
{
assertTextPresent( userroles );
}
}
public void assertDeleteUserPage( String username )
@ -336,8 +348,8 @@ public abstract class AbstractArchivaTest
public void assertUserRoleCheckBoxPresent( String value )
{
getSelenium().isElementPresent(
"xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='"
+ value + "']" );
"xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value
+ "']" );
}
public void assertResourceRolesCheckBoxPresent( String value )
@ -349,8 +361,8 @@ public abstract class AbstractArchivaTest
{
assertUserRoleCheckBoxPresent( value );
getSelenium().click(
"xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='"
+ value + "']" );
"xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value
+ "']" );
}
public void checkResourceRoleWithValue( String value )
@ -421,7 +433,9 @@ public abstract class AbstractArchivaTest
"Find Artifact,Browse,Reports,User Management,User Roles,Appearance,Upload Artifact,Delete Artifact,Repository Groups,Repositories,Proxy Connectors,Legacy Support,Network Proxies,Repository Scanning";
String[] arrayMenu = navMenu.split( "," );
for ( String navmenu : arrayMenu )
{
assertLinkPresent( navmenu );
}
}
}
@ -459,7 +473,9 @@ public abstract class AbstractArchivaTest
"Appearance,Organization Details,The logo in the top right of the screen is controlled by the following settings.,Organization Information,Name,URL,Logo URL";
String[] arrayAppearance = appearance.split( "," );
for ( String appear : arrayAppearance )
{
assertTextPresent( appear );
}
assertLinkPresent( "Edit" );
assertLinkPresent( "Change your appearance" );
}
@ -474,8 +490,9 @@ public abstract class AbstractArchivaTest
public void goToHomePage()
{
getSelenium().open( "");
getSelenium().open( "" );
}
// Upload Artifact
public void goToAddArtifactPage()
{
@ -577,9 +594,9 @@ public abstract class AbstractArchivaTest
setFieldValue( "repository.id", identifier );
setFieldValue( "repository.name", name );
setFieldValue( "repository.location", directory );
setFieldValue( "repository.indexDir", indexDirectory );
setFieldValue( "repository.indexDirectory", indexDirectory );
selectValue( "repository.layout", type );
setFieldValue( "repository.refreshCronExpression", cron );
setFieldValue( "repository.cronExpression", cron );
setFieldValue( "repository.daysOlder", daysOlder );
setFieldValue( "repository.retentionCount", retentionCount );
// TODO
@ -611,23 +628,24 @@ public abstract class AbstractArchivaTest
public void assertNetworkProxiesPage()
{
assertPage( "Apache Archiva \\ Administration - Network Proxies" );
assertPage( "Apache Archiva \\ Administration - Network Proxies" );
assertTextPresent( "Administration - Network Proxies" );
assertTextPresent( "Network Proxies" );
assertLinkPresent( "Add Network Proxy" );
}
public void addNetworkProxy( String identifier, String protocol, String hostname, String port, String username, String password )
public void addNetworkProxy( String identifier, String protocol, String hostname, String port, String username,
String password )
{
//goToNetworkProxiesPage();
clickLinkWithText( "Add Network Proxy" );
assertAddNetworkProxy();
setFieldValue( "proxy.id" , identifier );
setFieldValue( "proxy.protocol" , protocol );
setFieldValue( "proxy.host" , hostname );
setFieldValue( "proxy.port" , port );
setFieldValue( "proxy.username" , username );
setFieldValue( "proxy.password" , password );
setFieldValue( "proxy.id", identifier );
setFieldValue( "proxy.protocol", protocol );
setFieldValue( "proxy.host", hostname );
setFieldValue( "proxy.port", port );
setFieldValue( "proxy.username", username );
setFieldValue( "proxy.password", password );
clickButtonWithValue( "Save Network Proxy" );
}
@ -654,21 +672,22 @@ public abstract class AbstractArchivaTest
public void assertLegacySupportPage()
{
assertPage( "Apache Archiva \\ Administration - Legacy Support" );
assertTextPresent( "Administration - Legacy Artifact Path Resolution" );
assertTextPresent( "Path Mappings" );
assertLinkPresent( "Add" );
assertPage( "Apache Archiva \\ Administration - Legacy Support" );
assertTextPresent( "Administration - Legacy Artifact Path Resolution" );
assertTextPresent( "Path Mappings" );
assertLinkPresent( "Add" );
}
public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version, String classifier, String type)
public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version,
String classifier, String type )
{
assertAddLegacyArtifactPathPage();
setFieldValue( "legacyArtifactPath.path" , path );
setFieldValue( "groupId" , groupId );
setFieldValue( "artifactId" , artifactId );
setFieldValue( "version" , version );
setFieldValue( "classifier" , classifier );
setFieldValue( "type" , type );
setFieldValue( "legacyArtifactPath.path", path );
setFieldValue( "groupId", groupId );
setFieldValue( "artifactId", artifactId );
setFieldValue( "version", version );
setFieldValue( "classifier", classifier );
setFieldValue( "type", type );
clickButtonWithValue( "Add Legacy Artifact Path" );
}
@ -676,11 +695,15 @@ public abstract class AbstractArchivaTest
{
assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" );
assertTextPresent( "Admin: Add Legacy Artifact Path" );
assertTextPresent( "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
String element = "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
assertTextPresent(
"Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
String element =
"addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
String[] arrayElement = element.split( "," );
for ( String arrayelement : arrayElement )
assertElementPresent( arrayelement );
{
assertElementPresent( arrayelement );
}
assertButtonWithValuePresent( "Add Legacy Artifact Path" );
}
@ -691,9 +714,9 @@ public abstract class AbstractArchivaTest
setFieldValue( "repository.id", identifier );
setFieldValue( "repository.name", name );
setFieldValue( "repository.location", directory );
setFieldValue( "repository.indexDir", indexDirectory );
setFieldValue( "repository.indexDirectory", indexDirectory );
selectValue( "repository.layout", type );
setFieldValue( "repository.refreshCronExpression", cron );
setFieldValue( "repository.cronExpression", cron );
setFieldValue( "repository.daysOlder", daysOlder );
setFieldValue( "repository.retentionCount", retentionCount );
checkField( "stageNeeded" );

View File

@ -273,9 +273,9 @@ public abstract class AbstractRepositoryTest
assertPage( "Apache Archiva \\ Admin: Edit Managed Repository" );
setFieldValue( "repository.name" , name );
setFieldValue( "repository.location" , directory );
setFieldValue( "repository.indexDir" , indexDirectory );
setFieldValue( "repository.indexDirectory" , indexDirectory );
selectValue( "repository.layout", type );
setFieldValue( "repository.refreshCronExpression" , cron );
setFieldValue( "repository.cronExpression" , cron );
setFieldValue( "repository.daysOlder" , daysOlder );
setFieldValue( "repository.retentionCount" , retentionCount );
clickButtonWithValue( "Update Repository" );