From: Maria Odea B. Ching Date: Thu, 19 Apr 2007 10:50:25 +0000 (+0000) Subject: MRM-318 Created tests for archiva webapp ProxiedRepository configuration X-Git-Tag: archiva-0.9-alpha-2~23 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0ccf0a4bdb663d4c20fb1282ebb73fbc01da8e9a;p=archiva.git MRM-318 Created tests for archiva webapp ProxiedRepository configuration git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@530375 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/SettingsTest.java b/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/SettingsTest.java new file mode 100644 index 000000000..ba17ee798 --- /dev/null +++ b/archiva-webapp-test/src/test/it/org/apache/maven/archiva/web/test/SettingsTest.java @@ -0,0 +1,159 @@ +package org.apache.maven.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. + */ + + +/** + * Test archiva 'Settings' + * + * @author Maria Odea Ching + */ +public class SettingsTest + extends AbstractArchivaTestCase +{ + + public void testRunIndexer() + { + clickSettings(); + + clickLinkWithText( "Run Now" ); + waitPage(); + + assertPage( "Administration" ); + + logout(); + } + + public void testEditIndexDirectory() + { + clickEditConfiguration(); + + setFieldValue( "indexPath", getBasedir() + "target/index" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Administration" ); + assertTextPresent( getBasedir() + "target/index" ); + + logout(); + } + + public void testValidIndexSchedule() + { + clickEditConfiguration(); + + setFieldValue( "second", "*" ); + setFieldValue( "minute", "*" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Administration" ); + + logout(); + } + + public void testInvalidIndexSchedule() + { + clickEditConfiguration(); + setFieldValue( "second", "asdf" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Configuration" ); + assertTextPresent( "Invalid Cron Expression" ); + + logout(); + } + + public void testEditProxyHost() + { + clickEditConfiguration(); + + setFieldValue( "proxy.host", "asdf" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Administration" ); + + logout(); + } + + public void testValidProxyPort() + { + clickEditConfiguration(); + + setFieldValue( "proxy.port", "32143" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Administration" ); + + logout(); + } + + public void testInvalidProxyPort() + { + clickEditConfiguration(); + setFieldValue( "proxy.port", "asdf" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Configuration" ); + assertTextPresent( "Port" ); + assertTextPresent( "Invalid field value for field \"proxy.port\"" ); + + setFieldValue( "proxy.port", "-1" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Administration" ); + + logout(); + } + + public void testEditProxyCredentials() + { + clickEditConfiguration(); + + setFieldValue( "proxy.username", "asdf" ); + clickButtonWithValue( "Save Configuration" ); + waitPage(); + assertPage( "Administration" ); + + logout(); + } + + /** + * Click Edit Configuration link + */ + private void clickEditConfiguration() + { + clickSettings(); + + clickLinkWithText( "Edit Configuration" ); + assertPage( "Configuration" ); + } + + /** + * Click Settings from the navigation menu + */ + private void clickSettings() + { + goToLoginPage(); + submitLoginPage( adminUsername, adminPassword ); + + clickLinkWithText( "Settings" ); + assertPage( "Administration" ); + } + +}