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.AbstractBrowseTest;
25 import org.testng.annotations.Test;
27 @Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } )
28 public class BrowseTest
29 extends AbstractBrowseTest
32 public void testBrowseArtifact()
38 public void testClickArtifactFromBrowse()
42 clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
43 assertPage( "Apache Archiva \\ Browse Repository" );
44 assertTextPresent( "Artifacts" );
48 @Test( groups = { "requiresUpload" } )
49 public void testCorrectRepositoryInBrowse()
51 String releasesRepo = getProperty( "RELEASES_REPOSITORY" );
53 // create releases repository first
54 goToRepositoriesPage();
55 clickLinkWithText( "Add" );
56 addManagedRepository( getProperty( "RELEASES_REPOSITORY" ), "Releases Repository",
57 new File( getBasedir(), "target/repository/releases" ).getPath(), "",
58 "Maven 2.x Repository", "0 0 * * * ?", "", "" );
59 assertTextPresent( "Releases Repository" );
61 String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" );
64 "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
65 // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well)
66 // upload a snapshot artifact to repository 'releases'
67 addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo );
68 assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '"
69 + releasesRepo + "'" );
73 assertGroupsPage( "archiva/" );
74 assertArtifactsPage( "archiva-webapp/" );
75 assertArtifactInfoPage( "1.0-SNAPSHOT/", releasesRepo, "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar" );
77 // upload a snapshot artifact to repository 'snapshots'
78 addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
79 assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '"
80 + snapshotsRepo + "'" );
84 assertGroupsPage( "continuum/" );
85 assertArtifactsPage( "continuum-core/" );
86 assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "continuum", "continuum-core", "1.0-SNAPSHOT", "jar" );
89 private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
90 String artifactInfoArtifactId, String artifactInfoVersion,
91 String artifactInfoPackaging )
93 clickLinkWithText( version );
94 assertPage( "Apache Archiva \\ Browse Repository" );
95 assertTextPresent( artifactInfoRepositoryId );
96 assertTextPresent( artifactInfoGroupId );
97 assertTextPresent( artifactInfoArtifactId );
98 assertTextPresent( artifactInfoVersion );
99 assertTextPresent( artifactInfoPackaging );
102 private void assertArtifactsPage( String artifactId )
104 clickLinkWithText( artifactId );
105 assertPage( "Apache Archiva \\ Browse Repository" );
106 assertTextPresent( "Versions" );
109 private void assertGroupsPage( String groupId )
111 clickLinkWithText( groupId );
112 assertPage( "Apache Archiva \\ Browse Repository" );
113 assertTextPresent( "Artifacts" );