mirror of https://github.com/apache/archiva.git
test web tests via fluentlenium
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1425783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9afc69977b
commit
5440040c8f
|
@ -60,6 +60,11 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>${selenium-server.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
|
||||
<artifactId>selenium-java-client-driver</artifactId>
|
||||
|
@ -72,6 +77,20 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.fluentlenium</groupId>
|
||||
<artifactId>fluentlenium-festassert</artifactId>
|
||||
<version>0.7.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.fluentlenium</groupId>
|
||||
<artifactId>fluentlenium-core</artifactId>
|
||||
<version>0.7.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Dependency for MavenConnectionTest -->
|
||||
<dependency>
|
||||
<groupId>jdom</groupId>
|
||||
|
@ -188,11 +207,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<verbose>true</verbose>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package org.apache.archiva.web.test;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.fluentlenium.adapter.FluentTest;
|
||||
import org.fluentlenium.core.domain.FluentList;
|
||||
import org.fluentlenium.core.domain.FluentWebElement;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
*/
|
||||
public class WebDriverTest
|
||||
extends FluentTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void simpletest()
|
||||
throws Exception
|
||||
{
|
||||
|
||||
Properties tomcatPortProperties = new Properties();
|
||||
tomcatPortProperties.load(
|
||||
new FileInputStream( new File( System.getProperty( "tomcat.propertiesPortFilePath" ) ) ) );
|
||||
|
||||
int tomcatPort = Integer.parseInt( tomcatPortProperties.getProperty( "tomcat.maven.http.port" ) );
|
||||
|
||||
goTo( "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en" );
|
||||
|
||||
FluentList<FluentWebElement> elements = find( "#create-admin-link-a" );
|
||||
|
||||
if ( !elements.isEmpty() && elements.get( 0 ).isDisplayed() )
|
||||
{
|
||||
WebElement webElement = elements.get( 0 ).getElement();
|
||||
Assert.assertEquals( "Create Admin User", webElement.getText() );
|
||||
}
|
||||
else
|
||||
{
|
||||
elements = find( "#login-link-a" );
|
||||
WebElement webElement = elements.get( 0 ).getElement();
|
||||
Assert.assertEquals( "LOGIN", webElement.getText() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebDriver getDefaultDriver()
|
||||
{
|
||||
return new FirefoxDriver();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue