Index: src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java =================================================================== --- src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java (revision 2007) +++ src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java (working copy) @@ -1,7 +1,7 @@ package org.apache.continuum.web.test; /* - * Copyright 2006 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,50 +16,29 @@ * limitations under the License. */ -/** - * - */ +import org.apache.continuum.web.test.util.SeleniumTestCaseUtil; + public class AddMavenTwoProjectTest extends AbstractAuthenticatedAdminAccessTestCase { public void testAddMavenTwoProjectFromRemoteSource() throws Exception { - String pomUrl = "http://svn.apache.org/repos/asf/maven/pom/trunk/maven/pom.xml"; - String username = "dummy"; - String password = "dummy"; + // Enter values into Add Maven Two Project fields, and submit + addMavenTwoProject( TEST_POM_URL, TEST_POM_USERNAME, TEST_POM_PASSWORD, null ); - goToShowProjectGroups(); - - // Enter values into Add Maven Two Project fields, and submit - setFieldValue( "m2PomUrl", pomUrl ); - setFieldValue( "username", username ); - setFieldValue( "password", password ); - submit(); + assertProjectGroupsSummaryPage(); - assertGroupSummaryPage(); - - clickLinkWithText( "Default Project Group" ); - - clickLinkWithLocator( "//img[@alt='Delete']" ); - - assertElementPresent( "deleteProject_0" ); - assertElementPresent( "Cancel" ); - - clickLinkWithLocator( "deleteProject_0" ); + clickLinkWithText( DEFAULT_PROJ_GRP_NAME ); } - private void goToShowProjectGroups() + public void testAddMavenTwoProjectFromRemoteSourceToNonDefaultProjectGroup() throws Exception { - clickLinkWithText( "Maven 2.0.x Project" ); - - assertAddMaven2ProjectPage(); + addProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + + addMavenTwoProject( TEST_POM_URL, TEST_POM_USERNAME, TEST_POM_PASSWORD, TEST_PROJ_GRP_NAME ); + + SeleniumTestCaseUtil.assertCellValueFromTable( "1", this, "ec_table", 2, 2 ); } - - public void tearDown() - { - super.tearDown(); - } - } Index: src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java =================================================================== --- src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java (revision 2007) +++ src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java (working copy) @@ -16,8 +16,11 @@ * limitations under the License. */ +import org.apache.continuum.web.test.util.SeleniumTestCaseUtil; import org.apache.maven.shared.web.test.AbstractSeleniumTestCase; +import org.codehaus.plexus.util.FileUtils; + /** * @author Emmanuel Venisse * @version $Id: AbstractContinuumTestCase.java 471774 2006-11-06 16:04:59Z evenisse $ @@ -34,15 +37,30 @@ protected String adminEmail = "admin@localhost.localdomain.com"; private String baseUrl = "http://localhost:9595"; + + public final static String DEFAULT_PROJ_GRP_NAME = "Default Project Group"; + public final static String DEFAULT_PROJ_GRP_ID = "default"; + public final static String DEFAULT_PROJ_GRP_DESCRIPTION = "Contains all projects that do not have a group of their own"; + + public final static String TEST_PROJ_GRP_NAME = "Test Project Group Name"; + public final static String TEST_PROJ_GRP_ID = "Test Project Group Id"; + public final static String TEST_PROJ_GRP_DESCRIPTION = "Test Project Group Description"; + public final static String TEST_POM_URL = "http://svn.apache.org/repos/asf/maven/pom/trunk/maven/pom.xml"; + public final static String TEST_POM_USERNAME = "dummy"; + public final static String TEST_POM_PASSWORD = "dummy"; + + private final static int ONE_SECOND = 1000; + private final static int ONE_MINUTE = 60 * ONE_SECOND; + private final static int LONG_WAIT = 5 * ONE_MINUTE; /** * We create an admin user if it doesn't exist */ protected void initialize() { open( "/continuum" ); - waitPage(); - + waitPage( LONG_WAIT ); + if ( "Create Admin User".equals( getTitle() ) ) { assertCreateAdminUserPage(); @@ -51,10 +69,28 @@ submitLoginPage( adminUsername, adminPassword ); assertEditConfigurationPage(); submitConfigurationPage( baseUrl, null, null, null ); - logout(); + + + try { + addMavenTwoProject( TEST_POM_URL, TEST_POM_USERNAME, TEST_POM_PASSWORD, DEFAULT_PROJ_GRP_NAME ); + removeProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION ); + addProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION ); + + addProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + addMavenTwoProject( TEST_POM_URL, TEST_POM_USERNAME, TEST_POM_PASSWORD, TEST_PROJ_GRP_NAME ); + removeProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + } catch (Exception e) { + e.printStackTrace(); + } + + // logout with a longer delay + assertTrue( "User wasn't authenticated.", isAuthenticated() ); + clickLinkWithText( "Logout", false ); + waitPage( LONG_WAIT ); + assertFalse( "The user is always authenticated after a logout.", isAuthenticated() ); } } - + ////////////////////////////////////// // Overriden AbstractSeleniumTestCase methods ////////////////////////////////////// @@ -80,7 +116,7 @@ public void assertFooter() { - String footer = getSelenium().getText( "xpath=//div[@id='footer']/table/tbody/tr/td" ); + String footer = getSelenium().getText( "xpath=//div[@id='footer']/table/tbody/tr/td" ); assertEquals( footer, "Copyright © 2006 Mergere, Inc." ); } @@ -89,7 +125,7 @@ ////////////////////////////////////// public void assertCreateAdminUserPage() { - String title = getTitle(); + String title = getTitle(); assertPage( "Create Admin User" ); assertTextPresent( "Create Admin User" ); assertTextPresent( "Username" ); @@ -191,17 +227,24 @@ } public void assertAddAdminUserListPage() - throws Exception - { - assertPage( "[Admin] User List" ); - assertElementPresent( "buttonbar" ); - } + throws Exception + { + assertPage( "[Admin] User List" ); + } ////////////////////////////////////// - // Group Summary + // Project Groups ////////////////////////////////////// - public void assertGroupSummaryPage() + public void goToProjectGroupsSummaryPage() + throws Exception { + clickLinkWithText( "Show Project Groups" ); + + assertProjectGroupsSummaryPage(); + } + + public void assertProjectGroupsSummaryPage() + { assertPage( "Continuum - Group Summary" ); assertTextPresent( "Project Groups" ); if ( isTextPresent( "No Project Groups Known." ) ) @@ -220,11 +263,69 @@ } } + ////////////////////////////////////// + // Project Group + ////////////////////////////////////// + public void showProjectGroup( String name, String groupId, String description ) + throws Exception + { + goToProjectGroupsSummaryPage(); + + // Checks the link to the created Project Group + assertLinkPresent( name ); + clickLinkWithText( name ); + + assertTextPresent( "Project Group Actions" ); + assertTextPresent( "Project Name" ); + assertTextPresent( name ); + assertTextPresent( "Group Id" ); + assertTextPresent( groupId ); + assertTextPresent( "Description" ); + assertTextPresent( description ); + } + + public void assertProjectGroupSummaryPage( String name, String groupId, String description ) + { + assertTextPresent( "Project Group Actions" ); + assertTextPresent( "Project Name" ); + assertTextPresent( name ); + assertTextPresent( "Group Id" ); + assertTextPresent( groupId ); + assertTextPresent( "Description" ); + assertTextPresent( description ); + + // Assert the available Project Group Actions + assertTextPresent( "Project Group Actions"); + assertElementPresent( "build" ); + assertElementPresent( "edit" ); + assertElementPresent( "remove" ); + } + + public void addProjectGroup( String name, String groupId, String description ) + throws Exception + { + goToProjectGroupsSummaryPage(); + + // Go to Add Project Group Page + assertLinkPresent( "Add a Project Group" ); + clickLinkWithText( "Add a Project Group" ); + assertAddProjectGroupPage(); + + // Enter values into Add Project Group fields, and submit + setFieldValue( "name", name ); + setFieldValue( "groupId", groupId ); + setFieldValue( "description", description ); + + submit(); + waitPage(); + + } + public void assertAddProjectGroupPage() { - assertPage( "Continuum - Add Continuum Project Group" ); - - assertTextPresent( "Add Continuum Project Group" ); + assertPage( "Continuum - Add Continuum Project Group" ); + + assertTextPresent( "Add Continuum Project Group" ); assertTextPresent( "Project Group Name" ); assertElementPresent( "name" ); assertTextPresent( "Project Group Id" ); @@ -233,52 +334,156 @@ assertElementPresent( "description" ); } - public void assertShowContinuumProject( String name, String groupId, String description ) + public void removeProjectGroup( String name, String groupId, String description ) + throws Exception { - assertShowContinuumProjectSummary( name, groupId, description ); + showProjectGroup( name, groupId, description ); + + // Remove + SeleniumTestCaseUtil.clickSubmitWithLocator( this, "remove" ); + + // Assert Confirmation + assertElementPresent( "removeProjectGroup_0" ); + assertElementPresent( "Cancel" ); + + // Confirm Project Group deletion + SeleniumTestCaseUtil.clickSubmitWithLocator( this, "removeProjectGroup_0" ); + } - - public void assertShowContinuumProjectSummary( String name, String groupId, String description ) + + ////////////////////////////////////// + // Maven 2.0.x Project + ////////////////////////////////////// + public void goToAddMavenProjectPage() + throws Exception { - // Assert the Project Group's informations - assertTextPresent( "Project Group Actions" ); - assertTextPresent( "Project Name" ); - assertTextPresent( name ); - assertTextPresent( "Group Id" ); - assertTextPresent( groupId ); - assertTextPresent( "Description" ); - assertTextPresent( description ); - - // Assert the available Project Group Actions - assertTextPresent( "Project Group Actions"); - assertElementPresent( "build" ); - assertElementPresent( "edit" ); - assertElementPresent( "remove" ); + clickLinkWithText( "Maven 2.0.x Project" ); + + assertAddMavenTwoProjectPage(); + } - - /* - TODO assert the different tabs - assertShowContinuumProjectMembers(); - assertShowContinuumProjectBuildDefinition(); - assertShowContinuumProjectMembers(); - */ + public void assertAddMavenTwoProjectPage() + throws Exception + { + assertTextPresent( "POM Url" ); + assertElementPresent( "m2PomUrl" ); + assertTextPresent( "Username" ); + assertElementPresent( "username" ); + assertTextPresent( "Password" ); + assertElementPresent( "password" ); + assertTextPresent( "Upload POM" ); + assertElementPresent( "m2PomFile" ); + assertTextPresent( "Project Group" ); + assertElementPresent( "selectedProjectGroup" ); } + public void addMavenTwoProject( String pomUrl, String username, String password, String projectGroup ) + throws Exception + { + goToAddMavenProjectPage(); + + // Enter values into Add Maven Two Project fields, and submit + setFieldValue( "m2PomUrl", pomUrl ); + setFieldValue( "username", username ); + setFieldValue( "password", password ); + + if ( projectGroup != null ) + { + SeleniumTestCaseUtil.selectValue( this, "addMavenTwoProject_selectedProjectGroup", projectGroup ); + } + + submit(); + } + + public void moveProjectToProjectGroup( String name, String groupId, String description, String newProjectGroup ) + throws Exception + { + showProjectGroup( name, groupId, description ); + + assertElementPresent( "edit" ); + clickButtonWithValue( "Edit" ); + + assertTextPresent( "Move to Group" ); + SeleniumTestCaseUtil.selectValue( this, "//select", newProjectGroup ); + + assertElementPresent( "saveProjectGroup_0" ); + clickButtonWithValue( "Save" ); + } + ////////////////////////////////////// - // Maven 2.0.x Project + // My Account ////////////////////////////////////// - public void assertAddMaven2ProjectPage() + public void goToMyAccount() + { + clickLinkWithText( "Edit user info" ); + } + + public void assertMyAccountDetails( String username, String newFullName, String newEmailAddress ) throws Exception { - assertTextPresent( "POM Url" ); - assertElementPresent( "m2PomUrl" ); - assertTextPresent( "Username" ); - assertElementPresent( "username" ); - assertTextPresent( "Password" ); - assertElementPresent( "password" ); - assertTextPresent( "Upload POM" ); - assertElementPresent( "m2PomFile" ); - assertTextPresent( "Project Group" ); - assertElementPresent( "selectedProjectGroup" ); + assertPage( "Account Details" ); + + isTextPresent( "Username" ); + assertTextPresent( "Username" ); + assertElementPresent( "registerForm_user_username" ); + SeleniumTestCaseUtil.assertCellValueFromTable( username, this, "//form/table", 0, 1 ); + + assertTextPresent( "Full Name" ); + assertElementPresent( "user.fullName" ); + assertEquals( newFullName, getFieldValue( "user.fullName" ) ); + + assertTextPresent( "Email Address" ); + assertElementPresent( "user.email" ); + assertEquals( newEmailAddress, getFieldValue( "user.email" ) ); + + assertTextPresent( "Password" ); + assertElementPresent( "user.password" ); + + assertTextPresent( "Confirm Password" ); + assertElementPresent( "user.confirmPassword" ); + + assertTextPresent( "Last Password Change" ); + assertElementPresent( "registerForm_user_timestampLastPasswordChange" ); + } + + public void editMyUserInfo( String newFullName, String newEmailAddress, String newPassword, String confirmNewPassword ) + { + goToMyAccount(); + + setFieldValue( "user.fullName", newFullName ); + setFieldValue( "user.email", newEmailAddress ); + setFieldValue( "user.password", newPassword ); + setFieldValue( "user.confirmPassword", confirmNewPassword ); + } + + ////////////////////////////////////// + // Login + ////////////////////////////////////// + public void goToLoginPage() + { + clickLinkWithText( "Login" ); + } + + public void tearDown() + { + try { + goToProjectGroupsSummaryPage(); + + if ( isLinkPresent( TEST_PROJ_GRP_NAME ) ) + { + removeProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + } + if ( isLinkPresent( DEFAULT_PROJ_GRP_NAME ) + && "0".equals( SeleniumTestCaseUtil.getCellValueFromTable( this, "ec_table", 1, 2) ) == false ) + { + removeProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION ); + addProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION ); + } + } catch (Exception e) { + e.printStackTrace(); + } + + super.tearDown(); + } } Index: src/test/it/org/apache/continuum/web/test/AntTest.java =================================================================== --- src/test/it/org/apache/continuum/web/test/AntTest.java (revision 2007) +++ src/test/it/org/apache/continuum/web/test/AntTest.java (working copy) @@ -1,5 +1,7 @@ package org.apache.continuum.web.test; +import org.apache.continuum.web.test.util.SeleniumTestCaseUtil; + /* * Copyright 2005-2006 The Apache Software Foundation. * @@ -23,13 +25,9 @@ public class AntTest extends AbstractAuthenticatedAdminAccessTestCase { - public void testTrue() + public void testAddAntProject() + throws Exception { - assertTrue( true ); - } - - /*public void testAddAntProject() - { goToAddAntPage(); setFieldValue( "projectName", "Foo" ); setFieldValue( "projectVersion", "1.0-SNAPSHOT" ); @@ -37,11 +35,11 @@ "https://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-test-projects/ant/" ); clickButtonWithValue( "Add" ); - assertGroupSummaryPage(); + assertProjectGroupsSummaryPage(); assertTextPresent( "Default Project Group" ); clickLinkWithText( "Default Project Group"); assertTextPresent( "Foo"); - + //TODO Add more tests (values in Default Project Group, values in project view, notifiers, build defintions, delete, build,...) } @@ -83,5 +81,5 @@ { clickLinkWithText( "Ant Project" ); assertAddAntProjectPage(); - }*/ + } } Index: src/test/it/org/apache/continuum/web/test/MyAccountTest.java =================================================================== --- src/test/it/org/apache/continuum/web/test/MyAccountTest.java (revision 0) +++ src/test/it/org/apache/continuum/web/test/MyAccountTest.java (revision 0) @@ -0,0 +1,35 @@ +/** + * + */ +package org.apache.continuum.web.test; + +/** + * + */ +public class MyAccountTest + extends AbstractAuthenticatedAdminAccessTestCase +{ + public void testMyAccountEdit() + throws Exception + { + String newFullName = "Continuum Admin _ new"; + String newEmail = "admin_new@localhost.localdomain.com"; + String newPassword = "admin1_new"; + String newConfirmationPassword = newPassword; + + goToMyAccount(); + + // check current account details + assertMyAccountDetails( adminUsername, adminFullName, adminEmail ); + + // change account details + editMyUserInfo( newFullName, newEmail, newPassword, newConfirmationPassword ); + assertMyAccountDetails( adminUsername, newFullName, newEmail ); + + // revert to original account details + editMyUserInfo( adminFullName, adminEmail, adminPassword, adminPassword ); + assertMyAccountDetails( adminUsername, adminFullName, adminEmail ); + } + + +} Index: src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java =================================================================== --- src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java (revision 0) +++ src/test/it/org/apache/continuum/web/test/ProjectGroupTest.java (revision 0) @@ -0,0 +1,85 @@ +package org.apache.continuum.web.test; + +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.continuum.web.test.util.SeleniumTestCaseUtil; + +public class ProjectGroupTest + extends AbstractAuthenticatedAdminAccessTestCase +{ + public void testAddRemoveProjectGroup() + throws Exception + { + addProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + + showProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + + removeProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + } + + public void testDefaultBuildDefinition() + throws Exception + { + goToProjectGroupsSummaryPage(); + + showProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION ); + + assertLinkPresent( "Build Definition" ); + clickLinkWithText( "Build Definition" ); + + String tableElement = "ec_table"; + SeleniumTestCaseUtil.assertCellValueFromTable( "Goals", this, tableElement, 0, 0 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "Arguments", this, tableElement, 0, 1 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "Build File", this, tableElement, 0, 2 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "Profile", this, tableElement, 0, 3 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "schedule", this, tableElement, 0, 4 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "From", this, tableElement, 0, 5 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "Default", this, tableElement, 0, 6 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "Edit", this, tableElement, 0, 7 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "Remove", this, tableElement, 0, 8 ); + + SeleniumTestCaseUtil.assertCellValueFromTable( "clean install", this, tableElement, 1, 0); + SeleniumTestCaseUtil.assertCellValueFromTable( "--batch-mode --non-recursive", this, tableElement, 1, 1 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "pom.xml", this, tableElement, 1, 2 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "", this, tableElement, 1, 3 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "DEFAULT_SCHEDULE", this, tableElement, 1, 4 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "GROUP", this, tableElement, 1, 5 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "true", this, tableElement, 1, 6 ); + SeleniumTestCaseUtil.assertImgWithAlt( this, "Edit" ); + SeleniumTestCaseUtil.assertImgWithAlt( this, "Delete" ); + } + + public void testMoveProject() + throws Exception + { + // Add a project group and a project to it + addProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION ); + addMavenTwoProject( TEST_POM_URL, TEST_POM_USERNAME, TEST_POM_PASSWORD, TEST_PROJ_GRP_NAME ); + + // assert that the default project group has 0 projects while the test project group has 1 + SeleniumTestCaseUtil.assertCellValueFromTable( "0", this, "ec_table", 1, 2 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "1", this, "ec_table", 2, 2 ); + + // move the project of the test project group to the default project group + moveProjectToProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION, DEFAULT_PROJ_GRP_NAME ); + + // assert that the default project group now has 1 while the test project group has 0 + goToProjectGroupsSummaryPage(); + SeleniumTestCaseUtil.assertCellValueFromTable( "1", this, "ec_table", 1, 2 ); + SeleniumTestCaseUtil.assertCellValueFromTable( "0", this, "ec_table", 2, 2 ); + } +} Index: src/test/it/org/apache/continuum/web/test/LoginTest.java =================================================================== --- src/test/it/org/apache/continuum/web/test/LoginTest.java (revision 2007) +++ src/test/it/org/apache/continuum/web/test/LoginTest.java (working copy) @@ -35,14 +35,14 @@ { submitLoginPage( "badUsername", "badPassword", false ); assertLoginPage(); - assertTextPresent( "Authentication failed" ); + assertTextPresent( "You have entered an incorrect username and/or password" ); } public void testWithBadPassword() { submitLoginPage( adminUsername, "badPassword", false ); assertLoginPage(); - assertTextPresent( "Authentication failed" ); + assertTextPresent( "You have entered an incorrect username and/or password" ); } public void testWithEmptyUsername() @@ -56,7 +56,7 @@ { submitLoginPage( adminUsername, "", false ); assertLoginPage(); - assertTextPresent( "Authentication failed" ); + assertTextPresent( "You have entered an incorrect username and/or password" ); } public void testWithCorrectUsernamePassword() Index: src/test/it/org/apache/continuum/web/test/UserGroupTest.java =================================================================== --- src/test/it/org/apache/continuum/web/test/UserGroupTest.java (revision 2007) +++ src/test/it/org/apache/continuum/web/test/UserGroupTest.java (working copy) @@ -22,7 +22,7 @@ public class UserGroupTest extends AbstractAuthenticatedAdminAccessTestCase { - public void testTrue() + public void testUserGroup() throws Exception { goToUserGroup(); Index: src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAdminAccessTestCase.java =================================================================== --- src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAdminAccessTestCase.java (revision 2007) +++ src/test/it/org/apache/continuum/web/test/AbstractAuthenticatedAdminAccessTestCase.java (working copy) @@ -1,7 +1,12 @@ +/** + * + */ package org.apache.continuum.web.test; +import org.apache.continuum.web.test.util.SeleniumTestCaseUtil; + /* - * Copyright 2006 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,25 +21,20 @@ * limitations under the License. */ -/** - * - */ public abstract class AbstractAuthenticatedAdminAccessTestCase extends AbstractAuthenticatedAccessTestCase { + /** + * @see org.apache.continuum.web.test.AbstractAuthenticatedAccessTestCase#getPassword() + */ + public String getPassword() { + return adminPassword; + } - /** - * @see org.apache.continuum.web.test.AbstractAuthenticatedAccessTestCase#getPassword() - */ - public String getPassword() { - return adminPassword; - } - - /** - * @see org.apache.continuum.web.test.AbstractAuthenticatedAccessTestCase#getUsername() - */ - public String getUsername() { - return adminUsername; - } - -} + /** + * @see org.apache.continuum.web.test.AbstractAuthenticatedAccessTestCase#getUsername() + */ + public String getUsername() { + return adminUsername; + } +} \ No newline at end of file Index: src/test/it/org/apache/continuum/web/test/util/SeleniumTestCaseUtil.java =================================================================== --- src/test/it/org/apache/continuum/web/test/util/SeleniumTestCaseUtil.java (revision 0) +++ src/test/it/org/apache/continuum/web/test/util/SeleniumTestCaseUtil.java (revision 0) @@ -0,0 +1,53 @@ +package org.apache.continuum.web.test.util; + +import org.apache.maven.shared.web.test.AbstractSeleniumTestCase; + +/** + * TODO: Place the commands here in maven-web-ui-tests + */ +public class SeleniumTestCaseUtil +{ + public static String getCellValueFromTable( AbstractSeleniumTestCase source, String tableElement, int row, int column ) + { + return source.getSelenium().getTable( tableElement + "." + row + "." + column ); + } + + public static void assertCellValueFromTable( String expected, AbstractSeleniumTestCase source, String tableElement, int row, int column ) + { + source.assertEquals( expected, getCellValueFromTable( source, tableElement, row, column ) ); + } + + public static void clickImgWithAlt( AbstractSeleniumTestCase source, String alt ) + { + source.clickLinkWithLocator( "//img[@alt='" + alt + "']" ); + } + + public static void assertImgWithAlt( AbstractSeleniumTestCase source, String alt ) + { + source.assertElementPresent( "//img[@alt='" + alt + "']" ); + } + + public static void assertImgWithAltAtRowCol( AbstractSeleniumTestCase source, boolean isALink, String alt, int row, int column ) + { + String locator = "//tr[" + row + "]/td[" + column + "]/"; + locator += isALink ? "a/" : ""; + locator += "img[@alt='" + alt + "']"; + + source.assertElementPresent( locator ); + } + + public static void clickSubmitWithLocator( AbstractSeleniumTestCase source, String locator ) + { + source.clickLinkWithLocator( locator ); + } + + public static void clickSubmitWithLocator( AbstractSeleniumTestCase source, String locator, boolean willWait ) + { + source.clickLinkWithLocator( locator, willWait ); + } + + public static void selectValue( AbstractSeleniumTestCase source, String locator, String value ) + { + source.getSelenium().select( locator, "label=" + value ); + } +} Index: pom.xml =================================================================== --- pom.xml (revision 2007) +++ pom.xml (working copy) @@ -36,6 +36,12 @@ 1.0-SNAPSHOT test + + org.codehaus.plexus + plexus-utils + 1.0.4 + test + Index: Readme.txt =================================================================== --- Readme.txt (revision 2007) +++ Readme.txt (working copy) @@ -7,5 +7,11 @@ Test Continuum with Tomcat 5.x and a specific browser 'mvn clean install -Ptomcat5x,otherbrowser -DbrowserPath=PATH_TO_YOUR_BROWSER' -Warning: If you specify your own custom browser, it's up to you to configure it correctly. At a minimum, you'll need to configure your browser to use the Selenium Server as a proxy, and disable all browser-specific prompting. -http://release.openqa.org/selenium-remote-control/nightly/doc/java/com/thoughtworks/selenium/DefaultSelenium.html#DefaultSelenium(java.lang.String,%20int,%20java.lang.String,%20java.lang.String) \ No newline at end of file +Test Continuum with Tomcat 5.x and firefox wherein your firefox executable is not in the default installation directory + 'mvn clean install' or 'mvn clean install -Ptomcat5x,firefox -Dbrowser="*firefox ' + +Test Continuum with Tomcat 5.x and Internet Explorer wherein your Internet Explorer executable is not in the default installation directory + 'mvn clean install' or 'mvn clean install -Ptomcat5x,firefox -Dbrowser="*iexplore ' + +WARNING: If you specify your own custom browser, it's up to you to configure it correctly. At a minimum, you'll need to configure your browser to use the Selenium Server as a proxy, and disable all browser-specific prompting. +http://release.openqa.org/selenium-remote-control/nightly/doc/java/com/thoughtworks/selenium/DefaultSelenium.html#DefaultSelenium(java.lang.String,%20int,%20java.lang.String,%20java.lang.String)