]> source.dussan.org Git - archiva.git/blob
bc7b20c572db91debd19e2022711bb0f3c9179bc
[archiva.git] /
1 package org.apache.maven.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 /**
23  * Archiva's webapp UI test for browsing the indexed repository.
24  * 
25  */
26 public class BrowseRepositoryTest
27     extends AbstractArchivaTestCase
28 {
29     private void browseArtifact()
30     {
31         clickLinkWithText( "Browse" );
32         assertPage( "Browse Repository" );
33         assertTextPresent( "Browse Repository" );
34         assertLinkPresent( "org.apache.maven.archiva.web.test/" );
35         
36         clickLinkWithText( "org.apache.maven.archiva.web.test/" );
37         assertPage( "Browse Repository" );
38         assertTextPresent( "Browse Repository" );
39         assertTextPresent( "Artifacts" );
40         assertLinkPresent( "artifact-a/" );
41         
42         clickLinkWithText( "artifact-a/" );
43         assertPage( "Browse Repository" );
44         assertTextPresent( "Browse Repository" );
45         assertTextPresent( "Versions" );
46         assertLinkPresent( "1.0/" );
47         
48         clickLinkWithText( "1.0/" );
49         assertPage( "Browse Repository" );
50         assertTextPresent( "artifact-a" );
51         assertLinkPresent( "Main" );
52     }
53     
54     public void testBrowseArtifactInfo()
55     {
56         browseArtifact();
57         
58         assertTextPresent( "Info" );
59         assertLinkPresent( "Dependencies" );
60         assertLinkPresent( "Dependency Tree" );
61         assertLinkPresent( "Used By" );
62         assertLinkPresent( "Mailing Lists" );
63         
64         assertEquals("Group ID", getSelenium().getTable("//table[1].0.0"));
65         assertEquals("org.apache.maven.archiva.web.test", getSelenium().getTable("//table[1].0.1"));
66         assertEquals("Artifact ID", getSelenium().getTable("//table[1].1.0"));
67         assertEquals("artifact-a", getSelenium().getTable("//table[1].1.1"));
68         assertEquals("Version", getSelenium().getTable("//table[1].2.0"));
69         assertEquals("1.0", getSelenium().getTable("//table[1].2.1"));
70         assertEquals("Packaging", getSelenium().getTable("//table[1].3.0"));
71         assertEquals("jar", getSelenium().getTable("//table[1].3.1"));
72     }
73     
74     public void testBrowseArtifactDependencies()
75     {
76         browseArtifact();
77         
78         clickLinkWithText( "Dependencies" );
79         assertLinkPresent( "Info" );
80         assertTextPresent( "Dependencies" );
81         assertLinkPresent( "Dependency Tree" );
82         assertLinkPresent( "Used By" );
83         assertLinkPresent( "Mailing Lists" );
84         
85         assertPage( "Browse Repository" );
86         assertTextPresent( "artifact-a" );
87         assertLinkPresent( "artifact-b" );
88     }
89     
90     public void testBrowseArtifactDependencyTree()
91     {
92         browseArtifact();
93         
94         clickLinkWithText( "Dependency Tree" );
95         assertLinkPresent( "Info" );
96         assertLinkPresent( "Dependencies" );
97         assertTextPresent( "Dependency Tree" );
98         assertLinkPresent( "Used By" );
99         assertLinkPresent( "Mailing Lists" );
100         
101         assertPage( "Browse Repository" );
102         assertTextPresent( "artifact-a" );
103         assertLinkPresent( "artifact-b" );
104         assertLinkPresent( "artifact-c" );
105     }
106     
107     public void testBrowseArtifactUsedBy()
108     {
109         browseArtifact();
110         
111         clickLinkWithText( "Used By" );
112         assertLinkPresent( "Info" );
113         assertLinkPresent( "Dependencies" );
114         assertLinkPresent( "Dependency Tree" );
115         assertTextPresent( "Used By" );
116         assertLinkPresent( "Mailing Lists" );
117         
118         assertPage( "Browse Repository" );
119         assertTextPresent( "artifact-a" );
120         assertLinkPresent( "artifact-s" );
121     }
122     
123     public void testBrowseArtifactMailingLists()
124     {
125         browseArtifact();
126         
127         clickLinkWithText( "Mailing Lists" );
128         assertLinkPresent( "Info" );
129         assertLinkPresent( "Dependencies" );
130         assertLinkPresent( "Dependency Tree" );
131         assertLinkPresent( "Used By" );
132         assertTextPresent( "Mailing Lists" );
133         
134         assertPage( "Browse Repository" );
135         assertTextPresent( "artifact-a" );
136         assertTextPresent( "No mailing lists" );
137     }
138     
139     public void testBrowseUpRepositoryDirectory()
140     {
141         browseArtifact();
142         
143         assertLinkPresent( "artifact-a" );
144         
145         clickLinkWithText( "artifact-a" );
146         assertPage( "Browse Repository" );
147         assertTextPresent( "Browse Repository" );
148         assertTextPresent( "artifact-a" );
149         assertTextPresent( "Versions" );
150         assertLinkPresent( "1.0/" );
151         assertLinkPresent( "test" );
152         
153         clickLinkWithText( "test" );
154         assertPage( "Browse Repository" );
155         assertTextPresent( "Browse Repository" );
156         assertTextPresent( "Artifacts" );
157         assertLinkPresent( "artifact-a/" );
158         assertLinkPresent( "web" );
159         
160         clickLinkWithText( "web" );
161         assertPage( "Browse Repository" );
162         assertTextPresent( "Browse Repository" );
163         assertTextPresent( "Groups" );
164         assertLinkPresent( "org.apache.maven.archiva.web.test/" );
165         assertLinkPresent( "[top]" );
166         
167         clickLinkWithText( "[top]" );
168         assertPage( "Browse Repository" );
169         assertTextPresent( "Browse Repository" );
170         assertTextPresent( "Groups" );
171         assertLinkPresent( "org.apache.maven.archiva.web.test/" );
172     }
173     
174     public void testBrowseDependencyArtifact()
175     {
176         browseArtifact();
177         
178         clickLinkWithText( "Dependencies" );
179         assertPage( "Browse Repository" );
180         assertTextPresent( "artifact-a" );
181         assertLinkPresent( "artifact-b" );
182         
183         clickLinkWithText( "artifact-b" );
184         assertEquals("Group ID", getSelenium().getTable("//table[1].0.0"));
185         assertEquals("org.apache.maven.archiva.web.test", getSelenium().getTable("//table[1].0.1"));
186         assertEquals("Artifact ID", getSelenium().getTable("//table[1].1.0"));
187         assertEquals("artifact-b", getSelenium().getTable("//table[1].1.1"));
188         assertEquals("Version", getSelenium().getTable("//table[1].2.0"));
189         assertEquals("2.0", getSelenium().getTable("//table[1].2.1"));
190         assertEquals("Packaging", getSelenium().getTable("//table[1].3.0"));
191         assertEquals("jar", getSelenium().getTable("//table[1].3.1"));
192     }
193 }