From 279afcd76a1d1f970eee182070a706245c327bdf Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 29 Dec 2011 13:53:01 +0000 Subject: [PATCH] fix selenium tests for webapp-js git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1225529 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-webapp-test-js/pom.xml | 2 +- .../archiva/web/test/ArchivaAdminTest.java | 2 +- .../apache/archiva/web/test/LoginTest.java | 55 +++++++------------ 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml index c932399d4..3fbf0ace5 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml @@ -422,7 +422,7 @@ - http://localhost:${container.test.port}/archiva/index.html + http://localhost:${container.test.port}/archiva/index.html?request_lang=en diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java index 96de18c9c..84bdfef1b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java @@ -58,7 +58,7 @@ public class ArchivaAdminTest getSelenium().open( baseUrl ); - getSelenium().refresh(); + waitPage(); // if not admin user created create one if ( isElementVisible( "create-admin-link" ) ) diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java index a1ba7326a..b967a70fc 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java @@ -29,80 +29,67 @@ import org.testng.annotations.Test; * http://code.google.com/p/testng/source/browse/trunk/CHANGES.txt * Waiting 5.9 release. It's comming soon. */ + /** * Based on LoginTest of Emmanuel Venisse test. - * + * * @author José Morales Martínez * @version $Id$ */ -@Test( groups = { "login" }, dependsOnGroups = {"about"}) +@Test( groups = { "login" }, dependsOnGroups = { "about" } ) public class LoginTest extends AbstractArchivaTest { - @Test(alwaysRun = true) + @Test( alwaysRun = true ) public void testWithBadUsername() { goToLoginPage(); setFieldValue( "user-login-form-username", "badUsername" ); + clickLinkWithLocator( "modal-login-ok", true ); + assertTextPresent( "This field is required." ); - waitPage(); - assertElementPresent( "//ul[@class=\'errorMessage\']" ); - //assertTextPresent( "You have entered an incorrect username and/or password" ); } @Test( dependsOnMethods = { "testWithBadUsername" }, alwaysRun = true ) public void testWithBadPassword() { goToLoginPage(); - setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) ); - setFieldValue( "loginForm_password", "badPassword" ); - getSelenium().click( "loginSubmit" ); - //getSelenium().waitForPageToLoad( maxWaitTimeInMs ); - waitPage(); - //assertTextPresent( "You have entered an incorrect username and/or password" ); - //