1 package org.apache.archiva.web.test.parent;
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
22 public abstract class AbstractSearchTest
23 extends AbstractArchivaTest
26 public void goToSearchPage()
29 if (!isElementPresent( "quickSearchBox" ) )
31 getSelenium().open( "/index.action");
32 //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
34 assertElementPresent( "quickSearchSubmit" );
38 public void assertSearchPage()
40 assertPage( "Apache Archiva \\ Quick Search" );
41 assertTextPresent( "Search for" );
42 assertElementPresent( "quickSearchSubmit" );
43 assertButtonWithValuePresent( "Search" );
44 // assertLinkPresent( "Advanced Search" );
45 assertTextPresent( "Enter your search terms. A variety of data will be searched for your keywords." );
46 // assertButtonWithDivIdPresent( "searchHint" );
49 public void searchForArtifact( String artifactId )
53 setFieldValue( "quickSearchValue", artifactId );
54 clickButtonWithLocator( "quickSearchSubmit" );
57 public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version, String repositoryId,
58 String className, String rowCount )
62 clickLinkWithXPath( "//div[@id='contentArea']/div[1]/a[1]/strong", false );
63 assertElementPresent( "filteredSearch_searchField" );
64 assertElementPresent( "filteredSearch_repositoryId" );
66 if ( groupId != null )
68 selectValue( "filteredSearch_searchField", "Group ID" );
69 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
71 assertElementPresent( "groupId" );
72 setFieldValue( "groupId", groupId );
75 if ( artifactId != null )
77 selectValue( "filteredSearch_searchField", "Artifact ID" );
78 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
80 assertElementPresent( "artifactId" );
81 setFieldValue( "artifactId", artifactId );
84 if ( version != null )
86 selectValue( "filteredSearch_searchField", "Version" );
87 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
89 assertElementPresent( "version" );
90 setFieldValue( "version", version );
93 if ( className != null )
95 selectValue( "filteredSearch_searchField", "Class/Package Name" );
96 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
98 assertElementPresent( "className" );
99 setFieldValue( "className", className );
102 if ( rowCount != null )
104 selectValue( "filteredSearch_searchField", "Row Count" );
105 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
107 assertElementPresent( "rowCount" );
108 setFieldValue( "rowCount", rowCount );
111 if ( repositoryId != null )
113 selectValue( "filteredSearch_repositoryId", repositoryId );
115 clickSubmitWithLocator( "filteredSearch_0" );