fix locale dependant tests

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1137818 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-06-20 23:03:54 +00:00
parent 8715b0a767
commit 2bab67755e
2 changed files with 18 additions and 36 deletions

View File

@ -46,7 +46,7 @@
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<version>5.8</version> <version>5.9</version>
<scope>test</scope> <scope>test</scope>
<classifier>jdk15</classifier> <classifier>jdk15</classifier>
</dependency> </dependency>
@ -235,29 +235,6 @@
</activation> </activation>
<build> <build>
<plugins> <plugins>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>${project.build.directory}/${container.name}conf/webapps/archiva</directory>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>clean-webapp</id>
<phase>process-sources</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
@ -519,6 +496,7 @@
</activation> </activation>
<properties> <properties>
<selenium.browser>*googlechrome</selenium.browser> <selenium.browser>*googlechrome</selenium.browser>
<excluded.groups>requiresUpload</excluded.groups>
<excluded.groups/> <excluded.groups/>
</properties> </properties>
</profile> </profile>

View File

@ -40,14 +40,15 @@ import org.testng.annotations.Test;
public class LoginTest public class LoginTest
extends AbstractArchivaTest extends AbstractArchivaTest
{ {
@Test @Test(alwaysRun = true)
public void testWithBadUsername() public void testWithBadUsername()
{ {
goToLoginPage(); goToLoginPage();
setFieldValue( "loginForm_username", "badUsername" ); setFieldValue( "loginForm_username", "badUsername" );
clickButtonWithValue( "Login" ); getSelenium().click( "loginSubmit" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" ); assertElementPresent( "//ul[@class=\'errorMessage\']" );
//assertTextPresent( "You have entered an incorrect username and/or password" );
} }
@Test( dependsOnMethods = { "testWithBadUsername" }, alwaysRun = true ) @Test( dependsOnMethods = { "testWithBadUsername" }, alwaysRun = true )
@ -59,8 +60,7 @@ public class LoginTest
getSelenium().click( "loginSubmit" ); getSelenium().click( "loginSubmit" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
//assertTextPresent( "You have entered an incorrect username and/or password" ); //assertTextPresent( "You have entered an incorrect username and/or password" );
// <ul class="errorMessage"> //<ul class="errorMessage"><li><span>
assertElementPresent( "//ul[@class=\'errorMessage\']" ); assertElementPresent( "//ul[@class=\'errorMessage\']" );
} }
@ -69,9 +69,10 @@ public class LoginTest
{ {
goToLoginPage(); goToLoginPage();
setFieldValue( "loginForm_password", "password" ); setFieldValue( "loginForm_password", "password" );
clickButtonWithValue( "Login" ); getSelenium().click( "loginSubmit" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "User Name is required" ); //assertTextPresent( "User Name is required" );
assertElementPresent( "//tr[@errorFor=\'loginForm_username\']");
} }
@Test( dependsOnMethods = { "testWithEmptyUsername" }, alwaysRun = true ) @Test( dependsOnMethods = { "testWithEmptyUsername" }, alwaysRun = true )
@ -79,9 +80,10 @@ public class LoginTest
{ {
goToLoginPage(); goToLoginPage();
setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) ); setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
clickButtonWithValue( "Login" ); getSelenium().click( "loginSubmit" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" ); //assertTextPresent( "You have entered an incorrect username and/or password" );
assertElementPresent( "//ul[@class=\'errorMessage\']" );
} }
@Test( groups = { "loginSuccess" }, dependsOnMethods = { "testWithEmptyPassword" }, alwaysRun = true ) @Test( groups = { "loginSuccess" }, dependsOnMethods = { "testWithEmptyPassword" }, alwaysRun = true )
@ -90,10 +92,12 @@ public class LoginTest
goToLoginPage(); goToLoginPage();
setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) ); setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
setFieldValue( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) ); setFieldValue( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );
clickButtonWithValue( "Login" ); getSelenium().click( "loginSubmit" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "Edit Details" ); //assertTextPresent( "Logout" );
assertTextPresent( "Logout" ); assertElementPresent( "logoutLink" );
//assertTextPresent( "Edit Details" );
assertElementPresent( "editUserLink" );
assertTextPresent( getProperty( "ADMIN_USERNAME" ) ); assertTextPresent( getProperty( "ADMIN_USERNAME" ) );
} }