1 package org.apache.maven.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
22 import org.apache.maven.shared.web.test.AbstractSeleniumTestCase;
26 public abstract class AbstractArchivaTestCase
27 extends AbstractSeleniumTestCase
29 private String baseUrl = "http://localhost:9696/archiva";
31 protected String getApplicationName()
36 protected String getInceptionYear()
41 protected void postAdminUserCreation()
43 if ( getTitle().equals( getTitlePrefix() + "Configuration" ) )
45 //Add Managed Repository
46 setFieldValue( "id", "test-repository" );
47 setFieldValue( "urlName", "test-repository" );
48 setFieldValue( "name", "Web UI Test Managed Repository" );
49 setFieldValue( "directory", getBasedir() + "/target/repository" );
50 clickButtonWithValue( "Add Repository" );
53 assertPage( "Configuration" );
54 setFieldValue( "indexPath", getBasedir() + "/target/index" );
55 clickButtonWithValue( "Save Configuration" );
56 assertPage( "Administration" );
60 public void assertHeader()
62 assertTrue( "banner is missing", getSelenium().isElementPresent( "xpath=//div[@id='banner']" ) );
63 assertTrue( "bannerLeft is missing",
64 getSelenium().isElementPresent( "xpath=//div[@id='banner']" + "/span[@id='bannerLeft']" ) );
65 assertTrue( "bannerLeft link is missing", getSelenium().isElementPresent(
66 "xpath=//div[@id='banner']" + "/span[@id='bannerLeft']/a[@href='http://maven.apache.org/archiva/']" ) );
67 assertTrue( "bannerLeft img is missing", getSelenium().isElementPresent( "xpath=//div[@id='banner']" +
68 "/span[@id='bannerLeft']/a[@href='http://maven.apache.org/archiva/']" + "/img[@src='" + getWebContext() +
69 "/images/archiva.png']" ) );
71 assertTrue( "bannerRight is missing",
72 getSelenium().isElementPresent( "xpath=//div[@id='banner']/span[@id='bannerRight']" ) );
75 protected String getTitlePrefix()
77 return "Maven Archiva :: ";
80 public String getBaseUrl()
85 protected String getWebContext()