Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 46641 invoked from network); 6 Nov 2006 16:05:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Nov 2006 16:05:28 -0000 Received: (qmail 87156 invoked by uid 500); 6 Nov 2006 16:05:39 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 87126 invoked by uid 500); 6 Nov 2006 16:05:39 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 87113 invoked by uid 99); 6 Nov 2006 16:05:39 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Nov 2006 08:05:39 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Nov 2006 08:05:27 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id D33091A9846; Mon, 6 Nov 2006 08:05:00 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r471774 - in /maven/continuum/trunk/continuum-webapp-test: ./ src/test/it/org/apache/continuum/web/test/ Date: Mon, 06 Nov 2006 16:05:00 -0000 To: continuum-commits@maven.apache.org From: evenisse@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061106160500.D33091A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: evenisse Date: Mon Nov 6 08:04:59 2006 New Revision: 471774 URL: http://svn.apache.org/viewvc?view=rev&rev=471774 Log: Use the new maven-web-ui-tests module from shared Added: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java - copied, changed from r470978, maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java Removed: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java Modified: maven/continuum/trunk/continuum-webapp-test/pom.xml maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAccessTestCase.java maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractGuestAccessTestCase.java maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/LoginTest.java Modified: maven/continuum/trunk/continuum-webapp-test/pom.xml URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/pom.xml?view=diff&rev=471774&r1=471773&r2=471774 ============================================================================== --- maven/continuum/trunk/continuum-webapp-test/pom.xml (original) +++ maven/continuum/trunk/continuum-webapp-test/pom.xml Mon Nov 6 08:04:59 2006 @@ -31,38 +31,12 @@ war - org.openqa.selenium.client-drivers - selenium-java-client-driver - 0.8.1 - test - - - org.openqa.selenium.client-drivers - selenium-java-client-driver - 0.8.1 - test - - - org.openqa.selenium.server - selenium-server - 0.8.1 + org.apache.maven.shared + maven-web-ui-tests + 1.0-SNAPSHOT test - - - openqa - OpenQA Repository - http://maven.openqa.org - default - - true - - - true - - - src/test/it Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAccessTestCase.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAccessTestCase.java?view=diff&rev=471774&r1=471773&r2=471774 ============================================================================== --- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAccessTestCase.java (original) +++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAccessTestCase.java Mon Nov 6 08:04:59 2006 @@ -24,11 +24,10 @@ extends AbstractGuestAccessTestCase { public void setUp() + throws Exception { super.setUp(); - clickLinkWithText( "Login" ); - assertLoginPage(); - submitLoginPage( getUsername(), getPassword() ); + login( getUsername(), getPassword() ); } public abstract String getUsername(); Copied: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java (from r470978, maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java) URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java?view=diff&rev=471774&p1=maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java&r1=470978&p2=maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java&r2=471774 ============================================================================== --- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java (original) +++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java Mon Nov 6 08:04:59 2006 @@ -16,23 +16,15 @@ * limitations under the License. */ -import com.thoughtworks.selenium.DefaultSelenium; -import com.thoughtworks.selenium.Selenium; -import junit.framework.TestCase; -import org.codehaus.plexus.util.StringUtils; -import org.openqa.selenium.server.SeleniumServer; - -import java.util.Calendar; +import org.apache.maven.shared.web.test.AbstractSeleniumTestCase; /** * @author Emmanuel Venisse * @version $Id$ */ -public abstract class AbstractSeleniumTestCase - extends TestCase +public abstract class AbstractContinuumTestCase + extends AbstractSeleniumTestCase { - private Selenium sel; - protected String adminUsername = "admin"; protected String adminPassword = "admin1"; @@ -43,38 +35,15 @@ private String baseUrl = "http://localhost:9595/continuum"; - public void setUp() - { - String browser = System.getProperty( "browser" ); - if ( StringUtils.isEmpty( browser ) ) - { - browser = "*firefox"; - } - - sel = new DefaultSelenium( "localhost", SeleniumServer.DEFAULT_PORT, browser, baseUrl ); - sel.start(); - initialize(); - } - - public void tearDown() - { - sel.stop(); - } - - public Selenium getSelenium() - { - return sel; - } - /** * We create an admin user if it doesn't exist */ - private void initialize() + protected void initialize() { - sel.open( "/continuum" ); + open( "/continuum" ); waitPage(); - if ( "Create Admin User".equals( sel.getTitle() ) ) + if ( "Create Admin User".equals( getTitle() ) ) { assertCreateAdminUserPage(); submitCreateAdminUserPage( adminFullName, adminEmail, adminPassword, adminPassword ); @@ -86,92 +55,24 @@ } } - public String getHtmlContent() - { - return getSelenium().getHtmlSource(); - } - - public void assertTextPresent( String text ) - { - assertTrue( "'" + text + "' isn't present.", sel.isTextPresent( text ) ); - } - - public void assertTextNotPresent( String text ) - { - assertFalse( "'" + text + "' is present.", sel.isTextPresent( text ) ); - } - - public void assertElementPresent( String elementLocator ) - { - assertTrue( "'" + elementLocator + "' isn't present.", sel.isElementPresent( elementLocator ) ); - } - - public void assertElementNotPresent( String elementLocator ) - { - assertFalse( "'" + elementLocator + "' is present.", sel.isElementPresent( elementLocator ) ); - } - - public void assertLinkPresent( String text ) - { - assertTrue( "The link '" + text + "' isn't present.", sel.isElementPresent( "link=" + text ) ); - } - - public void assertLinkNotPresent( String text ) - { - assertFalse( "The link '" + text + "' is present.", sel.isElementPresent( "link=" + text ) ); - } - - public void waitPage() - { - waitPage( 30000 ); - } - - public void waitPage( int nbMillisecond ) - { - sel.waitForPageToLoad( String.valueOf( nbMillisecond ) ); - } - - public void assertPage( String title ) - { - assertEquals( title, sel.getTitle() ); - assertTrue( sel.getText( "xpath=//div[@id='footer']/table/tbody/tr/td" ).startsWith( "Continuum " ) ); - int currentYear = Calendar.getInstance().get( Calendar.YEAR ); - assertTrue( sel.getText( "xpath=//div[@id='footer']/table/tbody/tr/td" ).endsWith( - " 2005-" + currentYear + " Apache Software Foundation" ) ); - } - - public void clickLinkWithText( String text ) - { - clickLinkWithText( text, true ); - } - - public void clickLinkWithText( String text, boolean wait ) + protected String getApplicationName() { - clickLinkWithLocator( "link=" + text, wait ); + return "Continuum"; } - public void clickLinkWithXPath( String xpath ) + protected String getInceptionYear() { - clickLinkWithXPath( xpath, true ); + return "2005"; } - public void clickLinkWithXPath( String xpath, boolean wait ) + public void assertHeader() { - clickLinkWithLocator( "xpath=" + xpath, wait ); + //TODO } - public void clickLinkWithLocator( String locator ) + public String getBaseUrl() { - clickLinkWithLocator( locator, true ); - } - - public void clickLinkWithLocator( String locator, boolean wait ) - { - sel.click( locator ); - if ( wait ) - { - waitPage(); - } + return "http://localhost:9595/continuum"; } ////////////////////////////////////// @@ -195,72 +96,12 @@ public void submitCreateAdminUserPage( String fullName, String email, String password, String confirmPassword ) { - 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(); - } - - ////////////////////////////////////// - // Login - ////////////////////////////////////// - public void assertLoginPage() - { - assertPage( "Login Page" ); - assertTextPresent( "Login" ); - assertTextPresent( "Username" ); - assertTextPresent( "Password" ); - assertTextPresent( "Remember Me" ); - assertFalse( sel.isChecked( "rememberMe" ) ); - } - - public void submitLoginPage( String username, String password ) - { - submitLoginPage( username, password, false, true ); - } - - public void submitLoginPage( String username, String password, boolean validUsernamePassword ) - { - submitLoginPage( username, password, false, validUsernamePassword ); - } - - public void submitLoginPage( String username, String password, boolean rememberMe, boolean validUsernamePassword ) - { - sel.type( "username", username ); - sel.type( "password", password ); - if ( rememberMe ) - { - sel.check( "rememberMe" ); - } - sel.click( "submitButton" ); + setFieldValue( "user.fullName", fullName ); + setFieldValue( "user.email", email ); + setFieldValue( "user.password", password ); + setFieldValue( "user.confirmPassword", confirmPassword ); + submit(); waitPage(); - if ( validUsernamePassword ) - { - assertTextPresent( "Welcome, " + username + " - Logout" ); - assertLinkPresent( username ); - assertLinkPresent( "Logout" ); - } - else - { - assertLoginPage(); - } - } - - public boolean isAuthenticated() - { - return !( sel.isElementPresent( "link=Login" ) && sel.isElementPresent( "link=Register" ) ); - } - - ////////////////////////////////////// - // Logout - ////////////////////////////////////// - public void logout() - { - assertTrue( "User wasn't authenticated.", isAuthenticated() ); - clickLinkWithText( "Logout" ); - assertFalse( "The user is always authenticated after a logout.", isAuthenticated() ); } ////////////////////////////////////// @@ -289,20 +130,20 @@ public void submitConfigurationPage( String baseUrl, String companyName, String companyLogo, String companyUrl ) { - sel.type( "baseUrl", baseUrl ); + setFieldValue( "baseUrl", baseUrl ); if ( companyName != null ) { - sel.type( "companyName", companyName ); + setFieldValue( "companyName", companyName ); } if ( companyLogo != null ) { - sel.type( "companyLogo", companyLogo ); + setFieldValue( "companyLogo", companyLogo ); } if ( companyUrl != null ) { - sel.type( "companyUrl", companyUrl ); + setFieldValue( "companyUrl", companyUrl ); } - sel.click( "//input[@type='submit']" ); + submit(); waitPage(); } @@ -346,7 +187,7 @@ { assertPage( "Continuum - Group Summary" ); assertTextPresent( "Project Groups" ); - if ( sel.isTextPresent( "No Project Groups Known." ) ) + if ( isTextPresent( "No Project Groups Known." ) ) { assertTextNotPresent( "Name" ); assertTextNotPresent( "Group Id" ); Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractGuestAccessTestCase.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractGuestAccessTestCase.java?view=diff&rev=471774&r1=471773&r2=471774 ============================================================================== --- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractGuestAccessTestCase.java (original) +++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractGuestAccessTestCase.java Mon Nov 6 08:04:59 2006 @@ -21,9 +21,10 @@ * @version $Id$ */ public abstract class AbstractGuestAccessTestCase - extends AbstractSeleniumTestCase + extends AbstractContinuumTestCase { public void setUp() + throws Exception { super.setUp(); assertFalse( "User was authenticated.", isAuthenticated() ); Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java?view=diff&rev=471774&r1=471773&r2=471774 ============================================================================== --- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java (original) +++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java Mon Nov 6 08:04:59 2006 @@ -36,11 +36,11 @@ public void testAddAntProject() { goToAddAntPage(); - getSelenium().type( "projectName", "Foo" ); - getSelenium().type( "projectVersion", "1.0-SNAPSHOT" ); - getSelenium().type( "projectScmUrl", + setFieldValue( "projectName", "Foo" ); + setFieldValue( "projectVersion", "1.0-SNAPSHOT" ); + setFieldValue( "projectScmUrl", "https://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-test-projects/ant/" ); - clickLinkWithXPath( "//input[@type='submit']" ); + clickButtonWithValue( "Add" ); assertGroupSummaryPage(); assertTextPresent( "Default Project Group" ); clickLinkWithText( "Default Project Group"); @@ -52,7 +52,7 @@ public void testSubmitEmptyForm() { goToAddAntPage(); - clickLinkWithXPath( "//input[@type='submit']", false ); + clickButtonWithValue( "Add", false ); assertAddAntProjectPage(); assertTextPresent( "Name is required" ); assertTextPresent( "Version is required" ); @@ -62,7 +62,7 @@ public void testSubmitEmptyProjectName() { goToAddAntPage(); - clickLinkWithXPath( "//input[@type='submit']", false ); + clickButtonWithValue( "Add", false ); assertAddAntProjectPage(); assertTextPresent( "Name is required" ); } @@ -70,7 +70,7 @@ public void testSubmitEmptyVersion() { goToAddAntPage(); - clickLinkWithXPath( "//input[@type='submit']", false ); + clickButtonWithValue( "Add", false ); assertAddAntProjectPage(); assertTextPresent( "Version is required" ); } @@ -78,7 +78,7 @@ public void testSubmitEmptyScmUrl() { goToAddAntPage(); - clickLinkWithXPath( "//input[@type='submit']", false ); + clickButtonWithValue( "Add", false ); assertAddAntProjectPage(); assertTextPresent( "SCM Url is required" ); } Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/LoginTest.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/LoginTest.java?view=diff&rev=471774&r1=471773&r2=471774 ============================================================================== --- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/LoginTest.java (original) +++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/LoginTest.java Mon Nov 6 08:04:59 2006 @@ -24,6 +24,7 @@ extends AbstractGuestAccessTestCase { public void setUp() + throws Exception { super.setUp(); clickLinkWithText( "Login" );