]> source.dussan.org Git - archiva.git/commitdiff
merge fixes to Selenium tests from trunk
authorBrett Porter <brett@apache.org>
Thu, 4 Mar 2010 02:00:16 +0000 (02:00 +0000)
committerBrett Porter <brett@apache.org>
Thu, 4 Mar 2010 02:00:16 +0000 (02:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@918814 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
archiva-modules/archiva-web/archiva-webapp-test/ReadMe.txt
archiva-modules/archiva-web/archiva-webapp-test/pom.xml
archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/conf/archiva.xml
archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml [deleted file]
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/FindArtifactTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java

index a1d2d63963c2b95244651ad10e61203e1c9eef19..ff27feb7ac07e7e103d5d9218b342e3fd6a55084 100644 (file)
@@ -13,7 +13,9 @@ The Cargo installations are stored outside of target to avoid multiple downloads
 To remove the Cargo installations and re-download them next run, use:
   - mvn -Pclean-cargo clean
 
-For the default values in the scripts, to pass all the tests, you need to add an artifact in internal repository.
+Internet Explorer and Safari users must disable their popup blockers. Using *iexplore as
+the browser requires running as an Administrator on Windows 7/Vista, or alternatively you
+can use *iexploreproxy.
 
 Run Selenium tests in src/test/it with Maven and JUnit
   - mvn clean install -f junit-pom.xml
index 519d9410da4bb67a5a23f4309aa9f46eef4d8e38..0606be098b3e93c7aa054a47aef30934bde1dee3 100644 (file)
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <suiteXmlFiles>
-            <suiteXmlFile>src/test/testng/config/testng.xml</suiteXmlFile>
-          </suiteXmlFiles>
+          <properties>
+            <!--
+              Use this instead of suiteXmlFiles so that we can add the exclusion, as it is only accepted without suiteXmlFiles
+            -->
+            <property>
+              <name>listener</name>
+              <value>org.apache.archiva.web.test.listener.CaptureScreenShotsListener</value>
+            </property>
+            <property>
+              <name>excludegroups</name>
+              <!-- Exclude on all browsers but Firefox, as it is the only one that Selenium supports file uploads on -->
+              <value>${excluded.groups}</value>
+            </property>
+          </properties>
         </configuration>
         <executions>
           <execution>
                   <name>browser</name>
                   <value>${selenium.browser}</value>
                 </property>
-               <property>
+                           <property>
                   <name>baseUrl</name>
                   <value>${baseUrl}</value>
                 </property>
       </activation>
       <properties>
         <selenium.browser>*firefox</selenium.browser>
+        <excluded.groups />
       </properties>
     </profile>
     <profile>
       </activation>
       <properties>
         <selenium.browser>*iexplore</selenium.browser>
+        <excluded.groups>requiresUpload</excluded.groups>
       </properties>
     </profile>
     <profile>
       </activation>
       <properties>
         <selenium.browser>*safari</selenium.browser>
+        <excluded.groups>requiresUpload</excluded.groups>
       </properties>
     </profile>
     <profile>
       </activation>
       <properties>
         <selenium.browser>*custom ${browserPath}</selenium.browser>
+        <excluded.groups>requiresUpload</excluded.groups>
       </properties>
     </profile>
     <profile>
index 4208167ece3229f4ee01a66c5d81fa003c6816fc..a95ad86e21ed7bdc4a55e08a2c6a3f0f2b3e9020 100644 (file)
@@ -1,3 +1,8 @@
 <configuration>
   <localRepository></localRepository>
+  <webapp>
+    <ui>
+      <appletFindEnabled>false</appletFindEnabled>
+    </ui>
+  </webapp>
 </configuration>
index 8cce0ef131534ea17beb3b528cb71a0431e6ad22..beb2ab7d05590dfd9cf4ef5389036fdacc47ee2d 100644 (file)
@@ -81,7 +81,7 @@ SNAPSHOT_GROUPID=org.apache.archiva
 SNAPSHOT_ARTIFACTID=archiva-test
 SNAPSHOT_VERSION=1.0-SNAPSHOT
 SNAPSHOT_PACKAGING=jar
-SNAPSHOT_ARTIFACTFILEPATH=test
+SNAPSHOT_ARTIFACTFILEPATH=src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar
 SNAPSHOT_REPOSITORYID=snapshots
 
 # REPOSITORIES
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml
deleted file mode 100644 (file)
index e8607fb..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<!--
-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.
--->
-
-<suite name="ArchivaTest" verbose="1">
-       <listeners>
-               <listener class-name="org.apache.archiva.web.test.listener.CaptureScreenShotsListener"/>
-       </listeners>
-       
-       <test name="AdminTest" enabled="true">
-               <groups>
-                       <run>
-                               <include name="about" />
-                               <include name= "login" />
-                               <include name= "userroles" />
-                               <include name= "reposcan" />
-                               <include name= "artifactmanagement" />
-                               <include name= "search" />
-                               <include name= "auditlogsreport" />
-                               <include name= "browse" />
-                               <include name= "reports" />
-                               <include name= "virtualrepository" />
-                               <include name= "networkproxies" />
-                               <include name= "repository" />
-                               <include name= "appearance" />
-                               <include name= "findartifact" />
-                               <include name= "legacysupport" />
-                               <include name= "database" />
-                       </run>
-               </groups>
-               <packages>
-                       <package name="org.apache.archiva.web.test" />
-               </packages>
-       </test>
-</suite>
index 4b3bc18250ebbc27f145f06d946fed85058db1d2..e5a02bd721f787c368113a1178becce194b21b0f 100644 (file)
@@ -62,8 +62,8 @@ public class ArchivaAdminTest
             String username = getProperty( "ADMIN_USERNAME" );
             String mail = getProperty( "ADMIN_EMAIL" );
             String password = getProperty( "ADMIN_PASSWORD" );
-            submitAdminData( fullname, mail, password );            
-            assertAuthenticatedPage( username );
+            submitAdminData( fullname, mail, password );
+            assertUserLoggedIn( username );
             submit();
             clickLinkWithText( "Logout" );
        }
