You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ct...@apache.org on 2009/11/10 06:38:03 UTC
svn commit: r834357 [6/7] - in
/continuum/branches/continuum-1.3.x/continuum-webapp-test: ./ src/site/
src/site/apt/ src/test/it/org/apache/continuum/web/test/
src/test/resources/ src/test/testng/config/
src/test/testng/org/apache/continuum/web/test/ s...
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildAgentsTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildAgentsTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildAgentsTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildAgentsTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,232 @@
+package org.apache.continuum.web.test.parent;
+
+//import org.testng.Assert;
+import org.apache.continuum.web.test.ConfigurationTest;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+public abstract class AbstractBuildAgentsTest
+ extends AbstractContinuumTest
+{
+ public void enableDistributedBuilds()
+ {
+ ConfigurationTest config = new ConfigurationTest();
+ config.goToConfigurationPage();
+ setFieldValue( "numberOfAllowedBuildsinParallel", "2" );
+ if ( !isChecked( "configuration_distributedBuildEnabled" ) )
+ {
+ checkField( "configuration_distributedBuildEnabled" );
+ }
+ clickAndWait( "configuration_" );
+ assertTextPresent( "true" );
+ assertTextPresent( "Distributed Builds" );
+ assertElementPresent( "link=Build Agents" );
+ }
+
+ public void disableDistributedBuilds()
+ {
+ ConfigurationTest config = new ConfigurationTest();
+ config.goToConfigurationPage();
+ setFieldValue( "numberOfAllowedBuildsinParallel", "2" );
+ if ( isChecked( "configuration_distributedBuildEnabled" ) )
+ {
+ uncheckField( "configuration_distributedBuildEnabled" );
+ }
+ submit();
+ assertTextPresent( "false" );
+ assertElementNotPresent( "link=Build Agents" );
+ }
+
+ public void goToBuildAgentPage()
+ {
+ clickAndWait("link=Build Agents");
+ assertPage("Continuum - Build Agents");
+ }
+
+ public void assertBuildAgentPage()
+ {
+ assertPage("Continuum - Build Agents");
+ assertTextPresent("Build Agents");
+ assertTextPresent("Build Agent Groups");
+ assertButtonWithValuePresent( "Add" );
+
+ }
+
+ public void goToAddBuildAgent()
+ {
+ goToBuildAgentPage();
+ assertBuildAgentPage();
+ clickAndWait("editBuildAgent_0"); //add button
+ assertAddEditBuildAgentPage();
+ }
+
+ public void assertAddEditBuildAgentPage()
+ {
+ assertPage( "Continuum - Add/Edit Build Agent" );
+ assertTextPresent( "Add/Edit Build Agent" );
+ assertTextPresent( "Build Agent URL*:" );
+ assertTextPresent( "Description:" );
+ assertTextPresent( "Enabled" );
+ assertElementPresent( "saveBuildAgent_buildAgent_url" );
+ assertElementPresent( "saveBuildAgent_buildAgent_description");
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void removeBuildAgent( String agentName )
+ {
+ clickLinkWithXPath( "(//a[contains(@href,'deleteBuildAgent.action') and contains(@href, '" + agentName + "')])//img" );
+ assertPage("Continuum - Delete Build Agent");
+ assertTextPresent( "Delete Build Agent" );
+ assertTextPresent( "Are you sure you want to delete build agent " + agentName + " ?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertBuildAgentPage();
+ }
+
+ public void addBuildAgent( String agentURL, String description, boolean success )
+ {
+ setFieldValue( "saveBuildAgent_buildAgent_url", agentURL );
+ setFieldValue("saveBuildAgent_buildAgent_description", description );
+ checkField("saveBuildAgent_buildAgent_enabled");
+ submit();
+ if ( success )
+ {
+ assertBuildAgentPage();
+ assertElementPresent( "link=" + agentURL );
+
+ }
+ else
+ {
+ assertAddEditBuildAgentPage();
+ }
+
+ }
+
+ public void goToEditBuildAgent( String name, String description )
+ {
+ goToBuildAgentPage();
+ clickImgWithAlt( "Edit" );
+ assertAddEditBuildAgentPage();
+ assertFieldValue( name, "saveBuildAgent_buildAgent_url" );
+ assertFieldValue( description, "saveBuildAgent_buildAgent_description" );
+
+ }
+
+ public void addEditBuildAgent( String agentName, String newDesc )
+ {
+ assertFieldValue( agentName, "saveBuildAgent_buildAgent_url" );
+ setFieldValue( "saveBuildAgent_buildAgent_description", newDesc );
+ submit();
+ assertBuildAgentPage();
+ assertTextPresent( newDesc );
+
+ }
+
+
+ public void goToAddBuildAgentGroup()
+ {
+ goToBuildAgentPage();
+ clickAndWait("editBuildAgentGroup_0"); //add button
+ String[] options =
+ new String[] { "--- Available Build Agents ---", "Agent_url_name", "Second_Agent" };
+ assertAddEditBuildAgentGroupPage( options, null );
+ }
+
+
+ public void addEditBuildAgentGroup( String name, String[] addBuildAgents, String[] removeBuildAgents,
+ boolean success ) throws Exception
+ {
+ setFieldValue( "saveBuildAgentGroup_buildAgentGroup_name", name );
+ if ( addBuildAgents != null && addBuildAgents.length > 0 )
+ {
+ for ( String ba : addBuildAgents )
+ {
+ selectValue( "buildAgentIds", ba );
+ clickButtonWithValue( "->", false );
+ }
+ }
+ if ( removeBuildAgents != null && removeBuildAgents.length > 0 )
+ {
+ for ( String ba : removeBuildAgents )
+ {
+ selectValue( "selectedBuildAgentIds", ba );
+ clickButtonWithValue( "<-", false );
+ }
+ }
+ submit();
+ if ( success )
+ {
+ assertBuildAgentPage();
+ }
+ else
+ {
+ assertAddEditBuildAgentGroupPage( null, null );
+ }
+
+
+ }
+
+ public void assertAddEditBuildAgentGroupPage( String[] availableBuildAgents, String[] usedBuildAgents )
+ {
+ assertPage( "Continuum - Add/Edit Build Agent Group" );
+ assertTextPresent( "Add/Edit Build Agent Group" );
+ assertTextPresent( "Name*:" );
+ assertTextPresent( "Configure the used Build Agents:" );
+ assertElementPresent( "buildAgentGroup.name" );
+ if ( availableBuildAgents != null && availableBuildAgents.length > 0 )
+ {
+ assertOptionPresent( "buildAgentIds", availableBuildAgents );
+ }
+ if ( usedBuildAgents != null && usedBuildAgents.length > 0 )
+ {
+ assertOptionPresent( "selectedBuildAgentIds", usedBuildAgents );
+ }
+
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void goToEditBuildAgentGroup( String name, String[] buildAgents )
+ {
+ goToBuildAgentPage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertAddEditBuildAgentGroupPage( null, buildAgents );
+ assertFieldValue( name, "buildAgentGroup.name" );
+ }
+
+
+ public void removeBuildAgentGroup( String name )
+ {
+ goToBuildAgentPage();
+ clickLinkWithXPath( "(//a[contains(@href,'deleteBuildAgentGroup.action') and contains(@href, '" + name + "')])//img" );
+ assertPage("Continuum - Delete Build Agent Group");
+ assertTextPresent( "Delete Build Agent" );
+ assertTextPresent( "Are you sure you want to delete build agent group " + name + " ?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertBuildAgentPage();
+ }
+
+
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildDefinitionTemplateTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildDefinitionTemplateTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildDefinitionTemplateTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildDefinitionTemplateTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,228 @@
+package org.apache.continuum.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+public abstract class AbstractBuildDefinitionTemplateTest
+ extends AbstractContinuumTest
+{
+ public void goToBuildDefinitionTemplatePage()
+ {
+ clickLinkWithText( "Build Definition Templates" );
+ assertBuildDefinitionTemplatePage();
+ }
+
+ public void assertBuildDefinitionTemplatePage()
+ {
+ assertPage( "Continuum - Build Definition Templates" );
+ assertTextPresent( "Available Templates" );
+ assertTextPresent( "Available Build Definitions" );
+ assertButtonWithIdPresent( "buildDefinitionTemplate_0" );
+ assertButtonWithIdPresent( "buildDefinitionAsTemplate_0" );
+ }
+
+ public void goToAddTemplate()
+ {
+ goToBuildDefinitionTemplatePage();
+ clickSubmitWithLocator( "buildDefinitionTemplate_0" );
+ String[] options =
+ new String[] { "--- Available Build Definitions ---", "Default Ant Build Definition",
+ "Default Maven 1 Build Definition", "Default Maven 2 Build Definition",
+ "Default Shell Build Definition" };
+ assertAddEditTemplatePage( options, null );
+ }
+
+ public void assertAddEditTemplatePage( String[] pendingSelectBuild, String[] selectedBuild )
+ {
+ assertPage( "Continuum - Build Definition Template" );
+ assertTextPresent( "Build Definition Template" );
+ assertTextPresent( "Name" );
+ assertElementPresent( "buildDefinitionTemplate.name" );
+ assertTextPresent( "Configure the used Build Definitions" );
+ if ( pendingSelectBuild != null && pendingSelectBuild.length > 0 )
+ {
+ assertOptionPresent( "buildDefinitionIds", pendingSelectBuild );
+ }
+ if ( selectedBuild != null && selectedBuild.length > 0 )
+ {
+ assertOptionPresent( "selectedBuildDefinitionIds", selectedBuild );
+ }
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void addEditTemplate( String name, String[] addBuildDefinitions, String[] removeBuildDefinitions,
+ boolean success )
+ throws Exception
+ {
+ setFieldValue( "buildDefinitionTemplate.name", name );
+ if ( addBuildDefinitions != null && addBuildDefinitions.length > 0 )
+ {
+ for ( String bd : addBuildDefinitions )
+ {
+ selectValue( "buildDefinitionIds", bd );
+ clickButtonWithValue( "->", false );
+ }
+ }
+ if ( removeBuildDefinitions != null && removeBuildDefinitions.length > 0 )
+ {
+ for ( String bd : removeBuildDefinitions )
+ {
+ selectValue( "selectedBuildDefinitionIds", bd );
+ clickButtonWithValue( "<-", false );
+ }
+ }
+ submit();
+ if ( success )
+ {
+ assertBuildDefinitionTemplatePage();
+ }
+ else
+ {
+ assertAddEditTemplatePage( null, null );
+ }
+ }
+
+ public void goToEditTemplate( String name, String[] buildDefinitions )
+ {
+ goToBuildDefinitionTemplatePage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertAddEditTemplatePage( null, buildDefinitions );
+ assertFieldValue( name, "buildDefinitionTemplate.name" );
+ }
+
+ public void removeTemplate( String name )
+ {
+ goToBuildDefinitionTemplatePage();
+ clickLinkWithXPath( "(//a[contains(@href,'deleteDefinitionTemplate') and contains(@href, '" + name
+ + "')])//img" );
+ assertPage( "Continuum - Delete Build Definition Template" );
+ assertTextPresent( "Delete Build Definition Template" );
+ assertTextPresent( "Are you sure you want to delete build definition template \"" + name + "\"?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertBuildDefinitionTemplatePage();
+ }
+
+ public void goToAddBuildDefinitionTemplate()
+ {
+ goToBuildDefinitionTemplatePage();
+ clickSubmitWithLocator( "buildDefinitionAsTemplate_0" );
+ assertAddEditBuildDefinitionTemplatePage();
+ }
+
+ public void goToEditBuildDefinitionTemplate( String description )
+ {
+ goToBuildDefinitionTemplatePage();
+ String xPath = "//preceding::td[text()='" + description + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertAddEditBuildDefinitionTemplatePage();
+ }
+
+ public void assertAddEditBuildDefinitionTemplatePage()
+ {
+ assertPage( "Continuum - Build Definition Template" );
+ assertTextPresent( "Build Definition Template" );
+ assertTextPresent( "POM filename*:" );
+ assertElementPresent( "buildDefinition.buildFile" );
+ assertTextPresent( "Goals:" );
+ assertElementPresent( "buildDefinition.goals" );
+ assertTextPresent( "Arguments:" );
+ assertElementPresent( "buildDefinition.arguments" );
+ assertTextPresent( "Build Fresh" );
+ assertElementPresent( "buildDefinition.buildFresh" );
+ assertTextPresent( "Always Build" );
+ assertElementPresent( "buildDefinition.alwaysBuild" );
+ assertTextPresent( "Is it default?" );
+ assertTextPresent( "Schedule:" );
+ assertElementPresent( "buildDefinition.schedule.id" );
+ assertTextPresent( "Description" );
+ assertElementPresent( "buildDefinition.description" );
+ assertTextPresent( "Type" );
+ assertElementPresent( "buildDefinition.type" );
+ assertTextPresent( "Build Environment" );
+ assertElementPresent( "buildDefinition.profile.id" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void addEditBuildDefinitionTemplate( String buildFile, String goals, String arguments, String description,
+ boolean buildFresh, boolean alwaysBuild, boolean isDefault,
+ boolean success )
+ {
+ // Enter values into Add Build Definition fields, and submit
+ setFieldValue( "buildDefinition.buildFile", buildFile );
+ setFieldValue( "buildDefinition.goals", goals );
+ setFieldValue( "buildDefinition.arguments", arguments );
+ setFieldValue( "buildDefinition.description", description );
+ if ( buildFresh )
+ {
+ checkField( "buildDefinition.buildFresh" );
+ }
+ else
+ {
+ uncheckField( "buildDefinition.buildFresh" );
+ }
+ if ( isDefault )
+ {
+ checkField( "buildDefinition.defaultForProject" );
+ }
+ else
+ {
+ uncheckField( "buildDefinition.defaultForProject" );
+ }
+ if ( alwaysBuild )
+ {
+ checkField( "buildDefinition.alwaysBuild" );
+ }
+ else
+ {
+ uncheckField( "buildDefinition.alwaysBuild" );
+ }
+ submit();
+ if ( success )
+ {
+ assertBuildDefinitionTemplatePage();
+ }
+ else
+ {
+ assertAddEditBuildDefinitionTemplatePage();
+ }
+ }
+
+ public void removeBuildDefinitionTemplate( String description )
+ {
+ goToBuildDefinitionTemplatePage();
+ String xPath = "//preceding::td[text()='" + description + "']//following::img[@alt='Delete']";
+ clickLinkWithXPath( xPath );
+ assertPage( "Continuum - Delete Build Definition Template" );
+ assertTextPresent( "Delete Build Definition Template" );
+ assertTextPresent( "Are you sure you want to delete build definition template \"" + description + "\"?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertBuildDefinitionTemplatePage();
+ }
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,114 @@
+package org.apache.continuum.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+public abstract class AbstractBuildEnvironmentTest
+ extends AbstractSeleniumTest
+{
+ public void goToBuildEnvironmentPage()
+ {
+ clickLinkWithText( "Build Environments" );
+ assertBuildEnvironmentPage();
+ }
+
+ public void assertBuildEnvironmentPage()
+ {
+ assertPage( "Continuum - Build Environments" );
+ assertTextPresent( "Build Environments" );
+ assertButtonWithValuePresent( "Add" );
+ }
+
+ public void goToAddBuildEnvironment()
+ {
+ goToBuildEnvironmentPage();
+ clickButtonWithValue( "Add" );
+ assertAddBuildEnvironmentPage();
+ }
+
+ public void assertAddBuildEnvironmentPage()
+ {
+ assertPage( "Continuum - Build Environment" );
+ assertTextPresent( "Build Environment" );
+ assertTextPresent( "Build Environment Name" );
+ assertElementPresent( "profile.name" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void assertEditBuildEnvironmentPage( String name )
+ {
+ assertAddBuildEnvironmentPage();
+ assertTextPresent( "Installation Name" );
+ assertTextPresent( "Type" );
+ assertFieldValue( name, "profile.name" );
+ }
+
+ public void addBuildEnvironment( String name, String[] installations, boolean success )
+ {
+ setFieldValue( "profile.name", name );
+ submit();
+ editBuildEnvironment( name, installations, success );
+ }
+
+ public void editBuildEnvironment( String name, String[] installations, boolean success )
+ {
+ setFieldValue( "profile.name", name );
+ for ( String i : installations )
+ {
+ selectValue( "installationId", i );
+ clickButtonWithValue( "Add" );
+ }
+ submit();
+ if ( success )
+ {
+ assertBuildEnvironmentPage();
+ }
+ else
+ {
+ assertAddBuildEnvironmentPage();
+ }
+ }
+
+ public void goToEditBuildEnvironment( String name )
+ {
+ goToBuildEnvironmentPage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertEditBuildEnvironmentPage( name );
+ }
+
+ public void removeBuildEnvironment( String name )
+ {
+ goToBuildEnvironmentPage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Delete']";
+ clickLinkWithXPath( xPath );
+ assertPage( "Continuum - Delete Build Environment" );
+ assertTextPresent( "Delete Build Environment" );
+ assertTextPresent( "Are you sure you want to delete Build Environment \"" + name + "\" ?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertBuildEnvironmentPage();
+ }
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,99 @@
+package org.apache.continuum.web.test.parent;
+
+import org.testng.Assert;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+public abstract class AbstractBuildQueueTest
+ extends AbstractContinuumTest
+{
+ public void goToBuildQueuePage()
+ {
+ clickLinkWithText( "Build Queue" );
+
+ assertBuildQueuePage();
+ }
+
+ public void assertBuildQueuePage()
+ {
+ assertPage( "Continumm - Parallel Build Queue" );
+ assertTextPresent( "Continuum - Parallel Build Queue" );
+ assertTextPresent( "Name" );
+ assertTextPresent( "DEFAULT_BUILD_QUEUE" );
+ assertButtonWithValuePresent( "Add" );
+ }
+
+ public void removeBuildQueue( String queueName )
+ {
+ clickLinkWithXPath( "(//a[contains(@href,'deleteBuildQueue.action') and contains(@href, '" + queueName
+ + "')])//img" );
+ assertTextPresent( "Delete Parallel Build Queue" );
+ assertTextPresent( "Are you sure you want to delete the build queue \"" + queueName + "\"?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertBuildQueuePage();
+ }
+
+ public void assertAddBuildQueuePage()
+ {
+ assertPage( "Continuum - Add/Edit Parallel Build Queue" );
+ assertTextPresent( "Continuum - Add/Edit Parallel Build Queue" );
+ assertTextPresent( "Name*" );
+ assertElementPresent( "name" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void addBuildQueue( String name, boolean success )
+ {
+ goToBuildQueuePage();
+ assertBuildQueuePage();
+ submit();
+ assertAddBuildQueuePage();
+ setFieldValue( "name", name );
+ submit();
+ if ( success )
+ {
+ assertBuildQueuePage();
+ assertTextPresent( name );
+ }
+ else
+ {
+ assertAddBuildQueuePage();
+ }
+ }
+
+ public void buildProjectForQueuePageTest( String projectGroupName, String groupId, String description, String projectName )
+ throws Exception
+ {
+ showProjectGroup( projectGroupName, groupId, description );
+ clickButtonWithValue( "Build all projects" );
+ waitForElementPresent( "//img[@alt='Building']" );
+ Thread.sleep( 10000 );
+
+ }
+
+
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,93 @@
+package org.apache.continuum.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+public abstract class AbstractConfigurationTest
+ extends AbstractContinuumTest
+{
+ public void goToConfigurationPage()
+ {
+ clickLinkWithText( "Configuration" );
+ assertEditConfigurationPage();
+ }
+
+ public void assertEditedConfigurationPage( String working, String buildOutput, String releaseOutput,
+ String deploymentRepository, String baseUrl, String numberBuildParallel )
+ {
+ assertPage( "Continuum - Configuration" );
+ assertTextPresent( "General Configuration " );
+ assertTextPresent( "Working Directory" );
+ assertElementNotPresent( "workingDirectory" );
+ assertTextPresent( working );
+ assertTextPresent( "Build Output Directory" );
+ assertElementNotPresent( "buildOutputDirectory" );
+ assertTextPresent( buildOutput );
+ assertTextPresent( "Release Output Directory" );
+ assertElementNotPresent( "releaseOutputDirectory" );
+ assertTextPresent( releaseOutput );
+ assertTextPresent( "Deployment Repository Directory" );
+ assertElementNotPresent( "deploymentRepositoryDirectory" );
+ assertTextPresent( deploymentRepository );
+ assertTextPresent( "Base URL" );
+ assertElementNotPresent( "baseUrl" );
+ assertTextPresent( baseUrl );
+ assertTextPresent( "Number of Allowed Builds in Parallel" );
+ assertElementNotPresent( "numberOfAllowedBuildsinParallel" );
+ assertTextPresent( numberBuildParallel );
+ assertTextPresent( "Enable Distributed Builds" );
+ assertElementNotPresent( "distributedBuildEnabled" );
+ assertButtonWithValuePresent( "Edit" );
+
+ }
+
+ public void submitConfiguration( String working, String buildOutput, String releaseOutput,
+ String deploymentRepository, String baseUrl, String numberBuildParallel,
+ boolean distributed, boolean success )
+ {
+ setFieldValue( "workingDirectory", working );
+ setFieldValue( "buildOutputDirectory", buildOutput );
+ setFieldValue( "releaseOutputDirectory", releaseOutput );
+ setFieldValue( "deploymentRepositoryDirectory", deploymentRepository );
+ setFieldValue( "baseUrl", baseUrl );
+ setFieldValue( "numberOfAllowedBuildsinParallel", numberBuildParallel );
+ if ( distributed )
+ {
+ checkField( "distributedBuildEnabled" );
+ }
+ else
+ {
+ uncheckField( "distributedBuildEnabled" );
+ }
+ submit();
+ if ( success )
+ {
+ assertEditedConfigurationPage( working, buildOutput, releaseOutput, deploymentRepository, baseUrl,
+ numberBuildParallel );
+ }
+ else
+ {
+ assertEditConfigurationPage();
+ }
+ }
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,904 @@
+package org.apache.continuum.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.testng.Assert;
+
+/**
+ * Based on AbstractContinuumTestCase of Emmanuel Venisse test.
+ *
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+public abstract class AbstractContinuumTest
+ extends AbstractSeleniumTest
+{
+
+ // ////////////////////////////////////
+ // Create Admin User
+ // ////////////////////////////////////
+ public void assertCreateAdmin()
+ {
+ assertPage( "Create Admin User" );
+ assertTextPresent( "Username" );
+ assertFieldValue( "admin", "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" );
+ assertButtonWithValuePresent( "Create Admin" );
+ }
+
+ public void submitAdminData(String fullname,String email,String password )
+ {
+ setFieldValue( "user.fullName", fullname );
+ setFieldValue( "user.email", email );
+ setFieldValue( "user.password", password );
+ setFieldValue( "user.confirmPassword", password );
+ submit();
+ }
+
+ // ////////////////////////////////////
+ // About
+ // ////////////////////////////////////
+ public void goToAboutPage()
+ {
+ getSelenium().open( baseUrl );
+ clickLinkWithText( "About" );
+ assertAboutPage();
+ }
+
+ public void assertAboutPage()
+ {
+ assertPage( "Continuum - About" );
+ assertTextPresent( "About Continuum" );
+ assertTextPresent( "Version:" );
+ }
+
+ // ////////////////////////////////////
+ // Login
+ // ////////////////////////////////////
+
+ public void goToLoginPage()
+ {
+ getSelenium().open( baseUrl );
+ clickLinkWithText( "Login" );
+ assertLoginPage();
+ }
+
+ public void assertLoginPage()
+ {
+ assertPage( "Login Page" );
+ assertTextPresent( "Login" );
+ assertTextPresent( "Register" );
+ assertTextPresent( "Username" );
+ assertElementPresent( "username" );
+ assertTextPresent( "Password" );
+ assertElementPresent( "password" );
+ assertTextPresent( "Remember Me" );
+ assertElementPresent( "rememberMe" );
+ assertButtonWithValuePresent( "Login" );
+ assertButtonWithValuePresent( "Cancel" );
+ assertTextPresent( "Need an Account? Register!" );
+ assertTextPresent( "Forgot your Password? Request a password reset." );
+ }
+
+ public void submitUserData(String username,String password,boolean rememberme,boolean success )
+ {
+
+ setFieldValue( "username", username );
+ setFieldValue( "password", password );
+ if ( rememberme )
+ {
+ checkField( "rememberMe" );
+ }
+ submit();
+ if ( success )
+ {
+ assertAutenticatedPage( username );
+ }
+ else
+ {
+ assertLoginPage();
+ }
+ }
+
+ public void assertAutenticatedPage(String username )
+ {
+ assertTextPresent( "Current User" );
+ assertTextPresent( "Edit Details" );
+ assertTextPresent( "Logout" );
+ assertTextNotPresent( "Login" );
+ assertTextPresent( username );
+ }
+
+ public void assertChangePasswordPage()
+ {
+ assertPage( "Change Password" );
+ assertTextPresent( "Change Password" );
+ assertTextPresent( "Existing Password*:" );
+ assertElementPresent( "existingPassword" );
+ assertTextPresent( "New Password*:" );
+ assertElementPresent( "newPassword" );
+ assertTextPresent( "Confirm New Password*:" );
+ assertElementPresent( "newPasswordConfirm" );
+ }
+
+ public void assertUserEditPage( String username, String name, String email )
+ {
+ assertPage( "[Admin] User Edit" );
+ assertTextPresent( "[Admin] User Edit" );
+ assertTextPresent( "Username" );
+ assertTextPresent( username );
+ assertTextPresent( "Full Name*:" );
+ assertFieldValue( name, "userEditForm_user_fullName" );
+ assertTextPresent( "Email Address*:" );
+ assertFieldValue( email, "userEditForm_user_email" );
+ assertTextPresent( "Password*:" );
+ assertFieldValue( "", "userEditForm_user_password" );
+ assertTextPresent( "Confirm Password*:" );
+ assertElementPresent( "userEditForm_user_confirmPassword" );
+ assertTextPresent( "Account Creation:" );
+ assertTextPresent( "Last Password Change:" );
+ assertTextPresent( "Effective Roles" );
+ assertLinkPresent( "Edit Roles" );
+ }
+
+ // ////////////////////////////////////
+ // Configuration
+ // ////////////////////////////////////
+
+ public void assertEditConfigurationPage()
+ {
+ assertPage( "Continuum - Configuration" );
+ assertTextPresent( "General Configuration " );
+ assertTextPresent( "Working Directory" );
+ assertElementPresent( "workingDirectory" );
+ assertTextPresent( "Build Output Directory" );
+ assertElementPresent( "buildOutputDirectory" );
+ assertTextPresent( "Release Output Directory" );
+ assertElementPresent( "releaseOutputDirectory" );
+ assertTextPresent( "Deployment Repository Directory" );
+ assertElementPresent( "deploymentRepositoryDirectory" );
+ assertTextPresent( "Base URL" );
+ assertElementPresent( "baseUrl" );
+ assertTextPresent( "Number of Allowed Builds in Parallel" );
+ assertElementPresent( "numberOfAllowedBuildsinParallel" );
+ assertTextPresent( "Enable Distributed Builds" );
+ assertElementPresent( "distributedBuildEnabled" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ // ////////////////////////////////////
+ // Build Queue
+ // ////////////////////////////////////
+
+ public void setMaxBuildQueue(int maxBuildQueue )
+ {
+ clickLinkWithText( "Configuration" );
+ setFieldValue( "numberOfAllowedBuildsinParallel", String.valueOf( maxBuildQueue ) );
+ submit();
+ }
+
+ // ////////////////////////////////////
+ // Project Groups
+ // ////////////////////////////////////
+ public void goToProjectGroupsSummaryPage()
+ throws Exception
+ {
+ clickLinkWithText( "Show Project Groups" );
+
+ assertProjectGroupsSummaryPage();
+ }
+
+ public void assertProjectGroupsSummaryPage()
+ {
+ assertPage( "Continuum - Group Summary" );
+ assertTextPresent( "Project Groups" );
+
+ if ( isTextPresent( "Project Groups list is empty." ) )
+ {
+ assertTextNotPresent( "Name" );
+ assertTextNotPresent( "Group Id" );
+ }
+ else
+ {
+ assertTextPresent( "Name" );
+ assertTextPresent( "Group Id" );
+ }
+ }
+
+ // ////////////////////////////////////
+ // 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 );
+
+ assertProjectGroupSummaryPage( name, groupId, description );
+ }
+
+ public void assertProjectGroupSummaryPage(String name,String groupId,String description )
+ {
+ assertPage( "Continuum - Project Group" );
+ assertTextPresent( "Project Group Name" );
+ assertTextPresent( name );
+ assertTextPresent( "Project Group Id" );
+ assertTextPresent( groupId );
+ assertTextPresent( "Description" );
+ assertTextPresent( description );
+
+ // Assert the available Project Group Actions
+ assertTextPresent( "Group Actions" );
+ assertElementPresent( "build" );
+ assertElementPresent( "edit" );
+ // assertElementPresent( "remove" );
+
+ assertTextPresent( "Project Group Scm Root" );
+ assertTextPresent( "Scm Root URL" );
+
+ if ( isTextPresent( "Member Projects" ) )
+ {
+ assertTextPresent( "Project Name" );
+ assertTextPresent( "Version" );
+ assertTextPresent( "Build" );
+ }
+ else
+ {
+ assertTextNotPresent( "Project Name" );
+ }
+ }
+
+ public void addProjectGroup(String name,String groupId,String description,boolean success )
+ throws Exception
+ {
+ goToProjectGroupsSummaryPage();
+
+ // Go to Add Project Group Page
+ clickButtonWithValue( "Add Project Group" );
+ assertAddProjectGroupPage();
+
+ // Enter values into Add Project Group fields, and submit
+ setFieldValue( "name", name );
+ setFieldValue( "groupId", groupId );
+ setFieldValue( "description", description );
+
+ submit();
+ if ( success )
+ {
+ assertProjectGroupsSummaryPage();
+ }
+ else
+ {
+ assertAddProjectGroupPage();
+ }
+ }
+
+ public void assertAddProjectGroupPage()
+ {
+ assertPage( "Continuum - Add Project Group" );
+ assertTextPresent( "Add Project Group" );
+ assertTextPresent( "Project Group Name" );
+ assertElementPresent( "name" );
+ assertTextPresent( "Project Group Id" );
+ assertElementPresent( "groupId" );
+ assertTextPresent( "Description" );
+ assertElementPresent( "description" );
+ }
+
+ public void removeProjectGroup(String name,String groupId,String description )
+ throws Exception
+ {
+ showProjectGroup( name, groupId, description );
+ // Remove
+ clickLinkWithLocator( "remove" );
+ // Assert Confirmation
+ assertElementPresent( "removeProjectGroup_" );
+ assertElementPresent( "Cancel" );
+ // Confirm Project Group deletion
+ clickButtonWithValue( "Save" );
+ assertProjectGroupsSummaryPage();
+ }
+
+ public void removeProjectGroup( String groupName )
+ throws Exception
+ {
+ goToProjectGroupsSummaryPage();
+ clickLinkWithText( groupName );
+ clickButtonWithValue( "Delete Group" );
+ assertTextPresent( "Project Group Removal" );
+ clickButtonWithValue( "Delete" );
+ assertProjectGroupsSummaryPage();
+ }
+
+ public void editProjectGroup(String name,String groupId,String description,String newName,String newDescription )
+ throws Exception
+ {
+ showProjectGroup( name, groupId, description );
+ clickButtonWithValue( "Edit" );
+ assertEditGroupPage( groupId );
+ setFieldValue( "name", newName );
+ setFieldValue( "description", newDescription );
+ clickButtonWithValue( "Save" );
+ }
+
+ public void assertEditGroupPage(String groupId )
+ throws Exception
+ {
+ assertPage( "Continuum - Update Project Group" );
+ assertTextPresent( "Update Project Group" );
+ assertTextPresent( "Project Group Name" );
+ assertTextPresent( "Project Group Id" );
+ assertTextPresent( groupId );
+ assertTextPresent( "Description" );
+ assertTextPresent( "Homepage Url" );
+ assertTextPresent( "Local Repository" );
+ assertElementPresent( "saveProjectGroup_" );
+ assertElementPresent( "Cancel" );
+ }
+
+ public void buildProjectGroup(String projectGroupName,String groupId,String description,String projectName )
+ throws Exception
+ {
+ int currentIt = 1;
+ int maxIt = 10;
+ showProjectGroup( projectGroupName, groupId, description );
+ clickButtonWithValue( "Build all projects" );
+ while ( isElementPresent( "//img[@alt='Building']" ) || isElementPresent( "//img[@alt='Updating']" ) )
+ {
+ Thread.sleep( 10000 );
+ getSelenium().refresh();
+ waitPage();
+ if ( currentIt > maxIt )
+ {
+ Assert.fail( "Timeout, Can't build project group" );
+ }
+ currentIt++;
+ }
+ Thread.sleep( 10000 );
+ clickLinkWithText( projectName );
+ clickLinkWithText( "Builds" );
+ clickLinkWithText( "Result" );
+ assertTextPresent( "BUILD SUCCESSFUL" );
+ clickLinkWithText( "Project Group Summary" );
+ }
+
+ public void assertReleaseSuccess()
+ {
+ assertTextPresent( "Choose Release Goal for " );
+ assertTextPresent( "Prepare project for release " );
+ assertTextPresent( "Perform project release" );
+ assertElementPresent( "goal" );
+ assertElementPresent( "preparedReleaseId" );
+ assertButtonWithValuePresent( "Submit" );
+ }
+
+ public void addValidM2ProjectFromProjectGroup(String projectGroupName,String groupId,String description,
+ String m2PomUrl )
+ throws Exception
+ {
+ showProjectGroup( projectGroupName, groupId, description );
+ selectValue( "projectTypes", "Add M2 Project" );
+ clickButtonWithValue( "Add" );
+ assertAddMavenTwoProjectPage();
+ setFieldValue( "m2PomUrl", m2PomUrl );
+ clickButtonWithValue( "Add" );
+ // if success redirect to summary page
+ assertProjectGroupsSummaryPage();
+ }
+
+ public void goToGroupBuildDefinitionPage(String projectGroupName,String groupId,String description )
+ throws Exception
+ {
+ showProjectGroup( projectGroupName, groupId, description );
+ clickLinkWithText( "Build Definitions" );
+ assertGroupBuildDefinitionPage( projectGroupName );
+ }
+
+ public void assertGroupBuildDefinitionPage(String projectGroupName )
+ {
+ assertTextPresent( "Project Group Build Definitions of " + projectGroupName + " group" );
+ }
+
+ public void assertDeleteBuildDefinitionPage(String description,String goals )
+ {
+ assertTextPresent( "Are you sure you want to delete the build definition with description \"" + description
+ + "\", goals \"" + goals + "\" and id" );
+ isButtonWithValuePresent( "Cancel" );
+ isButtonWithValuePresent( "Delete" );
+ }
+
+ public void assertAddEditBuildDefinitionPage()
+ {
+ assertTextPresent( "Add/Edit Build Definition" );
+ assertTextPresent( "POM filename*:" );
+ assertElementPresent( "buildFile" );
+ assertTextPresent( "Goals:" );
+ assertElementPresent( "goals" );
+ assertTextPresent( "Arguments:" );
+ assertElementPresent( "arguments" );
+ assertTextPresent( "Build Fresh" );
+ assertElementPresent( "buildFresh" );
+ assertTextPresent( "Always Build" );
+ assertElementPresent( "alwaysBuild" );
+ assertTextPresent( "Is it default?" );
+ assertTextPresent( "Schedule:" );
+ assertElementPresent( "scheduleId" );
+ assertTextPresent( "Description" );
+ assertElementPresent( "description" );
+ assertTextPresent( "Type" );
+ assertElementPresent( "buildDefinitionType" );
+ assertTextPresent( "Build Environment" );
+ assertElementPresent( "profileId" );
+ }
+
+ public void addEditGroupBuildDefinition(String groupName,String buildFile,String goals,String arguments,
+ String description,boolean buildFresh,boolean alwaysBuild,
+ boolean isDefault )
+ {
+ assertAddEditBuildDefinitionPage();
+ // Enter values into Add Build Definition fields, and submit
+ setFieldValue( "buildFile", buildFile );
+ setFieldValue( "goals", goals );
+ setFieldValue( "arguments", arguments );
+ setFieldValue( "description", description );
+
+ if ( buildFresh )
+ {
+ checkField( "buildFresh" );
+ }
+ else
+ {
+ uncheckField( "buildFresh" );
+ }
+ if ( isElementPresent( "defaultBuildDefinition" ) )
+ {
+ if ( isDefault )
+ {
+ checkField( "defaultBuildDefinition" );
+ }
+ else
+ {
+ uncheckField( "defaultBuildDefinition" );
+ }
+ }
+ if ( alwaysBuild )
+ {
+ checkField( "alwaysBuild" );
+ }
+ else
+ {
+ uncheckField( "alwaysBuild" );
+ }
+
+ submit();
+ if ( groupName != null )
+ {
+ assertGroupBuildDefinitionPage( groupName );
+ }
+ else
+ {
+ assertProjectInformationPage();
+ }
+ }
+
+ // ////////////////////////////////////
+ // General Project Pages
+ // ////////////////////////////////////
+ public void goToEditProjectPage(String projectGroupName,String projectName )
+ {
+ clickLinkWithText( "Show Project Groups" );
+ clickLinkWithText( projectGroupName );
+ clickLinkWithText( projectName );
+ clickButtonWithValue( "Edit" );
+
+ assertEditProjectPage();
+ }
+
+ public void assertEditProjectPage()
+ {
+ assertTextPresent( "Update Continuum Project" );
+ assertTextPresent( "Project Name*:" );
+ assertElementPresent( "name" );
+ assertTextPresent( "Version*:" );
+ assertElementPresent( "version" );
+ assertTextPresent( "SCM Url*:" );
+ assertElementPresent( "scmUrl" );
+ assertTextPresent( "Use SCM Credentials Cache, if available" );
+ assertElementPresent( "scmUseCache" );
+ assertTextPresent( "SCM Username:" );
+ assertElementPresent( "scmUsername" );
+ assertTextPresent( "SCM Password:" );
+ assertElementPresent( "scmPassword" );
+ assertTextPresent( "SCM Branch/Tag:" );
+ assertElementPresent( "scmTag" );
+ }
+
+ public void goToProjectInformationPage(String projectGroupName,String projectName )
+ {
+ clickLinkWithText( "Show Project Groups" );
+ clickLinkWithText( projectGroupName );
+ clickLinkWithText( projectName );
+
+ assertProjectInformationPage();
+ }
+
+ public void assertProjectInformationPage()
+ {
+ assertTextPresent( "Project Group Summary" );
+ assertTextPresent( "Project Information" );
+ assertTextPresent( "Builds" );
+ assertTextPresent( "Working Copy" );
+ assertTextPresent( "Build Definitions" );
+ assertTextPresent( "Notifiers" );
+ assertTextPresent( "Dependencies" );
+ assertTextPresent( "Developers" );
+ }
+
+ public void moveProjectToProjectGroup(String groupName,String groupId,String groupDescription,
+ String projectName,String newProjectGroup )
+ throws Exception
+ {
+ showProjectGroup( groupName, groupId, groupDescription );
+ clickButtonWithValue( "Edit" );
+
+ assertTextPresent( "Move to Group" );
+ String xPath = "//preceding::th/label[contains(text(),'" + projectName + "')]//following::select";
+ selectValue( xPath, newProjectGroup );
+ clickButtonWithValue( "Save" );
+ assertProjectGroupSummaryPage( groupName, groupId, groupDescription );
+ }
+
+ // ////////////////////////////////////
+ // Maven 2.0.x Project
+ // ////////////////////////////////////
+ public void goToAddMavenTwoProjectPage()
+ {
+ clickLinkWithText( "Maven 2.0.x Project" );
+
+ assertAddMavenTwoProjectPage();
+ }
+
+ public void assertAddMavenTwoProjectPage()
+ {
+ assertTextPresent( "POM Url" );
+ assertElementPresent( "m2PomUrl" );
+ assertTextPresent( "Username" );
+ assertElementPresent( "scmUsername" );
+ assertTextPresent( "Password" );
+ assertElementPresent( "scmPassword" );
+ assertTextPresent( "Upload POM" );
+ assertElementPresent( "m2PomFile" );
+ assertTextPresent( "Project Group" );
+ assertElementPresent( "selectedProjectGroup" );
+ }
+
+ public void addMavenTwoProject(String pomUrl,String username,String password,String projectGroup,
+ boolean success )
+ throws Exception
+ {
+ goToAddMavenTwoProjectPage();
+
+ // Enter values into Add Maven Two Project fields, and submit
+ setFieldValue( "m2PomUrl", pomUrl );
+ setFieldValue( "scmUsername", username );
+ setFieldValue( "scmPassword", password );
+
+ if ( projectGroup != null )
+ {
+ selectValue( "addMavenTwoProject_selectedProjectGroup", projectGroup );
+ }
+ submit();
+ String title;
+ if ( success )
+ {
+ title = "Continuum - Project Group";
+ }
+ else
+ {
+ title = "Continuum - Add Maven 2 Project";
+ }
+ waitAddProject( title );
+ }
+
+ /**
+ * submit the page
+ *
+ * @param m2PomUrl
+ * @param validPom
+ */
+ public void submitAddMavenTwoProjectPage(String m2PomUrl,boolean validPom )
+ throws Exception
+ {
+ addMavenTwoProject( m2PomUrl, "", "", null, validPom );
+
+ if ( validPom )
+ {
+ assertTextPresent( "Default Project Group" );
+ }
+ }
+
+ // ////////////////////////////////////
+ // Maven 1.x Project
+ // ////////////////////////////////////
+ public void goToAddMavenOneProjectPage()
+ {
+ clickLinkWithText( "Maven 1.x Project" );
+ assertAddMavenOneProjectPage();
+ }
+
+ public void assertAddMavenOneProjectPage()
+ {
+ assertPage( "Continuum - Add Maven 1 Project" );
+ assertTextPresent( "Add Maven 1.x Project" );
+ assertTextPresent( "M1 POM Url" );
+ assertElementPresent( "m1PomUrl" );
+ assertTextPresent( "Username" );
+ assertElementPresent( "scmUsername" );
+ assertTextPresent( "Password" );
+ assertElementPresent( "scmPassword" );
+ assertTextPresent( "OR" );
+ assertTextPresent( "Upload POM" );
+ assertElementPresent( "m1PomFile" );
+ assertTextPresent( "Project Group" );
+ assertElementPresent( "selectedProjectGroup" );
+ assertOptionPresent( "selectedProjectGroup", new String[] { "Defined by POM", "Default Project Group" } );
+ assertTextPresent( "Build Definition Template" );
+ assertElementPresent( "buildDefinitionTemplateId" );
+ assertOptionPresent( "buildDefinitionTemplateId", new String[] { "Default", "Default Ant Template",
+ "Default Maven 1 Template", "Default Maven 2 Template", "Default Shell Template" } );
+ assertButtonWithValuePresent( "Add" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void addMavenOneProject(String pomUrl,String username,String password,String projectGroup,
+ String buildTemplate,boolean success )
+ throws Exception
+ {
+ setFieldValue( "m1PomUrl", pomUrl );
+ setFieldValue( "scmUsername", username );
+ setFieldValue( "scmPassword", password );
+
+ if ( buildTemplate != null )
+ {
+ selectValue( "buildDefinitionTemplateId", buildTemplate );
+ }
+ if ( projectGroup != null )
+ {
+ selectValue( "selectedProjectGroup", projectGroup );
+ }
+ submit();
+ String title;
+ if ( success )
+ {
+ title = "Continuum - Project Group";
+ }
+ else
+ {
+ title = "Continuum - Add Maven 1 Project";
+ }
+ waitAddProject( title );
+ }
+
+ // ////////////////////////////////////
+ // ANT/SHELL Projects
+ // ////////////////////////////////////
+
+ public void goToAddAntProjectPage()
+ {
+ clickLinkWithText( "Ant Project" );
+ assertAddProjectPage( "ant" );
+ }
+
+ public void goToAddShellProjectPage()
+ {
+ clickLinkWithText( "Shell Project" );
+ assertAddProjectPage( "shell" );
+ }
+
+ public void assertAddProjectPage(String type )
+ {
+ String title = type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ).toLowerCase();
+ assertPage( "Continuum - Add " + title + " Project" );
+ assertTextPresent( "Add " + title + " Project" );
+ assertTextPresent( "Project Name" );
+ assertElementPresent( "projectName" );
+ assertTextPresent( "Description" );
+ assertElementPresent( "projectDescription" );
+ assertTextPresent( "Version" );
+ assertElementPresent( "projectVersion" );
+ assertTextPresent( "Scm Url" );
+ assertElementPresent( "projectScmUrl" );
+ assertLinkPresent( "Maven SCM URL" );
+ assertTextPresent( "Scm Username" );
+ assertElementPresent( "projectScmUsername" );
+ assertTextPresent( "Scm Password" );
+ assertElementPresent( "projectScmPassword" );
+ assertTextPresent( "Scm Branch/Tag" );
+ assertElementPresent( "projectScmTag" );
+ assertTextPresent( "Use SCM Credentials Cache, if available" );
+ assertElementPresent( "projectScmUseCache" );
+ assertTextPresent( "Project Group" );
+ assertElementPresent( "selectedProjectGroup" );
+ assertOptionPresent( "selectedProjectGroup", new String[] { "Default Project Group" } );
+ assertTextPresent( "Build Definition Template" );
+ assertElementPresent( "buildDefinitionTemplateId" );
+ assertOptionPresent( "buildDefinitionTemplateId", new String[] { "Default", "Default Ant Template",
+ "Default Maven 1 Template", "Default Maven 2 Template", "Default Shell Template" } );
+ assertButtonWithValuePresent( "Add" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void addProject(String name,String description,String version,String scmUrl,String scmUser,
+ String scmPassword,String scmTag,boolean useCache,String projectGroup,
+ String buildTemplate,boolean success )
+ throws Exception
+ {
+ setFieldValue( "projectName", name );
+ setFieldValue( "projectDescription", description );
+ setFieldValue( "projectVersion", version );
+ setFieldValue( "projectScmUrl", scmUrl );
+ setFieldValue( "projectScmUsername", scmUser );
+ setFieldValue( "projectScmPassword", scmPassword );
+ setFieldValue( "projectScmTag", scmTag );
+ if ( useCache )
+ {
+ checkField( "projectScmUseCache" );
+ }
+ if ( buildTemplate != null )
+ {
+ selectValue( "buildDefinitionTemplateId", buildTemplate );
+ }
+ if ( projectGroup != null )
+ {
+ selectValue( "selectedProjectGroup", projectGroup );
+ }
+ submit();
+ String title;
+ if ( success )
+ {
+ title = "Continuum - Project Group";
+ }
+ else
+ {
+ title = "Continuum - Add ";
+ }
+ waitAddProject( title );
+ }
+
+ public void waitAddProject(String title )
+ throws Exception
+ {
+
+ Thread.sleep( 4000 );
+ String condition = "selenium.browserbot.getCurrentWindow().document.title != ''";
+ getSelenium().waitForCondition( condition, maxWaitTimeInMs );
+ Thread.sleep( 1000 );
+ String t = getTitle();
+ Assert.assertTrue( t.contains( title ) );
+ }
+
+ public void createAndAddUserAsDeveloperToGroup( String username, String name, String email, String password, String groupName )
+ {
+ clickLinkWithText( "Users" );
+ assertPage( "[Admin] User List" );
+ assertTextNotPresent( username );
+ clickButtonWithValue( "Create New User" );
+ assertPage( "[Admin] User Create" );
+ setFieldValue( "user.fullName", name );
+ setFieldValue( "user.username", username );
+ setFieldValue( "user.email", email );
+ setFieldValue( "user.password", password );
+ setFieldValue( "user.confirmPassword", password );
+ clickButtonWithValue( "Create User" );
+ assertPage( "[Admin] User Edit" );
+ assignContinuumResourceRoleToUser( "Project Developer", groupName );
+ clickButtonWithValue( "Submit" );
+ assertPage( "[Admin] User List" );
+ assertTextPresent( username );
+ assertTextPresent( name );
+ assertTextPresent( email );
+ }
+
+ public void showMembers( String name, String groupId, String description )
+ throws Exception
+ {
+ showProjectGroup( name, groupId, description );
+ clickLinkWithText( "Members" );
+ assertTextPresent( "Member Projects of " + name + " group" );
+ assertTextPresent( "Users" );
+ }
+
+ public void assertUserPresent( String username, String name, String email )
+ {
+ assertTextPresent( username );
+ assertTextPresent( name );
+ assertTextPresent( email );
+ }
+
+ public void assertUserNotPresent( String username, String name, String email )
+ {
+ assertTextNotPresent( username );
+ assertTextNotPresent( name );
+ assertTextNotPresent( email );
+ }
+
+ public void waitForProjectCheckout()
+ throws Exception
+ {
+ int currentIt = 1;
+ int maxIt = 10;
+ while ( isElementPresent( "//img[@alt='Checking Out']" ) )
+ {
+ Thread.sleep( 10000 );
+ getSelenium().refresh();
+ waitPage();
+ if ( currentIt > maxIt )
+ {
+ Assert.fail( "Timeout, Can't check out projects" );
+ }
+ currentIt++;
+ }
+ }
+
+ public void createNewUser( String username, String name, String email, String password )
+ {
+ clickLinkWithText( "Users" );
+ assertPage( "[Admin] User List" );
+ assertTextNotPresent( username );
+ clickButtonWithValue( "Create New User" );
+ assertPage( "[Admin] User Create" );
+ setFieldValue( "user.fullName", name );
+ setFieldValue( "user.username", username );
+ setFieldValue( "user.email", email );
+ setFieldValue( "user.password", password );
+ setFieldValue( "user.confirmPassword", password );
+ clickButtonWithValue( "Create User" );
+ assertPage( "[Admin] User Edit" );
+ }
+
+ public void assignContinuumRoleToUser( String role )
+ {
+ clickLinkWithXPath( "//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + role + "']", false );
+ }
+
+ public void assignContinuumResourceRoleToUser( String resourceRole, String groupName )
+ {
+ clickLinkWithXPath( "//input[@name='addDSelectedRoles' and @value='" + resourceRole + " - " + groupName + "']", false );
+ }
+
+ public void assertUserCreatedPage()
+ {
+ assertPage( "[Admin] User List" );
+ assertTextPresent( "[Admin] List of Users in Role: Any" );
+ assertLinkPresent( "admin" );
+ assertLinkPresent( "guest" );
+ }
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractInstallationTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractInstallationTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractInstallationTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractInstallationTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,186 @@
+package org.apache.continuum.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+public abstract class AbstractInstallationTest
+ extends AbstractSeleniumTest
+{
+ public void goToInstallationPage()
+ {
+ clickLinkWithText( "Installations" );
+ assertInstallationPage();
+ }
+
+ public void assertInstallationPage()
+ {
+ assertPage( "Continuum - Installations" );
+ assertTextPresent( "Installations" );
+ assertButtonWithValuePresent( "Add" );
+ }
+
+ public void goToAddInstallationTool()
+ {
+ goToInstallationPage();
+ clickButtonWithValue( "Add" );
+ assertAddChoiceTypeInstallation();
+ selectValue( "installationType", "Tool" );
+ clickButtonWithValue( "Add" );
+ assertAddInstallationToolPage();
+ }
+
+ public void goToAddInstallationVariable()
+ {
+ goToInstallationPage();
+ clickButtonWithValue( "Add" );
+ assertAddChoiceTypeInstallation();
+ selectValue( "installationType", "Environment Variable" );
+ clickButtonWithValue( "Add" );
+ assertAddInstallationVariablePage();
+ }
+
+ public void assertAddChoiceTypeInstallation()
+ {
+ assertPage( "Continuum - Installation Type Choice" );
+ assertTextPresent( "Installation Type Choice" );
+ assertTextPresent( "Installation Type" );
+ assertOptionPresent( "installationType", new String[] { "Tool", "Environment Variable" } );
+ assertButtonWithValuePresent( "Add" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void assertAddInstallationToolPage()
+ {
+ assertEditInstallationToolPage();
+ assertElementPresent( "automaticProfile" );
+ assertTextPresent( "Create a Build Environment with the Installation name" );
+ }
+
+ public void assertEditInstallationToolPage()
+ {
+ assertPage( "Continuum - Installation" );
+ assertTextPresent( "Continuum - Installation" );
+ assertTextPresent( "Name" );
+ assertElementPresent( "installation.name" );
+ assertTextPresent( "Type" );
+ assertOptionPresent( "installation.type", new String[] { "JDK", "Maven 2", "Maven 1", "ANT" } );
+ assertTextPresent( "Value/Path" );
+ assertElementPresent( "installation.varValue" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void assertAddInstallationVariablePage()
+ {
+ assertEditInstallationVariablePage();
+ assertElementPresent( "automaticProfile" );
+ assertTextPresent( "Create a Build Environment with the Installation name" );
+ }
+
+ public void assertEditInstallationVariablePage()
+ {
+ assertPage( "Continuum - Installation" );
+ assertTextPresent( "Continuum - Installation" );
+ assertTextPresent( "Name" );
+ assertElementPresent( "installation.name" );
+ assertTextPresent( "Environment Variable Name" );
+ assertElementPresent( "installation.varName" );
+ assertTextPresent( "Value/Path" );
+ assertElementPresent( "installation.varValue" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void addInstallation( String name, String var, String path, boolean createBuildEnv, boolean tool,
+ boolean success )
+ {
+ if ( createBuildEnv )
+ {
+ checkField( "automaticProfile" );
+ }
+ else
+ {
+ uncheckField( "automaticProfile" );
+ }
+ editInstallation( name, var, path, tool, success );
+ }
+
+ public void editInstallation( String name, String var, String path, boolean tool, boolean success )
+ {
+ setFieldValue( "installation.name", name );
+ setFieldValue( "installation.varValue", path );
+ if ( tool )
+ {
+ selectValue( "installation.type", var );
+ }
+ else
+ {
+ setFieldValue( "installation.varName", var );
+ }
+ submit();
+ if ( success )
+ {
+ assertInstallationPage();
+ }
+ else if ( tool )
+ {
+ assertAddInstallationToolPage();
+ }
+ else
+ {
+ assertAddInstallationVariablePage();
+ }
+ }
+
+ public void goToEditInstallation( String name, String var, String path, boolean tool )
+ {
+ goToInstallationPage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ if ( tool )
+ {
+ assertEditInstallationToolPage();
+ }
+ else
+ {
+ assertEditInstallationVariablePage();
+ assertFieldValue( var, "installation.varName" );
+ }
+ assertFieldValue( name, "installation.name" );
+ assertFieldValue( path, "installation.varValue" );
+ }
+
+ public void removeInstallation( String name )
+ {
+ goToInstallationPage();
+ clickLinkWithXPath( "(//a[contains(@href,'deleteInstallation') and contains(@href, '" + name + "')])//img" );
+ assertPage( "Continuum - Delete Installation" );
+ assertTextPresent( "Delete Installation" );
+ assertTextPresent( "Are you sure you want to delete \"" + name + "\" installation ?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertInstallationPage();
+ }
+
+}
Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractLocalRepositoryTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractLocalRepositoryTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractLocalRepositoryTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractLocalRepositoryTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,107 @@
+package org.apache.continuum.web.test.parent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+public abstract class AbstractLocalRepositoryTest
+ extends AbstractSeleniumTest
+{
+ public void goToLocalRepositoryPage()
+ {
+ clickLinkWithText( "Local Repositories" );
+
+ assertLocalRepositoryPage();
+ }
+
+ public void assertLocalRepositoryPage()
+ {
+ assertPage( "Continuum - Local Repositories" );
+ assertTextPresent( "Local Repositories" );
+ assertTextPresent( "Name" );
+ assertTextPresent( "Location" );
+ assertTextPresent( "Layout" );
+ assertImgWithAlt( "Edit" );
+ assertImgWithAlt( "Purge" );
+ assertImgWithAlt( "Delete" );
+ assertButtonWithValuePresent( "Add" );
+ }
+
+ public void assertAddLocalRepositoryPage()
+ {
+ assertPage( "Continuum - Add/Edit Local Repository" );
+ assertTextPresent( "Add/Edit Local Repository" );
+ assertTextPresent( "Name" );
+ assertElementPresent( "repository.name" );
+ assertTextPresent( "Location" );
+ assertElementPresent( "repository.location" );
+ assertTextPresent( "Layout" );
+ assertElementPresent( "repository.layout" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void removeLocalRepository( String name )
+ {
+ goToLocalRepositoryPage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Delete']";
+ clickLinkWithXPath( xPath );
+ assertTextPresent( "Delete Local Repository" );
+ assertTextPresent( "Are you sure you want to delete Local Repository \"" + name + "\" ?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertLocalRepositoryPage();
+ }
+
+ public void goToAddLocalRepository()
+ {
+ goToLocalRepositoryPage();
+ clickButtonWithValue( "Add" );
+ assertAddLocalRepositoryPage();
+ }
+
+ public void goToEditLocalRepository( String name, String location )
+ {
+ goToLocalRepositoryPage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertAddLocalRepositoryPage();
+ assertFieldValue( name, "repository.name" );
+ assertFieldValue( location, "repository.location" );
+ }
+
+ public void addEditLocalRepository( String name, String location, boolean success )
+ {
+ setFieldValue( "repository.name", name );
+ setFieldValue( "repository.location", location );
+ submit();
+ if ( success )
+ {
+ assertLocalRepositoryPage();
+ }
+ else
+ {
+ assertAddLocalRepositoryPage();
+ }
+ }
+}