Author: olamy
Date: Tue Dec 25 23:12:59 2012
New Revision: 1425783
URL: http://svn.apache.org/viewvc?rev=1425783&view=rev
Log:
test web tests via fluentlenium
Added:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
(with props)
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
URL:
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml?rev=1425783&r1=1425782&r2=1425783&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
Tue Dec 25 23:12:59 2012
@@ -61,6 +61,11 @@
</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>
<scope>test</scope>
@@ -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>
Added:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
URL:
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/WebDriverTest.java?rev=1425783&view=auto
==============================================================================
---
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
(added)
+++
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
Tue Dec 25 23:12:59 2012
@@ -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();
+ }
+}
Propchange:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision