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()
28 if ( !"Apache Archiva \\ Quick Search".equals( getSelenium().getTitle() ) )
30 clickLinkWithText( "Search" );
31 getSelenium().waitForPageToLoad( maxWaitTimeInMs );
33 assertPage( "Apache Archiva \\ Quick Search" );
37 public void assertSearchPage()
39 assertPage( "Apache Archiva \\ Quick Search" );
40 assertTextPresent( "Search for" );
41 assertElementPresent( "quickSearch_q" );
42 assertButtonWithValuePresent( "Search" );
43 //assertLinkPresent( "Advanced Search" );
44 assertTextPresent( "Enter your search terms. A variety of data will be searched for your keywords." );
45 //assertButtonWithDivIdPresent( "searchHint" );
48 public void searchForArtifact( String artifactId )
52 getSelenium().type( "dom=document.forms[1].elements[0]", artifactId );
53 clickButtonWithValue( "Search" );
56 public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version, String repositoryId,
57 String className, String rowCount )
61 clickLinkWithXPath( "//div[@id='contentArea']/div[1]/a[1]/strong", false );
62 assertElementPresent( "filteredSearch_searchField" );
63 assertElementPresent( "filteredSearch_repositoryId" );
65 if ( groupId != null )
67 selectValue( "filteredSearch_searchField", "Group ID" );
68 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
70 assertElementPresent( "groupId" );
71 setFieldValue( "groupId", groupId );
74 if ( artifactId != null )
76 selectValue( "filteredSearch_searchField", "Artifact ID" );
77 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
79 assertElementPresent( "artifactId" );
80 setFieldValue( "artifactId", artifactId );
83 if ( version != null )
85 selectValue( "filteredSearch_searchField", "Version" );
86 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
88 assertElementPresent( "version" );
89 setFieldValue( "version", version );
92 if ( className != null )
94 selectValue( "filteredSearch_searchField", "Class/Package Name" );
95 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
97 assertElementPresent( "className" );
98 setFieldValue( "className", className );
101 if ( rowCount != null )
103 selectValue( "filteredSearch_searchField", "Row Count" );
104 clickLinkWithLocator( "//a[@id='filteredSearch_']/img", false );
106 assertElementPresent( "rowCount" );
107 setFieldValue( "rowCount", rowCount );
110 clickSubmitWithLocator( "filteredSearch_0" );