1 package org.apache.archiva.web.test;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
24 import org.apache.archiva.web.test.parent.AbstractSearchTest;
25 import org.testng.annotations.Test;
27 @Test( groups = { "search" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
28 public class SearchTest
29 extends AbstractSearchTest
32 public void testSearchNonExistingArtifact()
35 searchForArtifact( getProperty( "SEARCH_BAD_ARTIFACT" ) );
36 assertTextPresent( "No results found" );
39 // TODO: make search tests more robust especially when comparing/asserting number of hits
40 public void testSearchExistingArtifact()
42 searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
43 assertTextPresent( "Results" );
44 assertTextPresent( "Hits: 1 to 1 of 1" );
45 assertLinkPresent( "test" );
48 public void testViewSearchedArtifact()
50 searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
51 clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) );
52 assertPage( "Apache Archiva \\ Browse Repository" );
53 assertTextPresent( getProperty( "ARTIFACT_ARTIFACTID" ) );
54 clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
55 assertPage( "Apache Archiva \\ Browse Repository" );
58 public void testSearchNonExistingArtifactInAdvancedSearch()
60 searchForArtifactAdvancedSearch( null, getProperty( "SEARCH_BAD_ARTIFACT" ), null, null, null, null );
61 assertTextPresent( "No results found" );
64 public void testSearchNoSearchCriteriaSpecifiedInAdvancedSearch()
66 searchForArtifactAdvancedSearch( null, null, null, null, null, null );
67 assertTextPresent( "Advanced Search - At least one search criteria must be provided." );
70 public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
72 searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null,
73 getProperty( "REPOSITORYID" ), null, null );
74 assertTextPresent( "Results" );
75 assertTextPresent( "Hits: 1 to 1 of 1" );
76 assertLinkPresent( "test" );
79 public void testSearchExistingArtifactUsingAdvancedSearchGroupId()
81 searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null,
83 assertTextPresent( "Results" );
84 assertTextPresent( "Hits: 1 to 1 of 1" );
85 assertLinkPresent( "test" );
88 public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository()
90 searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null );
91 assertTextPresent( "No results found" );
92 assertTextNotPresent( "Results" );
93 assertTextNotPresent( "Hits: 1 to 1 of 1" );
94 assertLinkNotPresent( "test" );