index 1f60076bc913fbe7de55257ba9d522fdbaebe340..4eb22b172d9e1cdf81d270af9359a4c2ede66772 100644 (file)
@@ -83,24 +83,22 @@ public class ArtifactManagementTest
                assertTextPresent( "Please add a file to upload." );
        }
        
-    @Test( enabled = false )
+    @Test(groups = "requiresUpload")
        public void testAddArtifactValidValues()
        {
-               // TODO: disable test on non *chrome browsers, there is no way to do file uploads (SEL-63)
                addArtifact( getGroupId() , "testAddArtifactValidValues", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
-               assertTextPresent( "Artifact 'test:test:1.0' was successfully deployed to repository 'internal'" );
+               assertTextPresent( "Artifact 'test:testAddArtifactValidValues:1.0' was successfully deployed to repository 'internal'" );
        }
                
        //MRM-747
-    @Test( enabled = false )
+    @Test(groups = "requiresUpload")
        public void testAddArtifactBlockRedeployments()
        {
-            // TODO: disable test on non *chrome browsers, there is no way to do file uploads (SEL-63)
             addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
             assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
        }
        
-    @Test( enabled = false )
+    @Test(groups = "requiresUpload")
        public void testDeleteArtifact()
        {
                //prep
index dbe3d08ed49f4266835c3ccc9210365a1f0ab87d..99ab2f03828983e6179e5410e6e4b6061d531347 100644 (file)
@@ -68,8 +68,7 @@ public class AuditLogsReportTest
     }    
     
     // TODO: add test for adding via WebDAV
-    // TODO: disable if not running on *chrome
-    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload")
     public void testViewAuditLogsDataFound()
     {
         goToAuditLogReports();        
@@ -82,15 +81,14 @@ public class AuditLogsReportTest
         assertAuditLogsReportPage();
         assertTextPresent( "Results" );
         assertTextNotPresent( "No audit logs found." );
-        assertTextPresent( "test-1.0.jar" );
+        assertTextPresent( "testAddArtifactValidValues-1.0.jar" );
         assertTextPresent( "Uploaded File" );
         assertTextPresent( "internal" );
         assertTextPresent( "admin" );
     }
     
     // TODO: add test for adding via WebDAV
-    // TODO: disable if not running on *chrome
-    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload")
     public void testViewAuditLogsOnlyArtifactIdIsSpecified()
     {
         goToAuditLogReports();        
@@ -101,17 +99,15 @@ public class AuditLogsReportTest
         submit();
                 
         assertAuditLogsReportPage();
-        assertTextPresent( "Results" );
+        assertTextPresent( "If you specify an artifact ID, you must specify a group ID" );
+        assertTextNotPresent( "Results" );
         assertTextNotPresent( "No audit logs found." );
-        assertTextPresent( "test-1.0.jar" );
-        assertTextPresent( "Uploaded File" );
-        assertTextPresent( "internal" );
-        assertTextPresent( "admin" );
+        assertTextNotPresent( "testAddArtifactValidValues-1.0.jar" );
+        assertTextNotPresent( "Uploaded File" );
     }
     
     // TODO: add test for adding via WebDAV
-    // TODO: disable if not running on *chrome
-    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload")
     public void testViewAuditLogsForAllRepositories()
     {
         goToAuditLogReports();        
@@ -123,13 +119,13 @@ public class AuditLogsReportTest
         assertAuditLogsReportPage();
         assertTextPresent( "Results" );
         assertTextNotPresent( "No audit logs found." );
-        assertTextPresent( "test-1.0.jar" );
+        assertTextPresent( "testAddArtifactValidValues-1.0.jar" );
         assertTextPresent( "Uploaded File" );
         assertTextPresent( "internal" );
         assertTextPresent( "admin" );
     }
     
-    @Test (dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, groups = "requiresUpload")
     public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly()
     {
         String groupId = getProperty( "SNAPSHOT_GROUPID" );
@@ -144,23 +140,23 @@ public class AuditLogsReportTest
         
         clickLinkWithText( "Logout" );
                 
-        login( getProperty( "REPOMANAGER_INTERNAL_USERNAME" ), getUserRolePassword() );
-        goToAuditLogReports();        
+        login( getProperty( "REPOMANAGER_INTERNAL_USERNAME" ), getUserRoleNewPassword() );
+
+        goToAuditLogReports();
         assertAuditLogsReportPage();
-        
+
         selectValue( "repository", "all" );
         submit();
-        
+
         assertAuditLogsReportPage();
         assertTextPresent( "Results" );
         assertTextNotPresent( "No audit logs found." );
-        assertTextPresent( "test-1.0.jar" );
+        assertTextPresent( "testAddArtifactValidValues-1.0.jar" );
         assertTextPresent( "Uploaded File" );
         assertTextPresent( "internal" );
         assertTextPresent( "admin" );
-        
+
         assertTextNotPresent( artifactId + "-" + version + "." + packaging );
-        
         clickLinkWithText( "Logout" );
         login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
     }
index c9c60ecce05ea90af676bf3782a03d1618c59e0b..a82a8f5849256e24457a9eb8b5ffd39d1aa5e416 100644 (file)
@@ -45,13 +45,9 @@ public class BrowseTest
        }
 
     // MRM-1278
