diff options
5 files changed, 63 insertions, 12 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js index ef18d0bf4..4585adf6e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js @@ -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 : { diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html index 6f03d6351..ee7a674ec 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html @@ -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> diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml index a606a527a..b8fd5f3b3 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml @@ -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> diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java index b967a70fc..e0df61b07 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/LoginTest.java @@ -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. * diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java new file mode 100644 index 000000000..e4b948f24 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/RolesManagementTest.java @@ -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" ) ) ); + } +} |