]> source.dussan.org Git - archiva.git/commitdiff
Use methods from maven-web-ui-tests
authorEmmanuel Venisse <evenisse@apache.org>
Sat, 23 Dec 2006 11:03:34 +0000 (11:03 +0000)
committerEmmanuel Venisse <evenisse@apache.org>
Sat, 23 Dec 2006 11:03:34 +0000 (11:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@489879 13f79535-47bb-0310-9956-ffa450edef68

archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/AbstractArchivaTestCase.java
archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/LoginTest.java

index d0d6e815ef74e1b049e5c6b99a6146e81a9d317c..5cb1c8d071f9480df1f46e3b9a69cf1048716fc7 100644 (file)
@@ -27,34 +27,10 @@ import java.util.Calendar;
 public abstract class AbstractArchivaTestCase
     extends AbstractSeleniumTestCase
 {
-    protected String adminUsername = "admin";
-
-    protected String adminPassword = "admin1";
-
-    protected String adminFullName = "Archiva Admin";
-
-    protected String adminEmail = "admin@localhost.localdomain.com";
-
     private String baseUrl = "http://localhost:9595/archiva";
 
     public static final String CREATE_ADMIN_USER_PAGE_TITLE = "Maven Archiva :: Create Admin User";
 
-    protected void initialize()
-    {
-        getSelenium().open( "/archiva" );
-
-        if ( CREATE_ADMIN_USER_PAGE_TITLE.equals( getSelenium().getTitle() ) )
-        {
-            assertCreateAdminUserPage();
-            submitCreateAdminUserPage( adminFullName, adminEmail, adminPassword, adminPassword );
-            assertLoginPage();
-            submitLoginPage( adminUsername, adminPassword );
-            logout();
-        }
-
-        login();
-    }
-
     protected String getApplicationName()
     {
         return "Archiva";
@@ -65,15 +41,6 @@ public abstract class AbstractArchivaTestCase
         return "2005";
     }
 
-    public abstract void login();
-
-    public void assertFooter()
-    {
-        int currentYear = Calendar.getInstance().get( Calendar.YEAR );
-        assertTrue( getSelenium().getText( "xpath=//div[@id='footer']/div" ).endsWith(
-            " " + getInceptionYear() + "-" + currentYear + " Apache Software Foundation" ) );
-    }
-
     public void assertHeader()
     {
         assertTrue( "banner is missing" , getSelenium().isElementPresent( "xpath=//div[@id='banner']" ) );
@@ -92,47 +59,4 @@ public abstract class AbstractArchivaTestCase
     {
         return baseUrl;
     }
-
-    //////////////////////////////////////
-    // Create Admin User
-    //////////////////////////////////////
-    public void assertCreateAdminUserPage()
-    {
-        assertPage( CREATE_ADMIN_USER_PAGE_TITLE );
-        assertTextPresent( "Create Admin User" );
-        assertTextPresent( "Username" );
-        assertElementPresent( "user.username" );
-        assertTextPresent( "Full Name" );
-        assertElementPresent( "user.fullName" );
-        assertTextPresent( "Email Address" );
-        assertElementPresent( "user.email" );
-        assertTextPresent( "Password" );
-        assertElementPresent( "user.password" );
-        assertTextPresent( "Confirm Password" );
-        assertElementPresent( "user.confirmPassword" );
-    }
-
-    //////////////////////////////////////
-    // Login
-    //////////////////////////////////////
-    public void assertLoginPage()
-    {
-        assertPage( "Maven Archiva :: Login Page" );
-        assertTextPresent( "Login" );
-        assertTextPresent( "Username" );
-        assertTextPresent( "Password" );
-        assertTextPresent( "Remember Me" );
-        assertFalse( isChecked( "rememberMe" ) );
-    }
-
-    public void submitCreateAdminUserPage( String fullName, String email, String password, String confirmPassword )
-    {
-        Selenium sel = getSelenium();
-        sel.type( "user.fullName", fullName );
-        sel.type( "user.email", email );
-        sel.type( "user.password", password );
-        sel.type( "user.confirmPassword", confirmPassword );
-        sel.click( "//input[@type='submit']" );
-        waitPage();
-    }
 }
index c007d1c333e3df85366356008eefcf600515db03..1cb0099faaa9a06355782349537f454f896dd061 100644 (file)
@@ -26,29 +26,23 @@ public class LoginTest
 {
     public void testBadLogin()
     {
-        getSelenium().open( "/archiva/login.action" );
+        goToLoginPage();
         submitLoginPage( "badUsername", "badPassword", false );
-        assertLoginPage();
         assertTextPresent( "Authentication failed" );
     }
 
     public void testUserLogin()
     {
         createUser( "user", "user01" );
-        getSelenium().open( "/archiva/login.action" );
-        assertLoginPage();
+        goToLoginPage();
         submitLoginPage( "user", "user01" );
     }
 
-    public void login()
-    {
-    }
-
     private void createUser( String username, String password )
     {
         Selenium sel = getSelenium();
 
-        sel.open( "/archiva/security/login.action" );
+        goToLoginPage();
         submitLoginPage( adminUsername, adminPassword );
 
         sel.open( "/archiva/security/userlist.action" );