-    @Test( enabled = false )
+    @Test(groups = {"requiresUpload"})
     public void testCorrectRepositoryInBrowse()
     {
-        File artifact =
-            new File( getBasedir(),
-                      "/src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" );                     
-                
         String releasesRepo = getProperty( "RELEASES_REPOSITORY" );
         
         // create releases repository first
@@ -64,10 +60,10 @@ public class BrowseTest
         
         String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" );
 
+        String path = "src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
         // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well)
         // upload a snapshot artifact to repository 'releases'        
-        addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", artifact.getPath(),
-                     releasesRepo );
+        addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo );
         assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '" + releasesRepo + "'" );
 
         goToBrowsePage();
@@ -77,8 +73,7 @@ public class BrowseTest
         assertArtifactInfoPage( "1.0-SNAPSHOT/", releasesRepo, "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar" );
 
         // upload a snapshot artifact to repository 'snapshots'        
-        addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", artifact.getPath(),
-                     snapshotsRepo );
+        addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
         assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '" + snapshotsRepo + "'" );
 
         goToBrowsePage();
index 3431ebf9eb9f748f2a5ab16644952e4eb64c1528..f0db8bea310f8caa185213bf6764d52c445b8edc 100644 (file)
@@ -40,4 +40,6 @@ public class FindArtifactTest
                clickButtonWithValue( "Search" );
                assertTextPresent( "No results found" );
        }
