continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r469551 - in /maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test: AbstractSeleniumTestCase.java AntTest.java
Date Tue, 31 Oct 2006 16:55:30 GMT
Author: evenisse
Date: Tue Oct 31 08:55:30 2006
New Revision: 469551

URL: http://svn.apache.org/viewvc?view=rev&rev=469551
Log:
Start the Ant test

Added:
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java
  (with props)
Modified:
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java?view=diff&rev=469551&r1=469550&r2=469551
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java
(original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractSeleniumTestCase.java
Tue Oct 31 08:55:30 2006
@@ -142,18 +142,36 @@
 
     public void clickLinkWithText( String text )
     {
-        clickLinkWithLocator( "link=" + text );
+        clickLinkWithText( text, true );
+    }
+
+    public void clickLinkWithText( String text, boolean wait )
+    {
+        clickLinkWithLocator( "link=" + text, wait );
     }
 
     public void clickLinkWithXPath( String xpath )
     {
-        clickLinkWithLocator( "xpath=" + xpath );
+        clickLinkWithXPath( xpath, true );
+    }
+
+    public void clickLinkWithXPath( String xpath, boolean wait )
+    {
+        clickLinkWithLocator( "xpath=" + xpath, wait );
     }
 
     public void clickLinkWithLocator( String locator )
     {
+        clickLinkWithLocator( locator, true );
+    }
+
+    public void clickLinkWithLocator( String locator, boolean wait )
+    {
         sel.click( locator );
-        waitPage();
+        if ( wait )
+        {
+            waitPage();
+        }
     }
 
     //////////////////////////////////////
@@ -286,5 +304,61 @@
         }
         sel.click( "//input[@type='submit']" );
         waitPage();
+    }
+
+    //////////////////////////////////////
+    // ANT/SHELL Projects
+    //////////////////////////////////////
+    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( "Version" );
+        assertElementPresent( "projectVersion" );
+        assertTextPresent( "Scm Url" );
+        assertElementPresent( "projectScmUrl" );
+        assertTextPresent( "Scm Username" );
+        assertElementPresent( "projectScmUsername" );
+        assertTextPresent( "Scm Password" );
+        assertElementPresent( "projectScmPassword" );
+        assertTextPresent( "Scm Branch/Tag" );
+        assertElementPresent( "projectScmTag" );
+        assertLinkPresent( "Maven SCM URL" );
+    }
+
+    public void assertAddAntProjectPage()
+    {
+        assertAddProjectPage( "ant" );
+    }
+
+    public void assertAddShellProjectPage()
+    {
+        assertAddProjectPage( "shell" );
+    }
+
+    //////////////////////////////////////
+    // Group Summary
+    //////////////////////////////////////
+    public void assertGroupSummaryPage()
+    {
+        assertPage( "Continuum - Group Summary" );
+        assertTextPresent( "Project Groups" );
+        if ( sel.isTextPresent( "No Project Groups Known." ) )
+        {
+            assertTextNotPresent( "Name" );
+            assertTextNotPresent( "Group Id" );
+            assertTextNotPresent( "Projects" );
+            assertTextNotPresent( "Build Status" );
+        }
+        else
+        {
+            assertTextPresent( "Name" );
+            assertTextPresent( "Group Id" );
+            assertTextPresent( "Projects" );
+            assertTextPresent( "Build Status" );
+        }
     }
 }

Added: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java?view=auto&rev=469551
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java
(added)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java
Tue Oct 31 08:55:30 2006
@@ -0,0 +1,91 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class AntTest
+    extends AbstractAuthenticatedAccessTestCase
+{
+    public String getUsername()
+    {
+        return adminUsername;
+    }
+
+    public String getPassword()
+    {
+        return adminPassword;
+    }
+
+    public void testAddAntProject()
+    {
+        goToAddAntPage();
+        getSelenium().type( "projectName", "Foo" );
+        getSelenium().type( "projectVersion", "1.0-SNAPSHOT" );
+        getSelenium().type( "projectScmUrl",
+                            "https://svn.apache.org/repos/asf/maven/continuum/trunk/continuum-test-projects/ant/"
);
+        clickLinkWithXPath( "//input[@type='submit']" );
+        assertGroupSummaryPage();
+        assertTextPresent( "Default Project Group" );
+        clickLinkWithText( "Default Project Group");
+        assertTextPresent( "Foo");
+
+        //TODO Add more tests (values in Default Project Group, values in project view, notifiers,
build defintions, delete, build,...)
+    }
+
+    public void testSubmitEmptyForm()
+    {
+        goToAddAntPage();
+        clickLinkWithXPath( "//input[@type='submit']", false );
+        assertAddAntProjectPage();
+        assertTextPresent( "Name is required" );
+        assertTextPresent( "Version is required" );
+        assertTextPresent( "SCM Url is required" );
+    }
+
+    public void testSubmitEmptyProjectName()
+    {
+        goToAddAntPage();
+        clickLinkWithXPath( "//input[@type='submit']", false );
+        assertAddAntProjectPage();
+        assertTextPresent( "Name is required" );
+    }
+
+    public void testSubmitEmptyVersion()
+    {
+        goToAddAntPage();
+        clickLinkWithXPath( "//input[@type='submit']", false );
+        assertAddAntProjectPage();
+        assertTextPresent( "Version is required" );
+    }
+
+    public void testSubmitEmptyScmUrl()
+    {
+        goToAddAntPage();
+        clickLinkWithXPath( "//input[@type='submit']", false );
+        assertAddAntProjectPage();
+        assertTextPresent( "SCM Url is required" );
+    }
+
+    private void goToAddAntPage()
+    {
+        clickLinkWithText( "Ant Project" );
+        assertAddAntProjectPage();
+    }
+}

Propchange: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AntTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message