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;
25 * @author Edwin Punzalan
27 public abstract class AbstractArchivaTestCase
28 extends AbstractSeleniumTestCase
30 private String baseUrl = "http://localhost:9696/archiva";
32 protected String getApplicationName()
37 protected String getInceptionYear()
42 protected void postAdminUserCreation()
44 if ( getTitle().equals( getTitlePrefix() + "Configuration" ) )
46 //Add Managed Repository
47 setFieldValue( "id", "web-ui" );
48 setFieldValue( "urlName", "web-ui" );
49 setFieldValue( "name", "Web UI Test Managed Repository" );
50 setFieldValue( "directory", getBasedir() + "target/web-ui-dir" );
51 clickButtonWithValue( "Add Repository" );
54 assertPage( "Configuration" );
55 setFieldValue( "indexPath", getBasedir() + "target/web-ui-index" );
56 clickButtonWithValue( "Save Configuration" );
57 assertPage( "Administration" );
61 public void assertHeader()
63 assertTrue( "banner is missing" , getSelenium().isElementPresent( "xpath=//div[@id='banner']" ) );
64 assertTrue( "bannerLeft is missing" , getSelenium().isElementPresent( "xpath=//div[@id='banner']" +
65 "/span[@id='bannerLeft']" ) );
66 assertTrue( "bannerLeft link is missing" , getSelenium().isElementPresent( "xpath=//div[@id='banner']" +
67 "/span[@id='bannerLeft']/a[@href='http://maven.apache.org/archiva/']" ) );
68 assertTrue( "bannerLeft img is missing" , getSelenium().isElementPresent( "xpath=//div[@id='banner']" +
69 "/span[@id='bannerLeft']/a[@href='http://maven.apache.org/archiva/']" +
70 "/img[@src='" + getWebContext() + "/images/archiva.png']" ) );
72 assertTrue( "bannerRight is missing", 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()