+
+    // TODO: test using file upload on Firefox versions that support getAsBinary (ie, no applet)
 }
index a1ad6d5ec61d82e0873135cf0849e6174c37e02f..1f984fbc7a6843b27121d872c9d4371d7f0267e2 100644 (file)
@@ -34,8 +34,8 @@ public class UserRolesTest
                
                createUser( username, fullname, getUserEmail(), getUserRolePassword(), true);
                deleteUser( username, fullname, getUserEmail() );
-               clickLinkWithText( "Logout" );
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
        
        @Test (dependsOnMethods = { "testBasicAddDeleteUser" } )
@@ -49,20 +49,20 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkUserRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
        
        @Test (dependsOnMethods = { "testUserWithGuestRole" } )
@@ -76,20 +76,20 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkUserRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
        
        @Test (dependsOnMethods = { "testUserWithRegisteredUserRole" } )
@@ -103,20 +103,20 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkUserRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
        
        @Test (dependsOnMethods = { "testUserWithSysAdminUserRole" } )
@@ -130,20 +130,20 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkUserRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
        
        @Test (dependsOnMethods = { "testUserWithUserAdminUserRole" } )
@@ -157,20 +157,20 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkUserRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
 
        @Test (dependsOnMethods = { "testUserWithGlobalRepoManagerRole" } )
@@ -184,20 +184,20 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkUserRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
        
        @Test (dependsOnMethods = { "testUserWithGlobalRepoObserverRole" } )
@@ -211,20 +211,20 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkResourceRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
        
        /*@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
@@ -265,46 +265,46 @@ public class UserRolesTest
                clickLinkWithText( "Edit Roles" );
                checkResourceRoleWithValue( fullname );
                clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
+
+        logout();
+        login(username, getUserRolePassword());
                changePassword( getUserRolePassword(), getUserRoleNewPassword());
                
                // this section will be removed if issue from redback after changing password will be fixed.
                getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
+        logout();
+        //assertTextPresent("You are already logged in.");
                
                login(username, getUserRoleNewPassword());
                assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
+        logout();
+        login( getAdminUsername() , getAdminPassword() );
        }
-       
-       /*@Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } )
-       public void testUserWithRepoObserverSnapshotsRole()
-       {
-               username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" );
-               fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" );
-               
-               createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
-               clickLinkWithText( username );
-               clickLinkWithText( "Edit Roles" );
-               checkResourceRoleWithValue( fullname );
-               clickButtonWithValue( "Submit" );
-               
-               clickLinkWithText("Logout");
-               login(username, getUserRolePassword());
-               changePassword( getUserRolePassword(), getUserRoleNewPassword());
-               
-               // this section will be removed if issue from redback after changing password will be fixed.
-               getSelenium().goBack();
-               clickLinkWithText("Logout");
-               //assertTextPresent("You are already logged in.");
-               
-               login(username, getUserRoleNewPassword());
-               assertLeftNavMenuWithRole( fullname );
-               clickLinkWithText("Logout");
-               login( getAdminUsername() , getAdminPassword() );
-       }*/
+
+    /*@Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } )
+     public void testUserWithRepoObserverSnapshotsRole()
+     {
+         username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" );
+         fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" );
+
+         createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
+         clickLinkWithText( username );
+         clickLinkWithText( "Edit Roles" );
+         checkResourceRoleWithValue( fullname );
+         clickButtonWithValue( "Submit" );
+
+         clickLinkWithText("Logout");
+         login(username, getUserRolePassword());
+         changePassword( getUserRolePassword(), getUserRoleNewPassword());
+
+         // this section will be removed if issue from redback after changing password will be fixed.
+         getSelenium().goBack();
+         clickLinkWithText("Logout");
+         //assertTextPresent("You are already logged in.");
+
+         login(username, getUserRoleNewPassword());
+         assertLeftNavMenuWithRole( fullname );
+         clickLinkWithText("Logout");
+         login( getAdminUsername() , getAdminPassword() );
+     }*/
 }
