You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/01/26 00:22:17 UTC

svn commit: r1235987 - in /archiva/trunk/archiva-modules/archiva-web: archiva-webapp-js/src/main/webapp/js/archiva/ archiva-webapp-js/src/main/webapp/js/redback/templates/ archiva-webapp-test-js/ archiva-webapp-test-js/src/test/testng/org/apache/archiv...

Author: olamy
Date: Wed Jan 25 23:22:16 2012
New Revision: 1235987

URL: http://svn.apache.org/viewvc?rev=1235987&view=rev
Log:
add selenium test for roles

Added:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java   (with props)
Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js?rev=1235987&r1=1235986&r2=1235987&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js Wed Jan 25 23:22:16 2012
@@ -654,6 +654,7 @@ $(function() {
   }
 
   activateRemoteRepositoryFormValidation=function(){
+    // FIXME find a way to activate cronExpression validation only if downloadRemote is activated !
     $("#main-content #remote-repository-edit-form").validate({
       /*rules: {
         daysOlder : {

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html?rev=1235987&r1=1235986&r2=1235987&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html Wed Jan 25 23:22:16 2012
@@ -23,7 +23,7 @@
 
   <ul id="roles-view-tabs" class="tabs">
     <li class="active" id="roles-view-tabs-li-roles-grid">
-      <a href="#roles-view">${$.i18n.prop('roles.grid.tab.title')}</a>
+      <a href="#roles-view" id="roles-view-tabs-a-roles-grid">${$.i18n.prop('roles.grid.tab.title')}</a>
     </li>
     <li id="roles-view-tabs-li-roles-edit">
       <a href="#role-edit">${$.i18n.prop('edit')}</a>
@@ -58,7 +58,7 @@
       <tr>
         <td colspan="2">
           <div class="pull-left">
-            <button class="btn" data-bind="click: saveRoleDescription">${$.i18n.prop('save')}</button>
+            <button class="btn" id="role-edit-description-save" data-bind="click: saveRoleDescription">${$.i18n.prop('save')}</button>
           </div>
         </td>
       </tr>
@@ -197,11 +197,13 @@
           <tr>
               {{each(j, columnDefinition) columns}}
               {{var val = (typeof columnDefinition.rowText == 'function' ? columnDefinition.rowText(row) : row[columnDefinition.rowText])}}
-              <td id="role-description-${val}">
+              <td id="role-${columnDefinition.rowText}-${row.name()}">
                 ${val}
               </td>
               {{/each}}
-              <td><a href="#" data-bind="click: function(){ window.redbackModel.rolesViewModel.editRole(row) }">Edit</a></td>
+              <td>
+                <a id="edit-role-${row.name()}" href="#" data-bind="click: function(){ window.redbackModel.rolesViewModel.editRole(row) }">${$.i18n.prop('edit')}</a>
+              </td>
           </tr>
       {{/each}}
   </tbody>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml?rev=1235987&r1=1235986&r2=1235987&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml Wed Jan 25 23:22:16 2012
@@ -29,6 +29,10 @@
   <packaging>pom</packaging>
   <name>Archiva Web :: Javascript Application Tests</name>
 
+  <properties>
+    <webappDirectory>${project.build.directory}/tomcat6x/webapps/archiva</webappDirectory>
+  </properties>
+
   <dependencies>
     <dependency>
       <groupId>org.testng</groupId>
@@ -108,6 +112,10 @@
       <groupId>javax.activation</groupId>
       <artifactId>activation</artifactId>
     </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
@@ -260,7 +268,7 @@
                       <type>war</type>
                     </artifactItem>
                   </artifactItems>
-                  <outputDirectory>${project.build.directory}/tomcat6x/webapps/archiva</outputDirectory>
+                  <outputDirectory>${webappDirectory}</outputDirectory>
                   <overWriteSnapshots>true</overWriteSnapshots>
                 </configuration>
               </execution>
@@ -344,7 +352,7 @@
                   <path>/archiva</path>
                   <port>${container.test.port}</port>
                   <uriEncoding>UTF-8</uriEncoding>
-                  <warDirectory>${project.build.directory}/tomcat6x/webapps/archiva</warDirectory>
+                  <warDirectory>${webappDirectory}</warDirectory>
                   <fork>true</fork>
                   <ignorePackaging>true</ignorePackaging>
                   <systemProperties>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java?rev=1235987&r1=1235986&r2=1235987&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java Wed Jan 25 23:22:16 2012
@@ -24,12 +24,6 @@ import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
-/*
- * Bug in TestNG. TESTNG-285: @Test(sequential=true) works incorrectly for classes with inheritance
- * http://code.google.com/p/testng/source/browse/trunk/CHANGES.txt
- * Waiting 5.9 release. It's comming soon.
- */
-
 /**
  * Based on LoginTest of Emmanuel Venisse test.
  *

Added: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java?rev=1235987&view=auto
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java (added)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java Wed Jan 25 23:22:16 2012
@@ -0,0 +1,46 @@
+package org.apache.archiva.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.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.apache.commons.lang.StringUtils;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * @author Olivier Lamy
+ */
+@Test( groups = { "usermanagement" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class RolesManagementTest
+    extends AbstractArchivaTest
+{
+    public void testReadRolesAndUpdateDescription()
+        throws Exception
+    {
+        clickLinkWithLocator( "menu-roles-list-a", true );
+        assertTextPresent( "Archiva System Administrator " );
+        Assert.assertTrue( StringUtils.isEmpty( getText( "role-description-Guest" ) ) );
+        clickLinkWithLocator( "edit-role-Guest" );
+        String desc = "The guest description";
+        setFieldValue( "role-edit-description", desc );
+        clickButtonWithLocator( "role-edit-description-save" );
+        clickLinkWithLocator( "roles-view-tabs-a-roles-grid" );
+        Assert.assertTrue( StringUtils.equals( desc, getText( "role-description-Guest" ) ) );
+    }
+}

Propchange: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision