From a4f0edf9aa455cb7281782c1e865cd1aecd4cd7c Mon Sep 17 00:00:00 2001 From: Emmanuel Venisse Date: Sat, 23 Dec 2006 11:03:34 +0000 Subject: [PATCH] Use methods from maven-web-ui-tests git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@489879 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/test/AbstractArchivaTestCase.java | 76 ------------------- .../maven/archiva/web/test/LoginTest.java | 12 +-- 2 files changed, 3 insertions(+), 85 deletions(-) diff --git a/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/AbstractArchivaTestCase.java b/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/AbstractArchivaTestCase.java index d0d6e815e..5cb1c8d07 100644 --- a/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/AbstractArchivaTestCase.java +++ b/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/AbstractArchivaTestCase.java @@ -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(); - } } diff --git a/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/LoginTest.java b/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/LoginTest.java index c007d1c33..1cb0099fa 100644 --- a/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/LoginTest.java +++ b/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/LoginTest.java @@ -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" ); -- 2.39.5