index 947d7cbf3bf80038963acafa0dd3a9a3e1aa5365..8ee826394baf70a0fb9e62d6441c268073e62eb4 100644 (file)
@@ -75,7 +75,7 @@ public class CaptureScreenShotsListener
         {
             selenium.windowMaximize();
             File fileName = new File( targetPath, fileBaseName + ".png" );
-            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "" );
+            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
         }
         catch ( RuntimeException e )
         {
index 9209d6f606f92b24d3324aa7e6e44aa402d2cda9..642949e1a93866a3dd3ba3f6370df5f6a6b2df6c 100644 (file)
@@ -1,6 +1,7 @@
 package org.apache.archiva.web.test.parent;
 
 import java.io.File;
+import java.io.IOException;
 
 import org.apache.archiva.web.test.XPathExpressionUtil;
 
@@ -117,8 +118,8 @@ public abstract class AbstractArchivaTest
                submit();
                if ( success )
                {
-                       assertAuthenticatedPage( username );
-               }
+                assertUserLoggedIn( username );
+            }
                else
                {
                    assertLoginPage();
@@ -141,18 +142,8 @@ public abstract class AbstractArchivaTest
                assertTextPresent( "Need an Account? Register!" );
                assertTextPresent( "Forgot your Password? Request a password reset." );
        }
-       
-       public void assertAuthenticatedPage( String username )
-       {
-               assertTextPresent( "Current User" );
-               assertTextPresent( "Edit Details" );
-               assertTextPresent( "Logout" );
-               assertTextNotPresent( "Login" );
-               assertTextPresent( username );
-       }
-       
-       
-       //User Management
+
+    //User Management
        public void goToUserManagementPage()
        {
                clickLinkWithText( "User Management" );
@@ -277,6 +268,10 @@ public abstract class AbstractArchivaTest
 
             submitLoginPage( username, password, false, valid, assertReturnPage );
         }
+        if ( valid )
+        {
+            assertUserLoggedIn( username );
+        }
     }
     
     public void submitLoginPage( String username, String password )
@@ -303,10 +298,7 @@ public abstract class AbstractArchivaTest
 
         if ( validUsernamePassword )
         {
-            assertTextPresent( "Current User:" );
-            assertTextPresent( username );
-            assertLinkPresent( "Edit Details" );
-            assertLinkPresent( "Logout" );
+            assertUserLoggedIn( username );
         }
         else
         {
@@ -320,8 +312,17 @@ public abstract class AbstractArchivaTest
             }
         }
     }
-    
-        // User Roles
+
+    protected void assertUserLoggedIn( String username )
+    {
+        assertTextPresent( "Current User:" );
+        assertTextPresent( username );
+        assertLinkPresent( "Edit Details" );
+        assertLinkPresent( "Logout" );
+        assertTextNotPresent( "Login" );
+    }
+
+    // User Roles
        public void assertUserRoleCheckBoxPresent(String value) 
        {
                getSelenium()   .isElementPresent("xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='"   + value + "']");
@@ -417,11 +418,9 @@ public abstract class AbstractArchivaTest
                assertPage( "Apache Archiva \\ Find Artifact" );
                assertTextPresent( "Find Artifact" );
                assertTextPresent( "Search for:" );
-               assertElementPresent( "f" );
                assertTextPresent( "Checksum:" );
                assertElementPresent( "q" );
                assertButtonWithValuePresent( "Search" );
-               assertTextPresent( "This allows you to search the repository using the checksum of an artifact that you are trying to identify. You can either specify the checksum to look for directly, or scan a local artifact file." );
        }
        
        //Appearance
@@ -495,7 +494,25 @@ public abstract class AbstractArchivaTest
             checkField( "generatePom" );
         }
 
-        setFieldValue( "artifact", artifactFilePath );
+        String path;
+        if ( artifactFilePath != null && artifactFilePath.trim().length() > 0 )
+        {
+            File f = new File( artifactFilePath );
+            try
+            {
+                path = f.getCanonicalPath();
+            }
+            catch ( IOException e )
+            {
+                path = f.getAbsolutePath();
+            }
+        }
+        else
+        {
+            path = artifactFilePath;
+        }
+
+        setFieldValue( "artifact", path );
         setFieldValue( "repositoryId", repositoryId );
 
         clickButtonWithValue( "Submit" );
@@ -534,4 +551,13 @@ public abstract class AbstractArchivaTest
        //TODO  
        clickButtonWithValue( "Add Repository" );
     }
+
+    protected void logout()
+    {
+        clickLinkWithText("Logout");
+        assertTextNotPresent( "Current User:" );
+        assertLinkNotPresent( "Edit Details" );
+        assertLinkNotPresent( "Logout" );
+        assertLinkPresent( "Login" );
+    }
 }
index cf03765b0fe59e6d3a154cd97c5ad9bd31333c46..04f5242a757405f26180c4392cc2eb3a7a3ac7a3 100644 (file)
@@ -1,8 +1,6 @@
 package org.apache.archiva.web.test.parent;
 
-import java.io.File;
-
-public abstract class AbstractArtifactManagementTest 
+public abstract class AbstractArtifactManagementTest
        extends AbstractArchivaTest
 {
        
@@ -32,9 +30,7 @@ public abstract class AbstractArtifactManagementTest
        
        public String getArtifactFilePath()
        {
-               File f = new File( "" );
-               String artifactFilePath = f.getAbsolutePath();
-               return artifactFilePath + "/src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" ;
+               return "src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
        }
        
        public String getRepositoryId()
@@ -45,6 +41,7 @@ public abstract class AbstractArtifactManagementTest
        
        public void goToDeleteArtifactPage()
        {
+        login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
                clickLinkWithText( "Delete Artifact" );
                assertDeleteArtifactPage();
        }
index cb4fee20815a695f83e2fa96815d42a0345c9fd9..d4d090a5bfae8a7337294e410d4152478911dd6b 100644 (file)
@@ -26,14 +26,13 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Map.Entry;
-
-import org.apache.commons.io.IOUtils;
-import org.testng.Assert;
+import java.util.Properties;
 
 import com.thoughtworks.selenium.DefaultSelenium;
 import com.thoughtworks.selenium.Selenium;
+import org.apache.commons.io.IOUtils;
+import org.testng.Assert;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -176,7 +175,7 @@ public abstract class AbstractSeleniumTest {
        
        public void assertLinkPresent( String text )
        {
-          Assert.assertTrue( isElementPresent( "link=" + text ), "The link '" + text + "' isî't present." );
+          Assert.assertTrue( isElementPresent( "link=" + text ), "The link '" + text + "' isn't present." );
        }
        
        public void assertLinkNotPresent( String text )