]> source.dussan.org Git - archiva.git/blob
334e2b9821eb28464b7ef996c1fc8295d46b137b
[archiva.git] /
1 package org.apache.archiva.web.test;
2
3 /*
4  * Licensed to the Apache Software Foundation (ASF) under one
5  * or more contributor license agreements.  See the NOTICE file
6  * distributed with this work for additional information
7  * regarding copyright ownership.  The ASF licenses this file
8  * to you under the Apache License, Version 2.0 (the
9  * "License"); you may not use this file except in compliance
10  * with the License.  You may obtain a copy of the License at
11  *
12  *   http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  * KIND, either express or implied.  See the License for the
18  * specific language governing permissions and limitations
19  * under the License.
20  */
21
22 import org.apache.archiva.web.test.parent.AbstractArtifactReportsTest;
23 import org.testng.annotations.Test;
24
25 @Test( groups = { "reports" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
26 public class ReportsTest 
27         extends AbstractArtifactReportsTest
28 {
29         //TODO Tests for repository with defects
30         
31         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
32         public void testRepoStatisticsWithoutRepoCompared()
33         {
34                 goToReportsPage();
35                 clickButtonWithValue( "View Statistics" );
36                 assertTextPresent( "Please select a repository (or repositories) from the list." );
37         }
38         
39         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
40         public void testRepositoryStatisticsWithoutDate()
41         {
42                 String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ;
43                 compareRepositories( "label=" + repositoryName, "", "" );
44                 //TODO
45                 assertTextPresent( "Statistics Report" );
46         }
47         
48         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
49         public void testRepositoryStatisticsEndEarlierThanStart()
50         {
51                 String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ;
52                 String startDate = p.getProperty( "END_DATE" );
53                 String endDate = p.getProperty( "START_DATE" );
54                 compareRepositories( "label=" + repositoryName, startDate, endDate );
55                 //assertTextPresent( "Statistics for Repository '" + repositoryName + "'" );
56                 assertPage( "Apache Archiva \\ Reports" );
57                 assertTextPresent( "Start Date must be earlier than the End Date" );
58         }
59                 
60         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )        
61         public void testRepositoryStatistics()
62         {
63                 String repositoryName = p.getProperty( "REPOSITORY_NAME" ) ;
64                 String startDate = p.getProperty( "START_DATE" );
65                 String endDate = p.getProperty( "END_DATE" );
66                 compareRepositories( "label=" + repositoryName, startDate, endDate );
67                 //assertTextPresent( "Statistics for Repository '" + repositoryName + "'" );
68                 assertPage( "Apache Archiva \\ Reports" );
69                 assertTextPresent( "Statistics Report" );
70         }
71         
72         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
73         public void testRepositoriesStatisticComparisonReport()
74         {
75                 goToReportsPage();
76                 clickButtonWithValue( "-->>" , false );
77                 clickButtonWithValue( "View Statistics" );
78                 assertTextPresent( "Statistics Report" );
79         }
80         
81         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
82         public void testRepositoryHealthWithoutDefect()
83         {
84                 goToReportsPage();
85                 String groupId = p.getProperty( "ARTIFACT_GROUPID" );
86                 getSelenium().type( "generateReport_groupId" , groupId );
87                 clickButtonWithValue( "Show Report" );
88                 assertPage( "Apache Archiva \\ Reports" );
89                 assertTextPresent( "The operation generated an empty report." );
90         }
91         
92         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
93         public void testRepositoryHealthWithoutGroupId()
94         {
95                 goToReportsPage();
96                 clickButtonWithValue( "Show Report" );
97                 assertPage( "Apache Archiva \\ Reports" );
98                 assertTextPresent( "The operation generated an empty report." );
99                 
100                 //TODO As of the creation of the tests, GroupId is not a required field in showing the reports of repository health. GroupId should be required I think.
101         }
102         
103 }