You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ws...@apache.org on 2009/04/01 20:30:14 UTC
svn commit: r761003 - in /continuum/trunk/continuum-webapp-test/src/test:
resources/ testng/config/ testng/org/apache/continuum/web/test/
Author: wsmoak
Date: Wed Apr 1 18:30:13 2009
New Revision: 761003
URL: http://svn.apache.org/viewvc?rev=761003&view=rev
Log:
[CONTINUUM-2073] Update TestNG Selenium tests (patch #4)
Submitted by: Jose Morales Martinez
Added:
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java
Modified:
continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AboutTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LoginTest.java
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MyAccountTest.java
Modified: continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties?rev=761003&r1=761002&r2=761003&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties Wed Apr 1 18:30:13 2009
@@ -69,3 +69,48 @@
BUILD_GOALS =test
BUILD_ARGUMENTS =--batch-mode --non-recursive
BUILD_DESCRIPTION =Maven 2 Build Definition Description
+
+########################
+# queue group
+########################
+BUILD_QUEUE_NAME =name_build_queue
+
+########################
+# purge group
+########################
+PURGE_REPOSITORY_DESCRIPTION =repository_description
+PURGE_REPOSITORY_DAYS =100
+PURGE_REPOSITORY_RETETION =3
+PURGE_DIRECTORY_DESCRIPTION =directory_description
+PURGE_DIRECTORY_DAYS =90
+PURGE_DIRECTORY_RETETION =4
+
+########################
+# local repository group
+########################
+LOCAL_REPOSITORY_NAME =repository_name
+LOCAL_REPOSITORY_LOCATION =/usr/m2/repository
+
+########################
+# schedules group
+########################
+SCHEDULE_NAME =schedule_name
+SCHEDULE_DESCRIPTION =schedule_description
+SCHEDULE_EXPR_SECOND =10
+SCHEDULE_EXPR_MINUTE =10
+SCHEDULE_EXPR_HOUR =20
+SCHEDULE_EXPR_DAY_MONTH =*
+SCHEDULE_EXPR_MONTH =*
+SCHEDULE_EXPR_DAY_WEEK =?
+SCHEDULE_EXPR_YEAR =2009
+SCHEDULE_MAX_TIME =60000
+SCHEDULE_PERIOD =36000
+
+########################
+# installations group
+########################
+INSTALLATION_TOOL_NAME =JDK6
+INSTALLATION_TOOL_PATH =/usr/lib/jvm/java-6-sun-1.6.0.10
+INSTALLATION_ENV_NAME =jdk5
+INSTALLATION_ENV_PATH =/usr/lib/jvm/java-5-sun-1.5.0.12
+INSTALLATION_ENV_VAR_NAME =JAVA5_HOME
\ No newline at end of file
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml?rev=761003&r1=761002&r2=761003&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml Wed Apr 1 18:30:13 2009
@@ -45,6 +45,11 @@
<include name="projectGroup" />
<include name="notifier" />
<include name="buildDefinition" />
+ <include name="queue" />
+ <include name="purge" />
+ <include name="repository" />
+ <include name="schedule" />
+ <include name="configuration" />
</run>
</groups>
@@ -52,4 +57,4 @@
<package name="org.apache.continuum.web.test" />
</packages>
</test>
-</suite>
+</suite>
\ No newline at end of file
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AboutTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AboutTest.java?rev=761003&r1=761002&r2=761003&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AboutTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AboutTest.java Wed Apr 1 18:30:13 2009
@@ -39,14 +39,14 @@
public void open()
throws Exception
{
- super.open(1);
+ super.open();
}
public void displayAboutPage()
{
- geSelenium().open( baseUrl + "/about.action" );
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
- Assert.assertEquals( "Continuum - About", geSelenium().getTitle() );
+ getSelenium().open( baseUrl + "/about.action" );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ Assert.assertEquals( "Continuum - About", getSelenium().getTitle() );
}
@Override
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java?rev=761003&r1=761002&r2=761003&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractContinuumTest.java Wed Apr 1 18:30:13 2009
@@ -49,38 +49,530 @@
}
// ////////////////////////////////////
+ // Build Queue
+ // ////////////////////////////////////
+ public void goToBuildQueuePage()
+ {
+ clickLinkWithText( "Build Queue" );
+
+ assertBuildQueuePage();
+ }
+
+ public void assertBuildQueuePage()
+ {
+ // TODO: Bug in title
+ 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 setMaxBuildQueue( int maxBuildQueue )
+ {
+ goToConfigurationPage();
+ setFieldValue( "numberOfAllowedBuildsinParallel", String.valueOf( maxBuildQueue ) );
+ submit();
+ }
+
+ // ////////////////////////////////////
+ // Purge
+ // ////////////////////////////////////
+
+ public void goToGeneralPurgePage()
+ {
+ clickLinkWithText( "Purge Configurations" );
+ assertGeneralPurgePage();
+ }
+
+ public void assertGeneralPurgePage()
+ {
+ assertPage( "Continuum - Purge Configurations" );
+ assertTextPresent( "Repository Purge Configurations" );
+ assertTextPresent( "Directory Purge Configurations" );
+ assertButtonWithValuePresent( "Add" );
+ }
+
+ public void removeRepositoryPurge( String purgeDescription )
+ {
+ goToGeneralPurgePage();
+ clickLinkWithXPath( "(//a[contains(@href,'removePurgeConfig.action') and contains(@href, '" + purgeDescription
+ + "')])//img" );
+ assertTextPresent( "Delete Purge Configuration" );
+ assertTextPresent( "Are you sure you want to delete Purge Configuration \"" + purgeDescription + "\"?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertGeneralPurgePage();
+ }
+
+ public void removeDirectoryPurge( String purgeDescription )
+ {
+ goToGeneralPurgePage();
+ clickLinkWithXPath( "(//a[contains(@href,'removePurgeConfig.action') and contains(@href, '" + purgeDescription
+ + "')])//img" );
+ assertTextPresent( "Delete Purge Configuration" );
+ assertTextPresent( "Are you sure you want to delete Purge Configuration \"" + purgeDescription + "\"?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertGeneralPurgePage();
+ }
+
+ public void assertAddRepositoryPurgePage()
+ {
+ assertPage( "Continuum - Add/Edit Purge Configuration" );
+ assertTextPresent( "Add/Edit Purge Configuration" );
+ assertTextPresent( "Repository" );
+ assertElementPresent( "repositoryId" );
+ assertTextPresent( "Days Older" );
+ assertElementPresent( "daysOlder" );
+ assertTextPresent( "Retention Count" );
+ assertElementPresent( "retentionCount" );
+ assertElementPresent( "deleteAll" );
+ assertElementPresent( "deleteReleasedSnapshots" );
+ assertElementPresent( "defaultPurgeConfiguration" );
+ assertTextPresent( "Schedule" );
+ assertElementPresent( "scheduleId" );
+ assertTextPresent( "Description" );
+ assertElementPresent( "description" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void assertAddEditDirectoryPurgePage()
+ {
+ assertPage( "Continuum - Add/Edit Purge Configuration" );
+ assertTextPresent( "Add/Edit Purge Configuration" );
+ assertTextPresent( "Directory Type" );
+ assertElementPresent( "directoryType" );
+ assertTextPresent( "Days Older" );
+ assertElementPresent( "daysOlder" );
+ assertTextPresent( "Retention Count" );
+ assertElementPresent( "retentionCount" );
+ assertElementPresent( "deleteAll" );
+ assertElementPresent( "defaultPurgeConfiguration" );
+ assertTextPresent( "Schedule" );
+ assertElementPresent( "scheduleId" );
+ assertTextPresent( "Description" );
+ assertElementPresent( "description" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void goToAddRepositoryPurge()
+ {
+ goToGeneralPurgePage();
+ assertGeneralPurgePage();
+ clickLinkWithXPath( "//preceding::input[@value='repository' and @type='hidden']//following::input[@type='submit']" );
+ assertAddRepositoryPurgePage();
+ }
+
+ public void goToEditRepositoryPurge( String daysOlder, String retentionCount, String description )
+ {
+ goToGeneralPurgePage();
+ assertGeneralPurgePage();
+ String xPath = "//preceding::td[text()='" + description + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertAddRepositoryPurgePage();
+ assertFieldValue( daysOlder, "daysOlder" );
+ assertFieldValue( retentionCount, "retentionCount" );
+ assertFieldValue( description, "description" );
+ }
+
+ public void goToEditDirectoryPurge( String daysOlder, String retentionCount, String description )
+ {
+ goToGeneralPurgePage();
+ assertGeneralPurgePage();
+ String xPath = "//preceding::td[text()='" + description + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertAddEditDirectoryPurgePage();
+ assertFieldValue( daysOlder, "daysOlder" );
+ assertFieldValue( retentionCount, "retentionCount" );
+ assertFieldValue( description, "description" );
+ }
+
+ public void addEditRepositoryPurge( String daysOlder, String retentionCount, String description, boolean success )
+ {
+ setFieldValue( "daysOlder", daysOlder );
+ setFieldValue( "retentionCount", retentionCount );
+ setFieldValue( "description", description );
+ submit();
+ if ( success )
+ {
+ assertGeneralPurgePage();
+ }
+ else
+ {
+ assertAddRepositoryPurgePage();
+ }
+ }
+
+ public void goToAddDirectoryPurge()
+ {
+ goToGeneralPurgePage();
+ assertGeneralPurgePage();
+ clickLinkWithXPath( "//preceding::input[@value='directory' and @type='hidden']//following::input[@type='submit']" );
+ assertAddEditDirectoryPurgePage();
+ }
+
+ public void addEditDirectoryPurge( String daysOlder, String retentionCount, String description, boolean success )
+ {
+ setFieldValue( "daysOlder", daysOlder );
+ setFieldValue( "retentionCount", retentionCount );
+ setFieldValue( "description", description );
+ submit();
+ if ( success )
+ {
+ assertGeneralPurgePage();
+ }
+ else
+ {
+ assertAddEditDirectoryPurgePage();
+ }
+ }
+
+ // ////////////////////////////////////
+ // LocalRepository
+ // ////////////////////////////////////
+ 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( "Continuum - 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();
+ }
+ }
+
+ // ////////////////////////////////////
+ // Schedule
+ // ////////////////////////////////////
+
+ public void goToSchedulePage()
+ {
+ clickLinkWithText( "Schedules" );
+
+ assertSchedulePage();
+ }
+
+ public void goToAddSchedule()
+ {
+ goToSchedulePage();
+ clickButtonWithValue( "Add" );
+ assertAddSchedulePage();
+ }
+
+ public void assertSchedulePage()
+ {
+ assertPage( "Continuum - Schedules" );
+ assertTextPresent( "Schedules" );
+ assertTextPresent( "Name" );
+ assertTextPresent( "Description" );
+ assertTextPresent( "Quiet Period" );
+ assertTextPresent( "Cron Expression" );
+ assertTextPresent( "Max Job Time" );
+ assertTextPresent( "Active" );
+ assertTextPresent( "DEFAULT_SCHEDULE" );
+ assertImgWithAlt( "Edit" );
+ assertImgWithAlt( "Delete" );
+ assertButtonWithValuePresent( "Add" );
+ }
+
+ public void assertAddSchedulePage()
+ {
+ assertPage( "Continuum - Edit Schedule" );
+ assertTextPresent( "Continuum - Edit Schedule" );
+ assertTextPresent( "Name" );
+ assertElementPresent( "name" );
+ assertTextPresent( "Description" );
+ assertElementPresent( "description" );
+ assertTextPresent( "Cron Expression" );
+ assertTextPresent( "Second" );
+ assertElementPresent( "second" );
+ assertTextPresent( "Minute" );
+ assertElementPresent( "minute" );
+ assertTextPresent( "Hour" );
+ assertElementPresent( "hour" );
+ assertTextPresent( "Day of Month" );
+ assertElementPresent( "dayOfMonth" );
+ assertTextPresent( "Month" );
+ assertElementPresent( "month" );
+ assertTextPresent( "Day of Week" );
+ assertElementPresent( "dayOfWeek" );
+ assertTextPresent( "Year [optional]" );
+ assertElementPresent( "year" );
+ assertTextPresent( "Maximum job execution time" );
+ assertElementPresent( "maxJobExecutionTime" );
+ assertTextPresent( "Quiet Period (seconds):" );
+ assertElementPresent( "delay" );
+ assertTextPresent( "Add Build Queue" );
+ assertElementPresent( "availableBuildQueues" );
+ assertElementPresent( "selectedBuildQueues" );
+ assertElementPresent( "active" );
+ assertTextPresent( "Enable/Disable the schedule" );
+ assertButtonWithValuePresent( "Save" );
+ assertButtonWithValuePresent( "Cancel" );
+ }
+
+ public void addEditSchedule( String name, String description, String second, String minute, String hour,
+ String dayMonth, String month, String dayWeek, String year, String maxTime,
+ String period, boolean success )
+ {
+ setFieldValue( "name", name );
+ setFieldValue( "description", description );
+ setFieldValue( "second", second );
+ setFieldValue( "minute", minute );
+ setFieldValue( "hour", hour );
+ setFieldValue( "dayOfMonth", dayMonth );
+ setFieldValue( "month", month );
+ setFieldValue( "dayOfWeek", dayWeek );
+ setFieldValue( "year", year );
+ setFieldValue( "maxJobExecutionTime", maxTime );
+ setFieldValue( "delay", period );
+ submit();
+ if ( success )
+ {
+ assertSchedulePage();
+ }
+ else
+ {
+ assertAddSchedulePage();
+ }
+ }
+
+ public void goToEditSchedule( String name, String description, String second, String minute, String hour,
+ String dayMonth, String month, String dayWeek, String year, String maxTime,
+ String period )
+ {
+ goToSchedulePage();
+ String xPath = "//preceding::td[text()='" + name + "']//following::img[@alt='Edit']";
+ clickLinkWithXPath( xPath );
+ assertAddSchedulePage();
+ assertFieldValue( name, "name" );
+ assertFieldValue( description, "description" );
+ assertFieldValue( second, "second" );
+ assertFieldValue( minute, "minute" );
+ assertFieldValue( hour, "hour" );
+ assertFieldValue( dayMonth, "dayOfMonth" );
+ assertFieldValue( month, "month" );
+ assertFieldValue( dayWeek, "dayOfWeek" );
+ assertFieldValue( year, "year" );
+ assertFieldValue( maxTime, "maxJobExecutionTime" );
+ assertFieldValue( period, "delay" );
+ }
+
+ public void removeSchedule( String name )
+ {
+ goToSchedulePage();
+ clickLinkWithXPath( "(//a[contains(@href,'removeSchedule.action') and contains(@href, '" + name + "')])//img" );
+ // TODO: Change Title "Continuum -"
+ assertPage( "Schedule Removal" );
+ assertTextPresent( "Schedule Removal" );
+ assertTextPresent( "Are you sure you want to delete the schedule \"" + name + "\"?" );
+ assertButtonWithValuePresent( "Delete" );
+ assertButtonWithValuePresent( "Cancel" );
+ clickButtonWithValue( "Delete" );
+ assertSchedulePage();
+ }
+
+ // ////////////////////////////////////
// Configuration
// ////////////////////////////////////
+
+ public void goToConfigurationPage()
+ {
+ clickLinkWithText( "Configuration" );
+ assertEditConfigurationPage();
+ }
+
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" );
}
- public void submitConfigurationPage( String baseUrl, String companyName, String companyLogo, String companyUrl )
+ 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 );
- if ( companyName != null )
+ setFieldValue( "numberOfAllowedBuildsinParallel", numberBuildParallel );
+ if ( distributed )
{
- setFieldValue( "companyName", companyName );
+ checkField( "distributedBuildEnabled" );
}
- if ( companyLogo != null )
+ else
{
- setFieldValue( "companyLogo", companyLogo );
+ uncheckField( "distributedBuildEnabled" );
}
- if ( companyUrl != null )
+ submit();
+ if ( success )
{
- setFieldValue( "companyUrl", companyUrl );
+ assertEditedConfigurationPage( working, buildOutput, releaseOutput, deploymentRepository, baseUrl,
+ numberBuildParallel );
+ }else {
+ assertEditConfigurationPage();
}
- submit();
- waitPage();
}
// ////////////////////////////////////
@@ -281,11 +773,11 @@
while ( isElementPresent( "//img[@alt='Building']" ) || isElementPresent( "//img[@alt='Updating']" ) )
{
Thread.sleep( 10000 );
- geSelenium().refresh();
+ getSelenium().refresh();
waitPage();
if ( currentIt > maxIt )
{
- Assert.fail("Timeout, Can't build project group");
+ Assert.fail( "Timeout, Can't build project group" );
}
currentIt++;
}
@@ -334,15 +826,14 @@
assertTextPresent( "Project Group Build Definitions of " + projectGroupName + " group" );
}
- public void assertDeleteBuildDefinitionPage( String description, String goals)
+ 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" );
+ 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" );
@@ -367,8 +858,9 @@
assertElementPresent( "profileId" );
}
- public void addEditGroupBuildDefinition( String groupName, String buildFile, String goals, String arguments, String description,
- boolean buildFresh, boolean alwaysBuild, boolean isDefault )
+ 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
@@ -406,9 +898,12 @@
}
submit();
- if(groupName != null){
+ if ( groupName != null )
+ {
assertGroupBuildDefinitionPage( groupName );
- } else {
+ }
+ else
+ {
assertProjectInformationPage();
}
}
@@ -443,7 +938,7 @@
assertTextPresent( "Send on Error" );
assertTextPresent( "Send on Warning" );
// TODO: Replace On for on
- assertTextPresent( "Send On SCM Failure" );
+ assertTextPresent( "Send on SCM Failure" );
assertElementPresent( "address" );
assertElementPresent( "Cancel" );
}
@@ -481,7 +976,7 @@
assertTextPresent( "Send on Failure" );
assertTextPresent( "Send on Error" );
assertTextPresent( "Send on Warning" );
- assertTextPresent( "Send On SCM Failure" );
+ assertTextPresent( "Send on SCM Failure" );
}
public void assertAddEditJabberPage()
@@ -508,7 +1003,7 @@
assertTextPresent( "Send on Error" );
assertTextPresent( "Send on Warning" );
// TODO: Change On for on
- assertTextPresent( "Send On SCM Failure" );
+ assertTextPresent( "Send on SCM Failure" );
}
public void assertAddEditMsnPage()
@@ -526,7 +1021,7 @@
assertTextPresent( "Send on Failure" );
assertTextPresent( "Send on Error" );
assertTextPresent( "Send on Warning" );
- assertTextPresent( "Send On SCM Failure" );
+ assertTextPresent( "Send on SCM Failure" );
}
public void assertAddEditWagonPage()
@@ -907,7 +1402,7 @@
clickLinkWithText( "Show Project Groups" );
clickLinkWithText( projectGroupName );
clickLinkWithText( projectName );
- geSelenium().click( "addProjectNotifier" );
+ getSelenium().click( "addProjectNotifier" );
clickLinkWithXPath( "//input[@id='addProjectNotifier_0']" );
assertNotifierPage();
@@ -1034,7 +1529,7 @@
// TODO: Improve the condition
String condition = "selenium.browserbot.getCurrentWindow().document.getElementById('" + ident + "')";
// 'Continuum - Project Group'
- geSelenium().waitForCondition( condition, maxWaitTimeInMs );
+ getSelenium().waitForCondition( condition, maxWaitTimeInMs );
}
/**
@@ -1096,6 +1591,6 @@
submit();
- geSelenium().waitForCondition( "'' == document.title", maxWaitTimeInMs );
+ getSelenium().waitForCondition( "'' == document.title", maxWaitTimeInMs );
}
}
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java?rev=761003&r1=761002&r2=761003&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AbstractSeleniumTest.java Wed Apr 1 18:30:13 2009
@@ -48,7 +48,7 @@
/**
* Initialize selenium an others properties. This method is called from BeforeSuite method of sub-class.
*/
- public void open(int number)
+ public void open()
throws Exception
{
p = new Properties();
@@ -61,15 +61,17 @@
int seleniumPort = Integer.parseInt( ( p.getProperty( "SELENIUM_PORT" ) ) );
String seleniumBrowser = p.getProperty( "SELENIUM_BROWSER" );
final Selenium s = new DefaultSelenium( seleniumHost, seleniumPort, seleniumBrowser, baseUrl );
- selenium = new ThreadLocal<Selenium>() {
- protected Selenium initialValue() {
+ selenium = new ThreadLocal<Selenium>()
+ {
+ protected Selenium initialValue()
+ {
return s;
}
};
- geSelenium().start();
+ getSelenium().start();
}
- protected static Selenium geSelenium()
+ protected static Selenium getSelenium()
{
return selenium.get();
}
@@ -80,7 +82,7 @@
public void close()
throws Exception
{
- geSelenium().stop();
+ getSelenium().stop();
}
// *******************************************************
@@ -90,7 +92,7 @@
public void assertFieldValue( String fieldValue, String fieldName )
{
assertElementPresent( fieldName );
- Assert.assertEquals( fieldValue, geSelenium().getValue( fieldName ) );
+ Assert.assertEquals( fieldValue, getSelenium().getValue( fieldName ) );
}
public void assertPage( String title )
@@ -100,22 +102,22 @@
public String getTitle()
{
- return geSelenium().getTitle();
+ return getSelenium().getTitle();
}
public String getHtmlContent()
{
- return geSelenium().getHtmlSource();
+ return getSelenium().getHtmlSource();
}
public void assertTextPresent( String text )
{
- Assert.assertTrue( geSelenium().isTextPresent( text ), "'" + text + "' isn't present." );
+ Assert.assertTrue( getSelenium().isTextPresent( text ), "'" + text + "' isn't present." );
}
public void assertTextNotPresent( String text )
{
- Assert.assertFalse( geSelenium().isTextPresent( text ), "'" + text + "' is present." );
+ Assert.assertFalse( getSelenium().isTextPresent( text ), "'" + text + "' is present." );
}
public void assertElementPresent( String elementLocator )
@@ -159,7 +161,7 @@
public boolean isTextPresent( String text )
{
- return geSelenium().isTextPresent( text );
+ return getSelenium().isTextPresent( text );
}
public boolean isLinkPresent( String text )
@@ -169,27 +171,27 @@
public boolean isElementPresent( String locator )
{
- return geSelenium().isElementPresent( locator );
+ return getSelenium().isElementPresent( locator );
}
public void waitPage()
{
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
}
public String getFieldValue( String fieldName )
{
- return geSelenium().getValue( fieldName );
+ return getSelenium().getValue( fieldName );
}
public String getCellValueFromTable( String tableElement, int row, int column )
{
- return geSelenium().getTable( tableElement + "." + row + "." + column );
+ return getSelenium().getTable( tableElement + "." + row + "." + column );
}
public void selectValue( String locator, String value )
{
- geSelenium().select( locator, "label=" + value );
+ getSelenium().select( locator, "label=" + value );
}
public void submit()
@@ -275,7 +277,7 @@
public void clickLinkWithLocator( String locator, boolean wait )
{
assertElementPresent( locator );
- geSelenium().click( locator );
+ getSelenium().click( locator );
if ( wait )
{
waitPage();
@@ -290,27 +292,27 @@
{
entry = entries.next();
- geSelenium().type( entry.getKey(), entry.getValue() );
+ getSelenium().type( entry.getKey(), entry.getValue() );
}
}
public void setFieldValue( String fieldName, String value )
{
- geSelenium().type( fieldName, value );
+ getSelenium().type( fieldName, value );
}
public void checkField( String locator )
{
- geSelenium().check( locator );
+ getSelenium().check( locator );
}
public void uncheckField( String locator )
{
- geSelenium().uncheck( locator );
+ getSelenium().uncheck( locator );
}
public boolean isChecked( String locator )
{
- return geSelenium().isChecked( locator );
+ return getSelenium().isChecked( locator );
}
}
Added: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java?rev=761003&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java (added)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ConfigurationTest.java Wed Apr 1 18:30:13 2009
@@ -0,0 +1,86 @@
+package org.apache.continuum.web.test;
+
+/*
+ * 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.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "configuration" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class ConfigurationTest
+ extends AbstractContinuumTest
+{
+ private String WORKING_DIRECTORY;
+
+ private String BASE_URL;
+
+ private String BUILD_OUTPUT_DIRECTORY;
+
+ private String RELEASE_OUTPUT_DIRECTORY;
+
+ private String DEPLOYMENT_REPOSITORY_DIRECTORY;
+
+ private String NUMBER_ALLOWED_PARALLEL;
+
+ public void defaultConfiguration()
+ {
+ goToConfigurationPage();
+ WORKING_DIRECTORY = getFieldValue( "workingDirectory" );
+ BASE_URL = getFieldValue( "baseUrl" );
+ BUILD_OUTPUT_DIRECTORY = getFieldValue( "buildOutputDirectory" );
+ RELEASE_OUTPUT_DIRECTORY = getFieldValue( "releaseOutputDirectory" );
+ DEPLOYMENT_REPOSITORY_DIRECTORY = getFieldValue( "deploymentRepositoryDirectory" );
+ NUMBER_ALLOWED_PARALLEL = getFieldValue( "numberOfAllowedBuildsinParallel" );
+ }
+
+ @Test( dependsOnMethods = { "defaultConfiguration" } )
+ public void editConfiguration()
+ {
+ String newWorking = "newWorking";
+ String newUrl = "http://localhost:8181";
+ String newBuildOutput = "newBuildOutput";
+ String newReleaseOutput = "newReleaseOutput";
+ String newDeployRepository = "newDeployRepository";
+ String newNumberParallel = "9";
+ goToConfigurationPage();
+ submitConfiguration( newWorking, newBuildOutput, newReleaseOutput, newDeployRepository, newUrl,
+ newNumberParallel, true, true );
+ clickButtonWithValue( "Edit" );
+ submitConfiguration( WORKING_DIRECTORY, BUILD_OUTPUT_DIRECTORY, RELEASE_OUTPUT_DIRECTORY,
+ DEPLOYMENT_REPOSITORY_DIRECTORY, BASE_URL, NUMBER_ALLOWED_PARALLEL, false, true );
+ }
+
+ public void setInvalidConfiguration()
+ {
+ goToConfigurationPage();
+ submitConfiguration( "", "", "", "", "", "", true, false );
+ assertTextPresent( "You must define a working directory" );
+ assertTextPresent( "You must define a build output directory" );
+ assertTextPresent( "You must define a URL" );
+ }
+
+ public void setZeroParallelBuilds()
+ {
+ setMaxBuildQueue( 0 );
+ assertTextPresent( "Number of Allowed Builds in Parallel must be greater than zero" );
+ }
+}
Added: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java?rev=761003&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java (added)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LocalRepositoriesTest.java Wed Apr 1 18:30:13 2009
@@ -0,0 +1,78 @@
+package org.apache.continuum.web.test;
+
+/*
+ * 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.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "repository" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class LocalRepositoriesTest
+ extends AbstractContinuumTest
+{
+ public void testAddLocalRepository()
+ {
+ String LOCAL_REPOSITORY_NAME = p.getProperty( "LOCAL_REPOSITORY_NAME" );
+ String LOCAL_REPOSITORY_LOCATION = p.getProperty( "LOCAL_REPOSITORY_LOCATION" );
+ goToAddLocalRepository();
+ addEditLocalRepository( LOCAL_REPOSITORY_NAME, LOCAL_REPOSITORY_LOCATION, true );
+ }
+
+ public void testAddInvalidLocalRepository()
+ {
+ goToAddLocalRepository();
+ addEditLocalRepository( "", "", false );
+ assertTextPresent( "You must define a name." );
+ assertTextPresent( "You must define a local repository directory." );
+ }
+
+ @Test(dependsOnMethods = {"testAddLocalRepository"})
+ public void testAddDuplicatedLocalRepository()
+ {
+ String LOCAL_REPOSITORY_NAME = p.getProperty( "LOCAL_REPOSITORY_NAME" );
+ String LOCAL_REPOSITORY_LOCATION = p.getProperty( "LOCAL_REPOSITORY_LOCATION" );
+ goToAddLocalRepository();
+ addEditLocalRepository( LOCAL_REPOSITORY_NAME, LOCAL_REPOSITORY_LOCATION, false );
+ assertTextPresent( "Local repository name must be unique" );
+ assertTextPresent( "Local repository location must be unique" );
+ }
+
+ @Test(dependsOnMethods = {"testAddDuplicatedLocalRepository"})
+ public void testEditLocalRepository()
+ {
+ String LOCAL_REPOSITORY_NAME = p.getProperty( "LOCAL_REPOSITORY_NAME" );
+ String LOCAL_REPOSITORY_LOCATION = p.getProperty( "LOCAL_REPOSITORY_LOCATION" );
+ String newName = "new_name";
+ String newLocation = "new_location";
+ goToEditLocalRepository( LOCAL_REPOSITORY_NAME, LOCAL_REPOSITORY_LOCATION );
+ addEditLocalRepository( newName, newLocation, true );
+ goToEditLocalRepository( newName, newLocation );
+ addEditLocalRepository( LOCAL_REPOSITORY_NAME, LOCAL_REPOSITORY_LOCATION, true );
+ }
+
+ @Test(dependsOnMethods = {"testEditLocalRepository"})
+ public void testDeleteLocalRepository()
+ {
+ String LOCAL_REPOSITORY_NAME = p.getProperty( "LOCAL_REPOSITORY_NAME" );
+ removeLocalRepository( LOCAL_REPOSITORY_NAME );
+ }
+}
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LoginTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LoginTest.java?rev=761003&r1=761002&r2=761003&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LoginTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/LoginTest.java Wed Apr 1 18:30:13 2009
@@ -41,10 +41,10 @@
public void testWithBadUsername()
{
diplayLoginPage();
- geSelenium().type( "loginForm_username", "badUsername" );
- geSelenium().type( "loginForm_username", p.getProperty( "ADMIN_PASSWORD" ) );
- geSelenium().click( "loginForm__login" );
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ getSelenium().type( "loginForm_username", "badUsername" );
+ getSelenium().type( "loginForm_username", p.getProperty( "ADMIN_PASSWORD" ) );
+ getSelenium().click( "loginForm__login" );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" );
}
@@ -52,10 +52,10 @@
public void testWithBadPassword()
{
diplayLoginPage();
- geSelenium().type( "loginForm_username", p.getProperty( "ADMIN_USERNAME" ) );
- geSelenium().type( "loginForm_password", "badPassword" );
- geSelenium().click( "loginForm__login" );
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ getSelenium().type( "loginForm_username", p.getProperty( "ADMIN_USERNAME" ) );
+ getSelenium().type( "loginForm_password", "badPassword" );
+ getSelenium().click( "loginForm__login" );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" );
}
@@ -63,9 +63,9 @@
public void testWithEmptyUsername()
{
diplayLoginPage();
- geSelenium().type( "loginForm_password", "password" );
- geSelenium().click( "loginForm__login" );
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ getSelenium().type( "loginForm_password", "password" );
+ getSelenium().click( "loginForm__login" );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "User Name is required" );
}
@@ -73,9 +73,9 @@
public void testWithEmptyPassword()
{
diplayLoginPage();
- geSelenium().type( "loginForm_username", p.getProperty( "ADMIN_USERNAME" ) );
- geSelenium().click( "loginForm__login" );
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ getSelenium().type( "loginForm_username", p.getProperty( "ADMIN_USERNAME" ) );
+ getSelenium().click( "loginForm__login" );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" );
}
@@ -83,10 +83,10 @@
public void testWithCorrectUsernamePassword()
{
diplayLoginPage();
- geSelenium().type( "loginForm_username", p.getProperty( "ADMIN_USERNAME" ) );
- geSelenium().type( "loginForm_password", p.getProperty( "ADMIN_PASSWORD" ) );
- geSelenium().click( "loginForm__login" );
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ getSelenium().type( "loginForm_username", p.getProperty( "ADMIN_USERNAME" ) );
+ getSelenium().type( "loginForm_password", p.getProperty( "ADMIN_PASSWORD" ) );
+ getSelenium().click( "loginForm__login" );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "Edit Details" );
assertTextPresent( "Logout" );
assertTextPresent( p.getProperty( "ADMIN_USERNAME" ) );
@@ -97,7 +97,7 @@
public void open()
throws Exception
{
- super.open(2);
+ super.open();
}
@Override
@@ -110,7 +110,7 @@
private void diplayLoginPage()
{
- geSelenium().open( baseUrl + "/security/login.action" );
+ getSelenium().open( baseUrl + "/security/login.action" );
waitPage();
}
}
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MyAccountTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MyAccountTest.java?rev=761003&r1=761002&r2=761003&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MyAccountTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MyAccountTest.java Wed Apr 1 18:30:13 2009
@@ -45,7 +45,7 @@
setFieldValue( "user.fullName", newFullName );
setFieldValue( "user.email", newEmail );
submit();
- geSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ getSelenium().waitForPageToLoad( maxWaitTimeInMs );
Assert.assertEquals( "Continuum - Group Summary", getTitle() );
displayEditDetail();
assertFieldValue( newFullName, "user.fullName" );
Added: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java?rev=761003&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java (added)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java Wed Apr 1 18:30:13 2009
@@ -0,0 +1,112 @@
+package org.apache.continuum.web.test;
+
+/*
+ * 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.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "purge" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class PurgeTest
+ extends AbstractContinuumTest
+{
+ public void testAddRepositoryPurge()
+ {
+ String PURGE_REPOSITORY_DESCRIPTION = p.getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+ String PURGE_REPOSITORY_DAYS = p.getProperty( "PURGE_REPOSITORY_DAYS" );
+ String PURGE_REPOSITORY_RETETION = p.getProperty( "PURGE_REPOSITORY_RETETION" );
+ goToAddRepositoryPurge();
+ addEditRepositoryPurge( PURGE_REPOSITORY_DAYS, PURGE_REPOSITORY_RETETION, PURGE_REPOSITORY_DESCRIPTION, true );
+ }
+
+ public void testAddInvalidRepositoryPurge()
+ {
+ String PURGE_REPOSITORY_DESCRIPTION = p.getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+ goToAddRepositoryPurge();
+ addEditRepositoryPurge( "", "", PURGE_REPOSITORY_DESCRIPTION, false );
+ assertTextPresent( "Retention Count must be greater than 0." );
+ }
+
+ @Test( dependsOnMethods = { "testAddRepositoryPurge" } )
+ public void testEditRepositoryPurge()
+ {
+ String PURGE_REPOSITORY_DESCRIPTION = p.getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+ String PURGE_REPOSITORY_DAYS = p.getProperty( "PURGE_REPOSITORY_DAYS" );
+ String PURGE_REPOSITORY_RETETION = p.getProperty( "PURGE_REPOSITORY_RETETION" );
+ String newDescription = "new_description";
+ String newDays = "45";
+ String newRetention = "4";
+ goToEditRepositoryPurge( PURGE_REPOSITORY_DAYS, PURGE_REPOSITORY_RETETION, PURGE_REPOSITORY_DESCRIPTION );
+ addEditRepositoryPurge( newDays, newRetention, newDescription, true );
+ goToEditRepositoryPurge( newDays, newRetention, newDescription );
+ addEditRepositoryPurge( PURGE_REPOSITORY_DAYS, PURGE_REPOSITORY_RETETION, PURGE_REPOSITORY_DESCRIPTION, true );
+ }
+
+ @Test( dependsOnMethods = { "testEditRepositoryPurge" } )
+ public void testDeleteRepositoryPurge()
+ {
+ String PURGE_REPOSITORY_DESCRIPTION = p.getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+ removeRepositoryPurge( PURGE_REPOSITORY_DESCRIPTION );
+ }
+
+ public void testAddDirectoryPurge()
+ {
+ String PURGE_DIRECTORY_DESCRIPTION = p.getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+ String PURGE_DIRECTORY_DAYS = p.getProperty( "PURGE_DIRECTORY_DAYS" );
+ String PURGE_DIRECTORY_RETETION = p.getProperty( "PURGE_DIRECTORY_RETETION" );
+ goToAddDirectoryPurge();
+ addEditDirectoryPurge( PURGE_DIRECTORY_DAYS, PURGE_DIRECTORY_RETETION, PURGE_DIRECTORY_DESCRIPTION, true );
+ }
+
+ public void testAddInvalidDirectoryPurge()
+ {
+ String PURGE_DIRECTORY_DESCRIPTION = p.getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+ goToAddDirectoryPurge();
+ addEditDirectoryPurge( "", "", PURGE_DIRECTORY_DESCRIPTION, false );
+ assertTextPresent( "Retention Count must be greater than 0." );
+ }
+
+ @Test( dependsOnMethods = { "testAddDirectoryPurge" } )
+ public void testEditDirectoryPurge()
+ {
+ String PURGE_DIRECTORY_DESCRIPTION = p.getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+ String PURGE_DIRECTORY_DAYS = p.getProperty( "PURGE_DIRECTORY_DAYS" );
+ String PURGE_DIRECTORY_RETETION = p.getProperty( "PURGE_DIRECTORY_RETETION" );
+ String newDescription = "new_description";
+ String newDays = "45";
+ String newRetention = "4";
+ goToEditDirectoryPurge( PURGE_DIRECTORY_DAYS, PURGE_DIRECTORY_RETETION, PURGE_DIRECTORY_DESCRIPTION );
+ addEditDirectoryPurge( newDays, newRetention, newDescription, true );
+ goToEditDirectoryPurge( newDays, newRetention, newDescription );
+ addEditDirectoryPurge( PURGE_DIRECTORY_DAYS, PURGE_DIRECTORY_RETETION, PURGE_DIRECTORY_DESCRIPTION, true );
+ }
+
+ @Test( dependsOnMethods = { "testEditDirectoryPurge" } )
+ public void testDeleteDirectoryPurge()
+ {
+ String PURGE_DIRECTORY_DESCRIPTION = p.getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+ removeDirectoryPurge( PURGE_DIRECTORY_DESCRIPTION );
+ }
+ /*
+ * public void testPurge(){ goToGeneralPurgePage(); clickImgWithAlt( "Purge" ); assertGeneralPurgePage(); }
+ */
+}
Added: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java?rev=761003&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java (added)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java Wed Apr 1 18:30:13 2009
@@ -0,0 +1,83 @@
+package org.apache.continuum.web.test;
+
+/*
+ * 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.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "queue" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class QueueTest
+ extends AbstractContinuumTest
+{
+
+ public void testAddBuildQueue()
+ {
+ setMaxBuildQueue( 2 );
+ String BUILD_QUEUE_NAME = p.getProperty( "BUILD_QUEUE_NAME" );
+ addBuildQueue( BUILD_QUEUE_NAME, true );
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildQueue" } )
+ public void testAddNotAllowedBuildQueue()
+ {
+ setMaxBuildQueue( 1 );
+ String secodQueue = "second_queue_name";
+ addBuildQueue( secodQueue, false );
+ assertTextPresent( "You are only allowed 1 number of builds in parallel." );
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildQueue" } )
+ public void testAddAlreadyExistBuildQueue()
+ {
+ setMaxBuildQueue( 3 );
+ String BUILD_QUEUE_NAME = p.getProperty( "BUILD_QUEUE_NAME" );
+ addBuildQueue( BUILD_QUEUE_NAME, false );
+ assertTextPresent( "Build queue name already exists." );
+ }
+
+ public void testAddEmptyBuildQueue()
+ {
+ setMaxBuildQueue( 3 );
+ addBuildQueue( "", false );
+ assertTextPresent( "You must define a name" );
+ }
+
+ @Test( dependsOnMethods = { "testAddBuildQueue", "testAddAlreadyExistBuildQueue" } )
+ public void testDeleteBuildQueue()
+ {
+ goToBuildQueuePage();
+ String BUILD_QUEUE_NAME = p.getProperty( "BUILD_QUEUE_NAME" );
+ removeBuildQueue( BUILD_QUEUE_NAME );
+ }
+
+ public void testQueuePage()
+ {
+ clickLinkWithText( "Queues" );
+ assertPage( "Continuum - Build Queue" );
+ assertTextPresent( "Current Build" );
+ assertTextPresent( "Continuum - Build Queue" );
+ assertTextPresent( "Current Checkout" );
+ assertTextPresent( "Checkout Queue" );
+ assertButtonWithValuePresent( "Cancel Entries" );
+ }
+}
Added: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java?rev=761003&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java (added)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java Wed Apr 1 18:30:13 2009
@@ -0,0 +1,123 @@
+package org.apache.continuum.web.test;
+
+/*
+ * 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.annotations.Test;
+
+/**
+ * @author José Morales MartÃnez
+ * @version $Id$
+ */
+@Test( groups = { "schedule" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class ScheduleTest
+ extends AbstractContinuumTest
+{
+ public void testAddSchedule()
+ {
+ String SCHEDULE_NAME = p.getProperty( "SCHEDULE_NAME" );
+ String SCHEDULE_DESCRIPTION = p.getProperty( "SCHEDULE_DESCRIPTION" );
+ String SCHEDULE_EXPR_SECOND = p.getProperty( "SCHEDULE_EXPR_SECOND" );
+ String SCHEDULE_EXPR_MINUTE = p.getProperty( "SCHEDULE_EXPR_MINUTE" );
+ String SCHEDULE_EXPR_HOUR = p.getProperty( "SCHEDULE_EXPR_HOUR" );
+ String SCHEDULE_EXPR_DAY_MONTH = p.getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+ String SCHEDULE_EXPR_MONTH = p.getProperty( "SCHEDULE_EXPR_MONTH" );
+ String SCHEDULE_EXPR_DAY_WEEK = p.getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+ String SCHEDULE_EXPR_YEAR = p.getProperty( "SCHEDULE_EXPR_YEAR" );
+ String SCHEDULE_MAX_TIME = p.getProperty( "SCHEDULE_MAX_TIME" );
+ String SCHEDULE_PERIOD = p.getProperty( "SCHEDULE_PERIOD" );
+ goToAddSchedule();
+ addEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+ SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+ SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD, true );
+ }
+
+ public void testAddInvalidSchedule()
+ {
+ goToAddSchedule();
+ addEditSchedule( "", "", "", "", "", "", "", "", "", "", "", false );
+ assertTextPresent( "Invalid cron expression value(s)" );
+ assertTextPresent( "Name is required and cannot contain spaces only" );
+ assertTextPresent( "Description is required and cannot contain spaces only" );
+ }
+
+ @Test( dependsOnMethods = { "testAddSchedule" } )
+ public void testAddDuplicatedSchedule()
+ {
+ // TODO: Wait for schedule.buildqueues.add.error
+ String SCHEDULE_NAME = p.getProperty( "SCHEDULE_NAME" );
+ String SCHEDULE_DESCRIPTION = p.getProperty( "SCHEDULE_DESCRIPTION" );
+ String SCHEDULE_EXPR_SECOND = p.getProperty( "SCHEDULE_EXPR_SECOND" );
+ String SCHEDULE_EXPR_MINUTE = p.getProperty( "SCHEDULE_EXPR_MINUTE" );
+ String SCHEDULE_EXPR_HOUR = p.getProperty( "SCHEDULE_EXPR_HOUR" );
+ String SCHEDULE_EXPR_DAY_MONTH = p.getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+ String SCHEDULE_EXPR_MONTH = p.getProperty( "SCHEDULE_EXPR_MONTH" );
+ String SCHEDULE_EXPR_DAY_WEEK = p.getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+ String SCHEDULE_EXPR_YEAR = p.getProperty( "SCHEDULE_EXPR_YEAR" );
+ String SCHEDULE_MAX_TIME = p.getProperty( "SCHEDULE_MAX_TIME" );
+ String SCHEDULE_PERIOD = p.getProperty( "SCHEDULE_PERIOD" );
+ goToAddSchedule();
+ addEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+ SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+ SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD, false );
+ assertTextPresent( "schedule.buildqueues.add.error" );
+ }
+
+ @Test( dependsOnMethods = { "testAddDuplicatedSchedule" } )
+ public void testEditSchedule()
+ {
+ String SCHEDULE_NAME = p.getProperty( "SCHEDULE_NAME" );
+ String SCHEDULE_DESCRIPTION = p.getProperty( "SCHEDULE_DESCRIPTION" );
+ String SCHEDULE_EXPR_SECOND = p.getProperty( "SCHEDULE_EXPR_SECOND" );
+ String SCHEDULE_EXPR_MINUTE = p.getProperty( "SCHEDULE_EXPR_MINUTE" );
+ String SCHEDULE_EXPR_HOUR = p.getProperty( "SCHEDULE_EXPR_HOUR" );
+ String SCHEDULE_EXPR_DAY_MONTH = p.getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+ String SCHEDULE_EXPR_MONTH = p.getProperty( "SCHEDULE_EXPR_MONTH" );
+ String SCHEDULE_EXPR_DAY_WEEK = p.getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+ String SCHEDULE_EXPR_YEAR = p.getProperty( "SCHEDULE_EXPR_YEAR" );
+ String SCHEDULE_MAX_TIME = p.getProperty( "SCHEDULE_MAX_TIME" );
+ String SCHEDULE_PERIOD = p.getProperty( "SCHEDULE_PERIOD" );
+ String name = "new_name";
+ String description = "new_description";
+ String second = "1";
+ String minute = "20";
+ String hour = "15";
+ String dayMonth = "20";
+ String month = "9";
+ String dayWeek = "?";
+ String year = "";
+ String maxTime = "9000";
+ String period = "0";
+ goToEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+ SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+ SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD );
+ addEditSchedule( name, description, second, minute, hour, dayMonth, month, dayWeek, year, maxTime, period, true );
+ goToEditSchedule( name, description, second, minute, hour, dayMonth, month, dayWeek, year, maxTime, period );
+ addEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+ SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+ SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD, true );
+ }
+
+ @Test( dependsOnMethods = { "testEditSchedule" } )
+ public void testDeleteSchedule()
+ {
+ String SCHEDULE_NAME = p.getProperty( "SCHEDULE_NAME" );
+ removeSchedule( SCHEDULE_NAME );
+ }
+}