You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ma...@apache.org on 2017/06/08 05:02:54 UTC

[1/4] archiva git commit: Migrating selenium tests

Repository: archiva
Updated Branches:
  refs/heads/master 878287b7b -> 7b8d3bb38


Migrating selenium tests


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/0bbedd72
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/0bbedd72
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/0bbedd72

Branch: refs/heads/master
Commit: 0bbedd7201a85118c52cc0d5bca7d3804bfcf5c2
Parents: 878287b
Author: Martin Stockhammer <ma...@apache.org>
Authored: Sun Jun 4 18:20:40 2017 +0200
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Sun Jun 4 18:20:40 2017 +0200

----------------------------------------------------------------------
 .../archiva-web/archiva-webapp-test/pom.xml     | 152 +++++++++++--------
 .../archiva/web/test/WebDriverBrowseTest.java   |  90 ++++-------
 .../apache/archiva/web/test/WebDriverTest.java  |  67 +++-----
 .../web/test/parent/AbstractSeleniumTest.java   |  30 +++-
 .../web/test/tools/WebdriverInitializer.java    | 118 ++++++++++++++
 .../src/test/resources/jetty/jetty-env.xml      |  48 ++++++
 .../src/test/resources/log4j2-test.xml          |   3 +
 .../archiva-web/archiva-webapp/pom.xml          |  12 ++
 .../archiva-webapp/src/test/jetty/jetty-env.xml |  30 ++++
 pom.xml                                         |   2 +-
 10 files changed, 374 insertions(+), 178 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
index 1ba04f1..ad2b77f 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
@@ -35,9 +35,9 @@
     <tomcat.propertiesPortFilePath>${project.build.directory}/tomcat-port.properties</tomcat.propertiesPortFilePath>
     <maxWaitTimeInMs>10000</maxWaitTimeInMs>
 
-    <seleniumPluginVersion>2.3</seleniumPluginVersion>
-    <selenium-server.version>2.53.1</selenium-server.version>
-    <fluentlenium.version>0.10.2</fluentlenium.version>
+    <selenium-server.version>3.4.0</selenium-server.version>
+    <fluentlenium.version>3.2.0</fluentlenium.version>
+    <fluentlenium.festassert.version>0.13.2</fluentlenium.festassert.version>
 
     <browserPath></browserPath>
   </properties>
@@ -70,7 +70,18 @@
     <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>selenium-java</artifactId>
+      <scope>test</scope>
       <version>${selenium-server.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>javax.servlet-api</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.seleniumhq.selenium.client-drivers</groupId>
@@ -81,12 +92,43 @@
           <groupId>commons-logging</groupId>
           <artifactId>commons-logging</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>javax.servlet-api</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>selenium-remote-driver</artifactId>
+      <scope>test</scope>
+      <version>${selenium-server.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>javax.servlet-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.seleniumhq.selenium</groupId>
+      <artifactId>selenium-leg-rc</artifactId>
+      <scope>test</scope>
       <version>${selenium-server.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.testng</groupId>
+          <artifactId>testng</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>javax.servlet-api</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
@@ -96,29 +138,52 @@
     <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>htmlunit-driver</artifactId>
-      <version>2.24</version>
+      <version>2.26</version>
     </dependency>
 
+    <dependency>
+      <groupId>org.seleniumhq.selenium</groupId>
+      <artifactId>selenium-server</artifactId>
+      <scope>test</scope>
+      <version>${selenium-server.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>javax.servlet-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
 
     <dependency>
       <groupId>org.fluentlenium</groupId>
-      <artifactId>fluentlenium-festassert</artifactId>
+      <artifactId>fluentlenium-core</artifactId>
       <version>${fluentlenium.version}</version>
       <scope>test</scope>
     </dependency>
 
     <dependency>
-      <groupId>xerces</groupId>
-      <artifactId>xercesImpl</artifactId>
+      <groupId>org.fluentlenium</groupId>
+      <artifactId>fluentlenium-festassert</artifactId>
+      <version>${fluentlenium.festassert.version}</version>
+      <scope>test</scope>
     </dependency>
 
     <dependency>
       <groupId>org.fluentlenium</groupId>
-      <artifactId>fluentlenium-core</artifactId>
+      <artifactId>fluentlenium-junit</artifactId>
       <version>${fluentlenium.version}</version>
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+    </dependency>
+
     <!-- Dependency for MavenConnectionTest -->
     <dependency>
       <groupId>jdom</groupId>
@@ -183,37 +248,6 @@
     <pluginManagement>
       <plugins>
         <plugin>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>selenium-maven-plugin</artifactId>
-          <dependencies>
-            <dependency>
-              <groupId>org.seleniumhq.selenium</groupId>
-              <artifactId>selenium-server</artifactId>
-              <version>${selenium-server.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.seleniumhq.selenium</groupId>
-              <artifactId>selenium-remote-driver</artifactId>
-              <version>${selenium-server.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.seleniumhq.selenium</groupId>
-              <artifactId>selenium-api</artifactId>
-              <version>${selenium-server.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.apache.commons</groupId>
-              <artifactId>commons-exec</artifactId>
-              <version>1.3</version>
-            </dependency>
-            <dependency>
-              <groupId>org.seleniumhq.selenium</groupId>
-              <artifactId>htmlunit-driver</artifactId>
-              <version>2.24</version>
-            </dependency>  
-          </dependencies>
-        </plugin>
-        <plugin>
           <groupId>org.apache.rat</groupId>
           <artifactId>apache-rat-plugin</artifactId>
           <configuration>
@@ -274,6 +308,7 @@
                 <maxWaitTimeInMs>${maxWaitTimeInMs}</maxWaitTimeInMs>
                 <seleniumHost>${seleniumHost}</seleniumHost>
                 <seleniumPort>${seleniumPort}</seleniumPort>
+                <seleniumRemote>${seleniumRemote}</seleniumRemote>
                 <tomcat.propertiesPortFilePath>${tomcat.propertiesPortFilePath}</tomcat.propertiesPortFilePath>
               </systemPropertyVariables>
             </configuration>
@@ -439,39 +474,30 @@
         </property>
       </activation>
       <properties>
-        <seleniumHost>localhost</seleniumHost>
-        <seleniumPort>4444</seleniumPort>
+        <seleniumRemote>false</seleniumRemote>
       </properties>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>selenium-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <phase>pre-integration-test</phase>
-                <goals>
-                  <goal>start-server</goal>
-                </goals>
-                <configuration>
-                  <background>true</background>
-                  <port>${seleniumPort}</port>
-                  <logOutput>true</logOutput>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
     </profile>
     <profile>
-      <id>firefox</id>
+      <id>htmlunit</id>
       <activation>
         <property>
           <name>!browser</name>
         </property>
       </activation>
       <properties>
+        <selenium.browser>*htmlunit</selenium.browser>
+        <excluded.groups/>
+      </properties>
+    </profile>
+    <profile>
+      <id>firefox</id>
+      <activation>
+        <property>
+          <name>browser</name>
+          <value>firefox</value>
+        </property>
+      </activation>
+      <properties>
         <selenium.browser>*firefox</selenium.browser>
         <excluded.groups/>
       </properties>

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
index 4ed311d..7f83b34 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
@@ -19,31 +19,25 @@ package org.apache.archiva.web.test;
  */
 
 import junit.framework.Assert;
+import org.apache.archiva.web.test.tools.WebdriverInitializer;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.fluentlenium.adapter.FluentTest;
+import org.fluentlenium.adapter.junit.FluentTest;
 import org.fluentlenium.core.domain.FluentList;
 import org.fluentlenium.core.domain.FluentWebElement;
-import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Before;
 import org.junit.Test;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.ie.InternetExplorerDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.remote.RemoteWebDriver;
-import org.openqa.selenium.safari.SafariDriver;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
+
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
-import org.apache.commons.io.FileUtils;
-import org.fluentlenium.core.Fluent;
-import org.junit.Before;
+
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author Olivier Lamy
@@ -53,7 +47,7 @@ public class WebDriverBrowseTest
 {
 
     @Override
-    public Fluent takeScreenShot( String fileName )
+    public void takeScreenShot( String fileName )
     {
         File fileNameHTML = new File( "target", "errorshtmlsnap" );
         try
@@ -67,14 +61,17 @@ public class WebDriverBrowseTest
         {
             e.printStackTrace();
         }
-        return super.takeScreenShot( fileNameHTML.getAbsolutePath() );
+        super.takeScreenShot( fileNameHTML.getAbsolutePath() );
 
     }
 
     @Before
     public void init()
     {
-        setSnapshotMode( Mode.TAKE_SNAPSHOT_ON_FAIL );
+
+        setScreenshotMode( TriggerMode.AUTOMATIC_ON_FAIL);
+        setDriverLifecycle( DriverLifecycle.CLASS );
+
     }
 
     @Test
@@ -93,34 +90,34 @@ public class WebDriverBrowseTest
         goTo( "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en" );
 
         // wait until topbar-menu-container is feeded
-        await().atMost( 5, TimeUnit.SECONDS ).until( "#topbar-menu" ).isPresent();
+        await().atMost( 5, TimeUnit.SECONDS ).until( $("#topbar-menu" )).present();
 
         FluentList<FluentWebElement> elements = find( "#create-admin-link-a" );
 
-        if ( !elements.isEmpty() && elements.get( 0 ).isDisplayed() )
+        if ( !elements.isEmpty() && elements.get( 0 ).displayed() )
         {
             WebElement webElement = elements.get( 0 ).getElement();
             Assert.assertEquals( "Create Admin User", webElement.getText() );
 
             webElement.click();
-            await().atMost( 2, TimeUnit.SECONDS ).until( "#user-create" ).isPresent();
-            assertThat( find( "#username" ).getValue().equals( "admin" ) );
-            assertThat( find( "#password" ).getValue().isEmpty() );
-            assertThat( find( "#confirmPassword" ).getValue().isEmpty() );
-            assertThat( find( "#email" ).getValue().isEmpty() );
-
-            fill( "#fullname" ).with( p.getProperty( "ADMIN_FULLNAME" ) );
-            fill( "#email" ).with( p.getProperty( "ADMIN_EMAIL" ) );
-            fill( "#password" ).with( p.getProperty( "ADMIN_PASSWORD" ) );
-            fill( "#confirmPassword" ).with( p.getProperty( "ADMIN_PASSWORD" ) );
+            await().atMost( 2, TimeUnit.SECONDS ).until($( "#user-create" )).present();
+            assertThat( find( "#username" ).value().equals( "admin" ) );
+            assertThat( find( "#password" ).value().isEmpty() );
+            assertThat( find( "#confirmPassword" ).value().isEmpty() );
+            assertThat( find( "#email" ).value().isEmpty() );
+
+            $("#fullname").fill().with( p.getProperty( "ADMIN_FULLNAME" ) );
+            $("#email").fill().with( p.getProperty( "ADMIN_EMAIL" ) );
+            $("#password").fill().with( p.getProperty( "ADMIN_PASSWORD" ) );
+            $("#confirmPassword").fill().with( p.getProperty( "ADMIN_PASSWORD" ) );
             find( "#user-create-form-register-button" ).click();
 
-            await().atMost( 2, TimeUnit.SECONDS ).until( "#logout-link" ).isPresent();
+            await().atMost( 2, TimeUnit.SECONDS ).until($("#logout-link" )).present();
 
             FluentList<FluentWebElement> elementss = find( "#menu-find-browse-a" );
             WebElement webElsement = elementss.get( 0 ).getElement();
             webElsement.click();
-            await().atMost( 2, TimeUnit.SECONDS ).until( "#main_browse_result" ).isPresent();
+            await().atMost( 2, TimeUnit.SECONDS ).until($("#main_browse_result" )).present();
             // give me search page :( not  browse page
 
             takeScreenShot( "search.png" );
@@ -140,36 +137,7 @@ public class WebDriverBrowseTest
     }
 
     @Override
-    public WebDriver getDefaultDriver() {
-        String seleniumBrowser = System.getProperty("selenium.browser");
-        String seleniumHost = System.getProperty("seleniumHost", "localhost");
-        int seleniumPort = Integer.getInteger("seleniumPort", 4444);
-        try {
-
-            if (StringUtils.contains(seleniumBrowser, "chrome")) {
-                return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                        DesiredCapabilities.chrome()
-                );
-            }
-
-            if (StringUtils.contains(seleniumBrowser, "safari")) {
-                return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                        DesiredCapabilities.safari()
-                );
-            }
-
-            if (StringUtils.contains(seleniumBrowser, "iexplore")) {
-                return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                        DesiredCapabilities.internetExplorer()
-                );
-            }
-
-            return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                    DesiredCapabilities.firefox()
-            );
-        } catch (MalformedURLException e) {
-            throw new RuntimeException("Initializion of remote driver failed");
-        }
-
+    public WebDriver newWebDriver() {
+        return WebdriverInitializer.newWebDriver();
     }
 }

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
index deec6c0..5a020e2 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
@@ -19,10 +19,13 @@ package org.apache.archiva.web.test;
  */
 
 import junit.framework.Assert;
+import org.apache.archiva.web.test.tools.WebdriverInitializer;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.fluentlenium.adapter.FluentTest;
+import org.fluentlenium.adapter.junit.FluentTest;
 import org.fluentlenium.core.domain.FluentList;
 import org.fluentlenium.core.domain.FluentWebElement;
+import org.junit.Before;
 import org.junit.Test;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
@@ -38,21 +41,21 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.file.Paths;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.io.FileUtils;
-import org.fluentlenium.core.Fluent;
-import org.junit.Before;
-
 /**
  * @author Olivier Lamy
  */
 public class WebDriverTest
-        extends FluentTest {
+        extends FluentTest
+{
+
+
 
     @Override
-    public Fluent takeScreenShot(String fileName) {
+    public void takeScreenShot(String fileName) {
         try {
             // save html to have a minimum feedback if jenkins firefox not up
             File fileNameHTML = new File(fileName + ".html");
@@ -61,13 +64,15 @@ public class WebDriverTest
             System.out.print(e.getMessage());
             e.printStackTrace();
         }
-        return super.takeScreenShot(fileName);
+        super.takeScreenShot(fileName);
     }
 
+
     @Before
     public void init() {
-        setSnapshotMode(Mode.TAKE_SNAPSHOT_ON_FAIL);
-        setSnapshotPath(new File("target", "errorshtmlsnap").getAbsolutePath());
+        setScreenshotMode(TriggerMode.AUTOMATIC_ON_FAIL);
+        setScreenshotPath( Paths.get("target", "errorshtmlsnap").toAbsolutePath().toString());
+        setDriverLifecycle( DriverLifecycle.CLASS );
     }
 
     @Test
@@ -79,15 +84,16 @@ public class WebDriverTest
                 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");
+        String url = "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en";
+        System.err.println("URL: "+url);
+        goTo(url);
 
         // wait until topbar-menu-container is feeded
-        await().atMost(5, TimeUnit.SECONDS).until("#topbar-menu").isPresent();
+        await().atMost(10, TimeUnit.SECONDS).until($("#topbar-menu")).present();
 
         FluentList<FluentWebElement> elements = find("#create-admin-link-a");
 
-        if (!elements.isEmpty() && elements.get(0).isDisplayed()) {
+        if (!elements.isEmpty() && elements.get(0).displayed()) {
             WebElement webElement = elements.get(0).getElement();
             Assert.assertEquals("Create Admin User", webElement.getText());
         } else {
@@ -99,36 +105,7 @@ public class WebDriverTest
     }
 
     @Override
-    public WebDriver getDefaultDriver() {
-        String seleniumBrowser = System.getProperty("selenium.browser");
-        String seleniumHost = System.getProperty("seleniumHost", "localhost");
-        int seleniumPort = Integer.getInteger("seleniumPort", 4444);
-        try {
-
-            if (StringUtils.contains(seleniumBrowser, "chrome")) {
-                return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                        DesiredCapabilities.chrome()
-                );
-            }
-
-            if (StringUtils.contains(seleniumBrowser, "safari")) {
-                return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                        DesiredCapabilities.safari()
-                );
-            }
-
-            if (StringUtils.contains(seleniumBrowser, "iexplore")) {
-                return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                        DesiredCapabilities.internetExplorer()
-                );
-            }
-
-            return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
-                    DesiredCapabilities.firefox()
-            );
-        } catch (MalformedURLException e) {
-            throw new RuntimeException("Initializion of remote driver failed");
-        }
-
+    public WebDriver newWebDriver() {
+        return WebdriverInitializer.newWebDriver();
     }
 }

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
index 3a886c7..a8403cd 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
@@ -21,7 +21,10 @@ package org.apache.archiva.web.test.parent;
 
 import com.thoughtworks.selenium.DefaultSelenium;
 import com.thoughtworks.selenium.Selenium;
+import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
 import org.apache.archiva.web.test.tools.ArchivaSeleniumExecutionRule;
+import org.apache.archiva.web.test.tools.WebdriverInitializer;
+import org.apache.xpath.operations.Bool;
 import org.junit.Assert;
 import org.junit.Rule;
 
@@ -37,6 +40,9 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import org.apache.commons.io.FileUtils;
+import org.openqa.selenium.WebDriver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -45,6 +51,7 @@ import org.apache.commons.io.FileUtils;
 
 public abstract class AbstractSeleniumTest
 {
+    private final Logger logger = LoggerFactory.getLogger( getClass() );
 
     @Rule
     public ArchivaSeleniumExecutionRule archivaSeleniumExecutionRule = new ArchivaSeleniumExecutionRule();
@@ -60,6 +67,8 @@ public abstract class AbstractSeleniumTest
 
     public int seleniumPort = Integer.getInteger( "seleniumPort", 4444 );
 
+    public boolean remoteSelenium = Boolean.parseBoolean( System.getProperty( "remoteSelenium", "false" ) );
+
     private Selenium selenium = null;
 
     public Properties p;
@@ -83,7 +92,7 @@ public abstract class AbstractSeleniumTest
 
         baseUrl = "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en";
 
-        open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs );
+        open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs, remoteSelenium );
         archivaSeleniumExecutionRule.selenium = selenium;
         assertAdminCreated();
     }
@@ -102,14 +111,15 @@ public abstract class AbstractSeleniumTest
     /**
      * Initialize selenium
      */
-    public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort, int maxWaitTimeInMs )
+    public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort, int maxWaitTimeInMs, boolean remoteSelenium)
         throws Exception
     {
         try
         {
             if ( getSelenium() == null )
             {
-                selenium = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl );
+                WebDriver driver = WebdriverInitializer.newWebDriver(browser, seleniumHost, seleniumPort, remoteSelenium);
+                selenium = new WebDriverBackedSelenium(driver, baseUrl);
                 selenium.start();
                 selenium.setTimeout( Integer.toString( maxWaitTimeInMs ) );
             }
@@ -125,15 +135,15 @@ public abstract class AbstractSeleniumTest
     public void assertAdminCreated()
         throws Exception
     {
-        initializeArchiva( baseUrl, browser, maxWaitTimeInMs, seleniumHost, seleniumPort );
+        initializeArchiva( baseUrl, browser, maxWaitTimeInMs, seleniumHost, seleniumPort, remoteSelenium );
     }
 
     public void initializeArchiva( String baseUrl, String browser, int maxWaitTimeInMs, String seleniumHost,
-                                   int seleniumPort )
+                                   int seleniumPort, boolean remoteSelenium)
         throws Exception
     {
 
-        open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs );
+        open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs, remoteSelenium);
 
         getSelenium().open( baseUrl );
 
@@ -701,8 +711,12 @@ public abstract class AbstractSeleniumTest
         
         File fileName = new File( targetPath, fileBaseName + ".png" );
 
-        selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
-        
+        try
+        {
+            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
+        } catch (UnsupportedOperationException ex) {
+            logger.warn("Could not create screenshot. Not supported by this webdriver. "+selenium.getClass().getName());
+        }
         return fileName.getAbsolutePath();
     }
 

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java
new file mode 100644
index 0000000..c3ddc1a
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java
@@ -0,0 +1,118 @@
+package org.apache.archiva.web.test.tools;
+/*
+ * 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 org.apache.commons.lang3.StringUtils;
+import org.openqa.selenium.Capabilities;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+import org.openqa.selenium.ie.InternetExplorerDriver;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.safari.SafariDriver;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Created by martin_s on 04.06.17.
+ */
+public class WebdriverInitializer
+{
+
+    public static WebDriver newWebDriver() {
+        String seleniumBrowser = System.getProperty("selenium.browser");
+        String seleniumHost = System.getProperty("seleniumHost", "localhost");
+        int seleniumPort = Integer.getInteger("seleniumPort", 4444);
+        boolean seleniumRemote = Boolean.parseBoolean(System.getProperty("seleniumRemote","false"));
+        return newWebDriver(seleniumBrowser,seleniumHost, seleniumPort,seleniumRemote);
+    }
+
+    public static WebDriver newWebDriver(String seleniumBrowser, String seleniumHost, int seleniumPort, boolean seleniumRemote) {
+        try {
+
+            if ( StringUtils.contains(seleniumBrowser, "chrome")) {
+                if (seleniumRemote)
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.chrome()
+                    );
+                } else {
+                    return new ChromeDriver(  );
+                }
+            }
+
+            if (StringUtils.contains(seleniumBrowser, "safari")) {
+                if (seleniumRemote)
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.safari()
+                    );
+                } else {
+                    return new SafariDriver();
+                }
+            }
+
+            if (StringUtils.contains(seleniumBrowser, "iexplore")) {
+                if (seleniumRemote)
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.internetExplorer()
+                    );
+                } else {
+                    new InternetExplorerDriver(  );
+                }
+            }
+
+            if (StringUtils.contains( seleniumBrowser, "firefox" ))
+            {
+                if ( seleniumRemote )
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.firefox()
+                    );
+                }
+                else
+                {
+                    return new FirefoxDriver();
+                }
+            }
+
+            if ( seleniumRemote )
+            {
+                return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                    DesiredCapabilities.htmlUnit()
+                );
+            }
+            else
+            {
+                DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
+                capabilities.setJavascriptEnabled( true );
+                capabilities.setVersion( "firefox-51" );
+                return new HtmlUnitDriver( capabilities  );
+            }
+
+        } catch (MalformedURLException e) {
+            throw new RuntimeException("Initializion of remote driver failed");
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/jetty/jetty-env.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/jetty/jetty-env.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/jetty/jetty-env.xml
new file mode 100644
index 0000000..bed63bf
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/jetty/jetty-env.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"  encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
+  <New id="derbyDs" class="org.eclipse.jetty.plus.jndi.Resource">
+    <Arg></Arg>
+    <Arg>jdbc/users</Arg>
+    <Arg>
+      <New class="org.apache.derby.jdbc.EmbeddedDataSource">
+        <Set name="databaseName">database/users;create=true</Set>
+        <Set name="user">sa</Set>
+        <Set name="password"></Set>
+      </New>
+    </Arg>
+  </New>
+
+
+  <New id="mail" class="org.eclipse.jetty.plus.jndi.Resource">
+    <Arg>mail/Session</Arg>
+    <Arg>
+      <New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
+        <Set name="properties">
+          <New class="java.util.Properties">
+            <Put name="mail.smtp.host">localhost</Put>
+          </New>
+        </Set>
+      </New>
+    </Arg>
+  </New>
+</Configure>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
index 9294964..dec6d75 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
@@ -28,6 +28,9 @@
   <loggers>
 
     <logger name="org.springframework" level="error"/>
+    <logger name="com.gargoylesoftware.htmlunit.DefaultCssErrorHandler" level="error" />
+    <logger name="com.gargoylesoftware.htmlunit.html.HtmlScript" level="error" />
+    <logger name="org.apache.http.wire" level="debug" />
 
     <root level="info">
       <appender-ref ref="console"/>

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml
index 6d101a4..b88e7ba 100644
--- a/archiva-modules/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml
@@ -717,6 +717,12 @@
     <dependency>
       <groupId>org.apache.archiva.redback</groupId>
       <artifactId>redback-rest-services</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>javax.servlet-api</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva.redback</groupId>
@@ -801,6 +807,12 @@
       <artifactId>redback-rest-services</artifactId>
       <classifier>tests</classifier>
       <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.servlet</groupId>
+          <artifactId>javax.servlet-api</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml
new file mode 100644
index 0000000..1668649
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"  encoding="UTF-8"?>
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
+  <New id="derbyDs" class="org.eclipse.jetty.plus.jndi.Resource">
+    <Arg></Arg>
+    <Arg>jdbc/users</Arg>
+    <Arg>
+      <New class="org.apache.derby.jdbc.EmbeddedDataSource">
+        <Set name="databaseName">database/users;create=true</Set>
+        <Set name="user">sa</Set>
+        <Set name="password"></Set>
+      </New>
+    </Arg>
+  </New>
+
+
+  <New id="mail" class="org.eclipse.jetty.plus.jndi.Resource">
+    <Arg>mail/Session</Arg>
+    <Arg>
+      <New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
+        <Set name="properties">
+          <New class="java.util.Properties">
+            <Put name="mail.smtp.host">localhost</Put>
+          </New>
+        </Set>
+      </New>
+    </Arg>
+  </New>
+</Configure>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/archiva/blob/0bbedd72/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f4f80dd..8b1bad4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
     <httpclient.core.version>4.4.4</httpclient.core.version>
     <javaxMailVersion>1.4</javaxMailVersion>
     <jettyVersion>9.4.5.v20170502</jettyVersion>
-    <guava.version>16.0.1</guava.version>
+    <guava.version>22.0</guava.version>
     <openjpaVersion>2.4.1</openjpaVersion>
 
     <!-- restore when we will be able to use a derby in memory database -->


[2/4] archiva git commit: Updating tests for WebDriver and jetty backend

Posted by ma...@apache.org.
Updating tests for WebDriver and jetty backend


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/69c6b594
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/69c6b594
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/69c6b594

Branch: refs/heads/master
Commit: 69c6b594b1bc761527157b3a8970d6e64e582ea9
Parents: 0bbedd7
Author: Martin Stockhammer <ma...@apache.org>
Authored: Mon Jun 5 22:31:48 2017 +0200
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Mon Jun 5 22:31:48 2017 +0200

----------------------------------------------------------------------
 .../archiva-web/archiva-webapp-test/pom.xml     | 267 +++++++++++++++----
 .../archiva/web/test/WebDriverBrowseTest.java   |  72 +++--
 .../apache/archiva/web/test/WebDriverTest.java  |  52 ++--
 .../web/test/parent/AbstractSeleniumTest.java   |  18 +-
 .../web/test/tools/WebdriverInitializer.java    | 118 --------
 .../web/test/tools/WebdriverUtility.java        | 204 ++++++++++++++
 .../src/test/resources/log4j.xml                |  41 ---
 .../src/test/resources/log4j2-test.xml          |   3 +-
 .../src/test/resources/logging/log4j.xml        |  70 -----
 .../src/test/resources/logging/log4j2-test.xml  |   4 +-
 10 files changed, 473 insertions(+), 376 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
index ad2b77f..db11a19 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
@@ -30,14 +30,14 @@
   <name>Archiva Web :: Javascript Application Tests</name>
 
   <properties>
-    <webappDirectory>${project.build.directory}/tomcat7x/webapps/archiva</webappDirectory>
-    <container.test.port>0</container.test.port>
-    <tomcat.propertiesPortFilePath>${project.build.directory}/tomcat-port.properties</tomcat.propertiesPortFilePath>
+    <webappDirectory>${project.build.directory}/container/webapps/archiva</webappDirectory>
+    <container.propertiesPortFilePath>${project.build.directory}/container-port.properties</container.propertiesPortFilePath>
     <maxWaitTimeInMs>10000</maxWaitTimeInMs>
-
     <selenium-server.version>3.4.0</selenium-server.version>
     <fluentlenium.version>3.2.0</fluentlenium.version>
     <fluentlenium.festassert.version>0.13.2</fluentlenium.festassert.version>
+    <seleniumHost></seleniumHost>
+    <seleniumPort></seleniumPort>
 
     <browserPath></browserPath>
   </properties>
@@ -67,6 +67,8 @@
         </exclusion>
       </exclusions>
     </dependency>
+
+    <!-- Selenium dependencies -->
     <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>selenium-java</artifactId>
@@ -81,39 +83,29 @@
           <groupId>javax.servlet</groupId>
           <artifactId>javax.servlet-api</artifactId>
         </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.seleniumhq.selenium.client-drivers</groupId>
-      <artifactId>selenium-java-client-driver</artifactId>
-      <scope>test</scope>
-      <exclusions>
         <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-io</artifactId>
         </exclusion>
         <exclusion>
-          <groupId>javax.servlet</groupId>
-          <artifactId>javax.servlet-api</artifactId>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-client</artifactId>
         </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.seleniumhq.selenium</groupId>
-      <artifactId>selenium-remote-driver</artifactId>
-      <scope>test</scope>
-      <version>${selenium-server.version}</version>
-      <exclusions>
         <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-util</artifactId>
         </exclusion>
         <exclusion>
-          <groupId>javax.servlet</groupId>
-          <artifactId>javax.servlet-api</artifactId>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-common</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
+
     <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>selenium-leg-rc</artifactId>
@@ -125,21 +117,37 @@
           <artifactId>testng</artifactId>
         </exclusion>
         <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
           <groupId>javax.servlet</groupId>
           <artifactId>javax.servlet-api</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-io</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-client</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-util</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-common</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-exec</artifactId>
-      <version>1.3</version>
-    </dependency>
-    <dependency>
-      <groupId>org.seleniumhq.selenium</groupId>
-      <artifactId>htmlunit-driver</artifactId>
-      <version>2.26</version>
-    </dependency>
+
+
 
     <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
@@ -155,6 +163,26 @@
           <groupId>javax.servlet</groupId>
           <artifactId>javax.servlet-api</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-io</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-util</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-client</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty.websocket</groupId>
+          <artifactId>websocket-common</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
 
@@ -179,6 +207,8 @@
       <scope>test</scope>
     </dependency>
 
+    <!-- End of Selenium dependencies -->
+
     <dependency>
       <groupId>xerces</groupId>
       <artifactId>xercesImpl</artifactId>
@@ -233,9 +263,36 @@
       <artifactId>log4j-1.2-api</artifactId>
     </dependency>
 
+
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-io</artifactId>
+      <version>${jettyVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>${jettyVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty.websocket</groupId>
+      <artifactId>websocket-api</artifactId>
+      <version>${jettyVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty.websocket</groupId>
+      <artifactId>websocket-client</artifactId>
+      <version>${jettyVersion}</version>
+      <scope>test</scope>
+    </dependency>
+
+
   </dependencies>
 
   <build>
+
     <testResources>
       <testResource>
         <directory>src/test/resources</directory>
@@ -264,6 +321,27 @@
       </plugins>
     </pluginManagement>
     <plugins>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <configuration>
+          <portNames>
+            <portName>container.http.port</portName>
+            <portName>container.stop.port</portName>
+          </portNames>
+        </configuration>
+        <executions>
+          <execution>
+            <id>reserve-port</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>reserve-network-port</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
       <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <executions>
@@ -288,17 +366,19 @@
 
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
+        <artifactId>maven-failsafe-plugin</artifactId>
         <configuration>
           <redirectTestOutputToFile>false</redirectTestOutputToFile>
           <runOrder>alphabetical</runOrder>
+          <includes>
+            <include>**/*Test.java</include>
+          </includes>
         </configuration>
         <executions>
           <execution>
             <id>integration-tests</id>
-            <phase>integration-test</phase>
             <goals>
-              <goal>test</goal>
+              <goal>integration-test</goal>
             </goals>
             <configuration>
               <systemPropertyVariables>
@@ -308,11 +388,19 @@
                 <maxWaitTimeInMs>${maxWaitTimeInMs}</maxWaitTimeInMs>
                 <seleniumHost>${seleniumHost}</seleniumHost>
                 <seleniumPort>${seleniumPort}</seleniumPort>
-                <seleniumRemote>${seleniumRemote}</seleniumRemote>
-                <tomcat.propertiesPortFilePath>${tomcat.propertiesPortFilePath}</tomcat.propertiesPortFilePath>
+                <container.propertiesPortFilePath>${container.propertiesPortFilePath}</container.propertiesPortFilePath>
+                <container.http.port>${container.http.port}</container.http.port>
               </systemPropertyVariables>
             </configuration>
+
           </execution>
+          <execution>
+            <id>verify</id>
+            <goals>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+
         </executions>
       </plugin>
     </plugins>
@@ -402,7 +490,82 @@
               </execution>
             </executions>
           </plugin>
+
+
           <plugin>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-maven-plugin</artifactId>
+            <version>9.4.5.v20170502</version>
+            <configuration>
+              <stopKey>archivastop</stopKey>
+              <stopPort>${container.stop.port}</stopPort>
+              <stopWait>30</stopWait>
+              <httpConnector>
+                <port>${container.http.port}</port>
+              </httpConnector>
+            </configuration>
+            <dependencies>
+              <dependency>
+                <groupId>org.apache.derby</groupId>
+                <artifactId>derby</artifactId>
+                <version>${derbyVersion}</version>
+              </dependency>
+              <dependency>
+                <groupId>javax.mail</groupId>
+                <artifactId>mail</artifactId>
+                <version>${javaxMailVersion}</version>
+              </dependency>
+
+            </dependencies>
+            <executions>
+              <execution>
+                <id>jetty-run</id>
+                <goals>
+                  <goal>deploy-war</goal>
+                </goals>
+                <phase>pre-integration-test</phase>
+                <configuration>
+                  <daemon>true</daemon>
+                  <webApp>
+                    <contextPath>/archiva</contextPath>
+                    <jettyEnvXml>${project.build.testOutputDirectory}/jetty/jetty-env.xml</jettyEnvXml>
+                  </webApp>
+                  <war>${webappDirectory}</war>
+                  <systemProperties>
+                    <systemProperty>
+                      <name>appserver.base</name>
+                      <value>${project.build.directory}/appserver-base</value>
+                    </systemProperty>
+                    <systemProperty>
+                      <name>appserver.home</name>
+                      <value>${project.build.directory}/appserver-base</value>
+                    </systemProperty>
+                    <systemProperty>
+                      <name>derby.system.home</name>
+                      <value>${project.build.directory}</value>
+                    </systemProperty>
+                    <systemProperty>
+                      <name>archiva.devMode</name>
+                      <value>true</value>
+                    </systemProperty>
+                    <systemProperty>
+                      <name>openjpa.Log</name>
+                      <value>${openjpa.Log}</value>
+                    </systemProperty>
+                  </systemProperties>
+                </configuration>
+              </execution>
+              <execution>
+                <id>jetty-shutdown</id>
+                <goals>
+                  <goal>stop</goal>
+                </goals>
+                <phase>post-integration-test</phase>
+              </execution>
+            </executions>
+          </plugin>
+
+<!--          <plugin>
             <groupId>org.apache.tomcat.maven</groupId>
             <artifactId>tomcat7-maven-plugin</artifactId>
             <dependencies>
@@ -426,7 +589,7 @@
                 <phase>pre-integration-test</phase>
                 <configuration>
                   <path>/archiva</path>
-                  <port>${container.test.port}</port>
+                  <port>${container.http.port}</port>
                   <uriEncoding>UTF-8</uriEncoding>
                   <warDirectory>${webappDirectory}</warDirectory>
                   <fork>true</fork>
@@ -439,7 +602,7 @@
                     <openjpa.Log>${openjpa.Log}</openjpa.Log>
                   </systemProperties>
                   <contextFile>${project.build.testOutputDirectory}/archiva.xml</contextFile>
-                  <propertiesPortFilePath>${tomcat.propertiesPortFilePath}</propertiesPortFilePath>
+                  <propertiesPortFilePath>${container.propertiesPortFilePath}</propertiesPortFilePath>
                   <useNaming>true</useNaming>
                 </configuration>
               </execution>
@@ -451,7 +614,7 @@
                 <phase>post-integration-test</phase>
               </execution>
             </executions>
-          </plugin>
+          </plugin>-->
         </plugins>
       </build>
     </profile>
@@ -463,20 +626,10 @@
         </property>
       </activation>
       <properties>
-        <baseUrl>http://localhost:${container.test.port}/archiva/index.html?request_lang=en</baseUrl>
-      </properties>
-    </profile>
-    <profile>
-      <id>start-selenium</id>
-      <activation>
-        <property>
-          <name>!seleniumHost</name>
-        </property>
-      </activation>
-      <properties>
-        <seleniumRemote>false</seleniumRemote>
+        <baseUrl>http://localhost:${container.http.port}/archiva</baseUrl>
       </properties>
     </profile>
+
     <profile>
       <id>htmlunit</id>
       <activation>

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
index 7f83b34..6838cc2 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
@@ -18,10 +18,11 @@ package org.apache.archiva.web.test;
  * under the License.
  */
 
-import junit.framework.Assert;
-import org.apache.archiva.web.test.tools.WebdriverInitializer;
+import org.fluentlenium.configuration.ConfigurationProperties;
+import org.fluentlenium.configuration.FluentConfiguration;
+import org.junit.Assert;
+import org.apache.archiva.web.test.tools.WebdriverUtility;
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.fluentlenium.adapter.junit.FluentTest;
 import org.fluentlenium.core.domain.FluentList;
 import org.fluentlenium.core.domain.FluentWebElement;
@@ -29,11 +30,16 @@ import org.junit.Before;
 import org.junit.Test;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
@@ -42,90 +48,75 @@ import static org.assertj.core.api.Assertions.assertThat;
 /**
  * @author Olivier Lamy
  */
+@FluentConfiguration(driverLifecycle = ConfigurationProperties.DriverLifecycle.CLASS)
 public class WebDriverBrowseTest
-        extends FluentTest
+    extends FluentTest
 {
 
+    final Logger log = LoggerFactory.getLogger( WebDriverBrowseTest.class );
+
     @Override
     public void takeScreenShot( String fileName )
     {
-        File fileNameHTML = new File( "target", "errorshtmlsnap" );
-        try
-        {
-            // save html to have a minimum feedback if jenkins firefox not up
-            fileNameHTML = new File( fileNameHTML, fileName );
-            FileUtils.writeStringToFile( new File ( new File( "target", "errorshtmlsnap" ) , fileName + ".html"), getDriver().getPageSource() );
-
-        }
-        catch ( IOException e )
-        {
-            e.printStackTrace();
-        }
-        super.takeScreenShot( fileNameHTML.getAbsolutePath() );
-
+        WebdriverUtility.takeScreenShot( fileName, getDriver(), (a)->super.takeScreenShot( a ) );
     }
 
     @Before
     public void init()
     {
 
-        setScreenshotMode( TriggerMode.AUTOMATIC_ON_FAIL);
+        setScreenshotMode( TriggerMode.AUTOMATIC_ON_FAIL );
         setDriverLifecycle( DriverLifecycle.CLASS );
 
     }
 
     @Test
     public void simpletest()
-            throws Exception
+        throws Exception
     {
         Properties p = new Properties();
         p.load( this.getClass().getClassLoader().getResourceAsStream( "test.properties" ) );
 
-        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" );
+        String baseUrl = WebdriverUtility.getBaseUrl();
+        String url = baseUrl + "/index.html?request_lang=en";
+        goTo( url );
 
         // wait until topbar-menu-container is feeded
-        await().atMost( 5, TimeUnit.SECONDS ).until( $("#topbar-menu" )).present();
+        await().atMost( 5, TimeUnit.SECONDS ).untilPredicate( ( fl ) -> $( "#topbar-menu" ).present() );
 
         FluentList<FluentWebElement> elements = find( "#create-admin-link-a" );
-
         if ( !elements.isEmpty() && elements.get( 0 ).displayed() )
         {
             WebElement webElement = elements.get( 0 ).getElement();
             Assert.assertEquals( "Create Admin User", webElement.getText() );
 
             webElement.click();
-            await().atMost( 2, TimeUnit.SECONDS ).until($( "#user-create" )).present();
+            await().atMost( 2, TimeUnit.SECONDS ).untilPredicate( ( fl ) -> $( "#user-create" ).present() );
             assertThat( find( "#username" ).value().equals( "admin" ) );
             assertThat( find( "#password" ).value().isEmpty() );
             assertThat( find( "#confirmPassword" ).value().isEmpty() );
             assertThat( find( "#email" ).value().isEmpty() );
 
-            $("#fullname").fill().with( p.getProperty( "ADMIN_FULLNAME" ) );
-            $("#email").fill().with( p.getProperty( "ADMIN_EMAIL" ) );
-            $("#password").fill().with( p.getProperty( "ADMIN_PASSWORD" ) );
-            $("#confirmPassword").fill().with( p.getProperty( "ADMIN_PASSWORD" ) );
+            $( "#fullname" ).fill().with( p.getProperty( "ADMIN_FULLNAME" ) );
+            $( "#email" ).fill().with( p.getProperty( "ADMIN_EMAIL" ) );
+            $( "#password" ).fill().with( p.getProperty( "ADMIN_PASSWORD" ) );
+            $( "#confirmPassword" ).fill().with( p.getProperty( "ADMIN_PASSWORD" ) );
             find( "#user-create-form-register-button" ).click();
 
-            await().atMost( 2, TimeUnit.SECONDS ).until($("#logout-link" )).present();
+            await().atMost( 2, TimeUnit.SECONDS ).untilPredicate( ( fl ) -> $( "#logout-link" ).present() );
 
             FluentList<FluentWebElement> elementss = find( "#menu-find-browse-a" );
             WebElement webElsement = elementss.get( 0 ).getElement();
             webElsement.click();
-            await().atMost( 2, TimeUnit.SECONDS ).until($("#main_browse_result" )).present();
+            await().atMost( 5, TimeUnit.SECONDS ).untilPredicate( ( fl ) -> $( "#main_browse_result" ).present() );
             // give me search page :( not  browse page
 
             takeScreenShot( "search.png" );
 
-            goTo( "http://localhost:" + tomcatPort + "/archiva/index.html#browse?request_lang=en" );
+            goTo( baseUrl + "/index.html#browse?request_lang=en" );
             takeScreenShot( "browse.png" );
             // give me a browse page
-            
+
         }
         else
         {
@@ -137,7 +128,8 @@ public class WebDriverBrowseTest
     }
 
     @Override
-    public WebDriver newWebDriver() {
-        return WebdriverInitializer.newWebDriver();
+    public WebDriver newWebDriver()
+    {
+        return WebdriverUtility.newWebDriver();
     }
 }

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
index 5a020e2..c2980e9 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
@@ -18,53 +18,41 @@ package org.apache.archiva.web.test;
  * under the License.
  */
 
-import junit.framework.Assert;
-import org.apache.archiva.web.test.tools.WebdriverInitializer;
+import org.junit.Assert;
+import org.apache.archiva.web.test.tools.WebdriverUtility;
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.fluentlenium.adapter.junit.FluentTest;
+import org.fluentlenium.configuration.ConfigurationProperties;
+import org.fluentlenium.configuration.FluentConfiguration;
 import org.fluentlenium.core.domain.FluentList;
 import org.fluentlenium.core.domain.FluentWebElement;
 import org.junit.Before;
 import org.junit.Test;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.ie.InternetExplorerDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.remote.RemoteWebDriver;
-import org.openqa.selenium.safari.SafariDriver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
 
 /**
  * @author Olivier Lamy
  */
+@FluentConfiguration(driverLifecycle = ConfigurationProperties.DriverLifecycle.CLASS)
 public class WebDriverTest
         extends FluentTest
 {
 
-
+    final Logger log = LoggerFactory.getLogger( WebDriver.class );
 
     @Override
-    public void takeScreenShot(String fileName) {
-        try {
-            // save html to have a minimum feedback if jenkins firefox not up
-            File fileNameHTML = new File(fileName + ".html");
-            FileUtils.writeStringToFile(fileNameHTML, getDriver().getPageSource());
-        } catch (IOException e) {
-            System.out.print(e.getMessage());
-            e.printStackTrace();
-        }
-        super.takeScreenShot(fileName);
+    public void takeScreenShot( String fileName )
+    {
+        WebdriverUtility.takeScreenShot( fileName, getDriver(), (a)->super.takeScreenShot( a ) );
     }
 
 
@@ -79,18 +67,12 @@ public class WebDriverTest
     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"));
-        String url = "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en";
-        System.err.println("URL: "+url);
+        String url = WebdriverUtility.getBaseUrl()+ "/index.html?request_lang=en";
         goTo(url);
 
         // wait until topbar-menu-container is feeded
-        await().atMost(10, TimeUnit.SECONDS).until($("#topbar-menu")).present();
-
+        //await().atMost(20, TimeUnit.SECONDS).until($("#topbar-menu")).present();
+        await().untilPredicate((fl) ->$("#topbar-menu").present());
         FluentList<FluentWebElement> elements = find("#create-admin-link-a");
 
         if (!elements.isEmpty() && elements.get(0).displayed()) {
@@ -106,6 +88,6 @@ public class WebDriverTest
 
     @Override
     public WebDriver newWebDriver() {
-        return WebdriverInitializer.newWebDriver();
+        return WebdriverUtility.newWebDriver();
     }
 }

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
index a8403cd..daec10b 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
@@ -19,12 +19,11 @@ package org.apache.archiva.web.test.parent;
  * under the License.
  */
 
-import com.thoughtworks.selenium.DefaultSelenium;
 import com.thoughtworks.selenium.Selenium;
+//import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
 import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
 import org.apache.archiva.web.test.tools.ArchivaSeleniumExecutionRule;
-import org.apache.archiva.web.test.tools.WebdriverInitializer;
-import org.apache.xpath.operations.Bool;
+import org.apache.archiva.web.test.tools.WebdriverUtility;
 import org.junit.Assert;
 import org.junit.Rule;
 
@@ -84,13 +83,7 @@ public abstract class AbstractSeleniumTest
         p = new Properties();
         p.load( this.getClass().getClassLoader().getResourceAsStream( "test.properties" ) );
 
-        Properties tomcatPortProperties = new Properties();
-        tomcatPortProperties.load(
-            new FileInputStream( new File( System.getProperty( "tomcat.propertiesPortFilePath" ) ) ) );
-
-        int tomcatPort = Integer.parseInt( tomcatPortProperties.getProperty( "tomcat.maven.http.port" ) );
-
-        baseUrl = "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en";
+        baseUrl = WebdriverUtility.getBaseUrl()+"/index.html?request_lang=en";
 
         open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs, remoteSelenium );
         archivaSeleniumExecutionRule.selenium = selenium;
@@ -118,8 +111,9 @@ public abstract class AbstractSeleniumTest
         {
             if ( getSelenium() == null )
             {
-                WebDriver driver = WebdriverInitializer.newWebDriver(browser, seleniumHost, seleniumPort, remoteSelenium);
-                selenium = new WebDriverBackedSelenium(driver, baseUrl);
+                WebDriver driver = WebdriverUtility.newWebDriver(browser, seleniumHost, seleniumPort, remoteSelenium);
+                WebDriverBackedSelenium selenium = new WebDriverBackedSelenium(driver, baseUrl);
+                selenium.getWrappedDriver();
                 selenium.start();
                 selenium.setTimeout( Integer.toString( maxWaitTimeInMs ) );
             }

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java
deleted file mode 100644
index c3ddc1a..0000000
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package org.apache.archiva.web.test.tools;
-/*
- * 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 org.apache.commons.lang3.StringUtils;
-import org.openqa.selenium.Capabilities;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.htmlunit.HtmlUnitDriver;
-import org.openqa.selenium.ie.InternetExplorerDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.remote.RemoteWebDriver;
-import org.openqa.selenium.safari.SafariDriver;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * Created by martin_s on 04.06.17.
- */
-public class WebdriverInitializer
-{
-
-    public static WebDriver newWebDriver() {
-        String seleniumBrowser = System.getProperty("selenium.browser");
-        String seleniumHost = System.getProperty("seleniumHost", "localhost");
-        int seleniumPort = Integer.getInteger("seleniumPort", 4444);
-        boolean seleniumRemote = Boolean.parseBoolean(System.getProperty("seleniumRemote","false"));
-        return newWebDriver(seleniumBrowser,seleniumHost, seleniumPort,seleniumRemote);
-    }
-
-    public static WebDriver newWebDriver(String seleniumBrowser, String seleniumHost, int seleniumPort, boolean seleniumRemote) {
-        try {
-
-            if ( StringUtils.contains(seleniumBrowser, "chrome")) {
-                if (seleniumRemote)
-                {
-                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
-                        DesiredCapabilities.chrome()
-                    );
-                } else {
-                    return new ChromeDriver(  );
-                }
-            }
-
-            if (StringUtils.contains(seleniumBrowser, "safari")) {
-                if (seleniumRemote)
-                {
-                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
-                        DesiredCapabilities.safari()
-                    );
-                } else {
-                    return new SafariDriver();
-                }
-            }
-
-            if (StringUtils.contains(seleniumBrowser, "iexplore")) {
-                if (seleniumRemote)
-                {
-                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
-                        DesiredCapabilities.internetExplorer()
-                    );
-                } else {
-                    new InternetExplorerDriver(  );
-                }
-            }
-
-            if (StringUtils.contains( seleniumBrowser, "firefox" ))
-            {
-                if ( seleniumRemote )
-                {
-                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
-                        DesiredCapabilities.firefox()
-                    );
-                }
-                else
-                {
-                    return new FirefoxDriver();
-                }
-            }
-
-            if ( seleniumRemote )
-            {
-                return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
-                    DesiredCapabilities.htmlUnit()
-                );
-            }
-            else
-            {
-                DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
-                capabilities.setJavascriptEnabled( true );
-                capabilities.setVersion( "firefox-51" );
-                return new HtmlUnitDriver( capabilities  );
-            }
-
-        } catch (MalformedURLException e) {
-            throw new RuntimeException("Initializion of remote driver failed");
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java
new file mode 100644
index 0000000..0011dc6
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java
@@ -0,0 +1,204 @@
+package org.apache.archiva.web.test.tools;
+/*
+ * 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 org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.openqa.selenium.Capabilities;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+import org.openqa.selenium.ie.InternetExplorerDriver;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.safari.SafariDriver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Properties;
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+/**
+ * Created by martin_s on 04.06.17.
+ */
+public class WebdriverUtility
+{
+
+    static final Logger log = LoggerFactory.getLogger( WebdriverUtility.class );
+
+    public static WebDriver newWebDriver() {
+        String seleniumBrowser = System.getProperty("selenium.browser");
+        String seleniumHost = System.getProperty("seleniumHost", "localhost");
+        int seleniumPort = Integer.getInteger("seleniumPort", 4444);
+        boolean seleniumRemote = Boolean.parseBoolean(System.getProperty("seleniumRemote","false"));
+        return newWebDriver(seleniumBrowser,seleniumHost, seleniumPort,seleniumRemote);
+    }
+
+    public static WebDriver newWebDriver(String seleniumBrowser, String seleniumHost, int seleniumPort, boolean seleniumRemote) {
+        try {
+
+            if ( StringUtils.contains(seleniumBrowser, "chrome")) {
+                if (seleniumRemote)
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.chrome()
+                    );
+                } else {
+                    return new ChromeDriver(  );
+                }
+            }
+
+            if (StringUtils.contains(seleniumBrowser, "safari")) {
+                if (seleniumRemote)
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.safari()
+                    );
+                } else {
+                    return new SafariDriver();
+                }
+            }
+
+            if (StringUtils.contains(seleniumBrowser, "iexplore")) {
+                if (seleniumRemote)
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.internetExplorer()
+                    );
+                } else {
+                    new InternetExplorerDriver(  );
+                }
+            }
+
+            if (StringUtils.contains( seleniumBrowser, "firefox" ))
+            {
+                if ( seleniumRemote )
+                {
+                    return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                        DesiredCapabilities.firefox()
+                    );
+                }
+                else
+                {
+                    return new FirefoxDriver();
+                }
+            }
+
+            if ( seleniumRemote )
+            {
+                return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ),
+                    DesiredCapabilities.htmlUnit()
+                );
+            }
+            else
+            {
+                DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
+                capabilities.setJavascriptEnabled( true );
+                capabilities.setVersion( "firefox-51" );
+                return new HtmlUnitDriver( capabilities  );
+            }
+
+        } catch (MalformedURLException e) {
+            throw new RuntimeException("Initializion of remote driver failed");
+        }
+
+    }
+
+    public static String getBaseUrl() {
+
+        if (System.getProperties().containsKey( "baseUrl" )) {
+            return System.getProperty("baseUrl");
+        }
+        int containerPort = 7777;
+        if (System.getProperties().containsKey("container.http.port")) {
+            containerPort = Integer.parseInt(System.getProperty("container.http.port"));
+        } else if (System.getProperties().containsKey("container.propertiesPortFilePath"))
+        {
+            Properties portProperties = new Properties();
+            try (InputStream inputStream = Files.newInputStream(Paths.get(System.getProperty("container.propertiesPortFilePath"))))
+            {
+                portProperties.load(inputStream);
+            }
+            catch ( IOException e )
+            {
+                log.error("Error during property loading with containger.propertiesPortFilePath");
+            }
+            if ( portProperties.containsKey( "tomcat.maven.http.port" ) )
+            {
+                containerPort = Integer.parseInt( portProperties.getProperty( "tomcat.maven.http.port" ) );
+            }
+            else
+            {
+                containerPort = Integer.parseInt( portProperties.getProperty( "container.http.port" ) );
+            }
+        }
+        return "http://localhost:" + containerPort+"/archiva";
+    }
+
+    public static void takeScreenShot( String fileName, WebDriver driver, Consumer<String> screenShotFunction) {
+        try
+        {
+            Path snapDir = Paths.get( "target", "errorshtmlsnap" );
+            if ( !Files.exists( snapDir ) )
+            {
+                Files.createDirectories( snapDir );
+            }
+            Path htmlFile = snapDir.resolve( fileName + ".html" );
+            Path screenShotFile = snapDir.resolve( fileName );
+            String pageSource=null;
+            String encoding="ISO-8859-1";
+            try
+            {
+                pageSource = ( (JavascriptExecutor) driver ).executeScript( "return document.documentElement.outerHTML;" ).toString();
+            } catch (Exception e) {
+                log.info("Could not create html source by javascript");
+                pageSource = driver.getPageSource();
+            }
+            if (pageSource.contains("encoding=\"")) {
+                encoding = pageSource.replaceFirst( ".*encoding=\"([^\"]+)\".*", "$1" );
+            }
+            FileUtils.writeStringToFile( htmlFile.toFile(), pageSource, encoding);
+            try
+            {
+                screenShotFunction.accept( screenShotFile.toAbsolutePath().toString() );
+            }
+            catch ( Exception e )
+            {
+                log.info( "Could not create screenshot: " + e.getMessage() );
+            }
+
+        }
+        catch ( IOException e )
+        {
+            log.info( "Creating screenshot failed " + e.getMessage() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j.xml
deleted file mode 100644
index 4957e2d..0000000
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-  <appender name="console" class="org.apache.log4j.ConsoleAppender">
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
-    </layout>
-  </appender>
-
-
-  <logger name="org.springframework">
-    <level value="ERROR"/>
-  </logger>
-
-  <root>
-    <priority value ="info" />
-    <appender-ref ref="console" />
-  </root>
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
index dec6d75..61f9f01 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
@@ -19,7 +19,7 @@
   -->
 
 
-<configuration status="debug">
+<configuration status="info">
   <appenders>
     <Console name="console" target="SYSTEM_OUT">
       <PatternLayout pattern="%d [%t] %-5p %c %x - %m%n"/>
@@ -30,7 +30,6 @@
     <logger name="org.springframework" level="error"/>
     <logger name="com.gargoylesoftware.htmlunit.DefaultCssErrorHandler" level="error" />
     <logger name="com.gargoylesoftware.htmlunit.html.HtmlScript" level="error" />
-    <logger name="org.apache.http.wire" level="debug" />
 
     <root level="info">
       <appender-ref ref="console"/>

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j.xml
deleted file mode 100644
index 8ddcde5..0000000
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  ~ 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.
-  -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-  <appender name="console" class="org.apache.log4j.ConsoleAppender">
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
-    </layout>
-  </appender>
-
-  <logger name="JPOX">
-    <level value="error"/>
-  </logger>
-
-  <logger name="org.apache.commons.configuration.DefaultConfigurationBuilder">
-    <level value="error"/>
-  </logger>
-
-
-  <logger name="org.springframework">
-    <level value="ERROR"/>
-  </logger>
-
-  <logger name="org.codehaus.plexus">
-    <level value="ERROR"/>
-  </logger>
-
-  <logger name="org.codehaus.redback">
-    <level value="ERROR"/>
-  </logger>
-
-  <logger name="org.apache.cxf">
-    <level value="ERROR"/>
-  </logger>
-
-  <logger name="org.quartz">
-    <level value="ERROR"/>
-  </logger>
-
-  <logger name="org.apache.archiva">
-    <level value="INFO"/>
-  </logger>
-
-
-  <root>
-    <priority value="ERROR" />
-    <appender-ref ref="console" />
-  </root>
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/archiva/blob/69c6b594/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j2-test.xml
index e9a65a5..6d550a8 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j2-test.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/logging/log4j2-test.xml
@@ -19,7 +19,7 @@
   -->
 
 
-<configuration status="debug">
+<configuration status="info">
   <appenders>
     <Console name="console" target="SYSTEM_OUT">
       <PatternLayout pattern="%d [%t] %-5p %c %x - %m%n"/>
@@ -39,6 +39,8 @@
 
     <logger name="org.apache.archiva.redback" level="error"/>
 
+    <logger name="org.apache.jackrabbit" level="error" />
+
     <logger name="org.apache.cxf" level="error"/>
 
     <logger name="org.quartz" level="error"/>


[3/4] archiva git commit: Adding intellij ignore pattern

Posted by ma...@apache.org.
Adding intellij ignore pattern


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/422af343
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/422af343
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/422af343

Branch: refs/heads/master
Commit: 422af343f147b63a1efd97627d6553af944c75ff
Parents: 69c6b59
Author: Martin Stockhammer <ma...@apache.org>
Authored: Mon Jun 5 22:33:50 2017 +0200
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Mon Jun 5 22:33:50 2017 +0200

----------------------------------------------------------------------
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/422af343/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index d5addeb..4799988 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ build
 *.ipr
 *.iws
 out/
+.indexer
 
 #jenv
 .java-version


[4/4] archiva git commit: Changing tests to WebDriver

Posted by ma...@apache.org.
Changing tests to WebDriver


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/7b8d3bb3
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/7b8d3bb3
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/7b8d3bb3

Branch: refs/heads/master
Commit: 7b8d3bb3803c72cf08dd344e4e605207721a65a1
Parents: 422af34
Author: Martin Stockhammer <ma...@apache.org>
Authored: Thu Jun 8 07:02:29 2017 +0200
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Thu Jun 8 07:02:29 2017 +0200

----------------------------------------------------------------------
 .../archiva-web/archiva-webapp-test/pom.xml     |  46 ++++
 .../org/apache/archiva/web/test/LoginTest.java  |   5 +
 .../archiva/web/test/RepositoryAdminTest.java   |  18 +-
 .../archiva/web/test/WebDriverBrowseTest.java   |  35 +++-
 .../apache/archiva/web/test/WebDriverTest.java  |  33 ++-
 .../web/test/parent/AbstractArchivaTest.java    |   3 +-
 .../web/test/parent/AbstractSeleniumTest.java   | 208 ++++++++++++-------
 .../tools/ArchivaSeleniumExecutionRule.java     |   7 +
 .../web/test/tools/WebdriverUtility.java        |  15 +-
 .../src/test/resources/log4j2-test.xml          |   4 +
 .../archiva-web/archiva-webapp/pom.xml          | 137 ++++++++++++
 .../main/webapp/js/templates/archiva/menu.html  |   2 +-
 .../archiva-webapp/src/test/jetty/jetty-env.xml |  18 ++
 .../archiva-web/archiva-webdav/pom.xml          |   8 +-
 pom.xml                                         |   1 +
 15 files changed, 445 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
index db11a19..a5239a6 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
@@ -103,6 +103,23 @@
           <groupId>org.eclipse.jetty.websocket</groupId>
           <artifactId>websocket-common</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>net.sourceforge.htmlunit</groupId>
+          <artifactId>neko-htmlunit</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>net.sourceforge.htmlunit</groupId>
+          <artifactId>htmlunit-core-js</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>net.sourceforge.cssparser</groupId>
+          <artifactId>cssparser</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.seleniumhq.selenium</groupId>
+          <artifactId>htmlunit-driver</artifactId>
+        </exclusion>
+
       </exclusions>
     </dependency>
 
@@ -183,6 +200,19 @@
           <groupId>org.eclipse.jetty.websocket</groupId>
           <artifactId>websocket-common</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>net.sourceforge.htmlunit</groupId>
+          <artifactId>neko-htmlunit</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>net.sourceforge.htmlunit</groupId>
+          <artifactId>htmlunit-core-js</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>net.sourceforge.cssparser</groupId>
+          <artifactId>cssparser</artifactId>
+        </exclusion>
+
       </exclusions>
     </dependency>
 
@@ -289,6 +319,21 @@
     </dependency>
 
 
+    <dependency>
+      <groupId>org.seleniumhq.selenium</groupId>
+      <artifactId>htmlunit-driver</artifactId>
+      <version>${htmlUnitVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>net.sourceforge.htmlunit</groupId>
+      <artifactId>htmlunit</artifactId>
+      <version>${htmlUnitVersion}</version>
+      <scope>test</scope>
+    </dependency>
+
+
+
+
   </dependencies>
 
   <build>
@@ -367,6 +412,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-failsafe-plugin</artifactId>
+        <version>2.20</version>
         <configuration>
           <redirectTestOutputToFile>false</redirectTestOutputToFile>
           <runOrder>alphabetical</runOrder>

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/LoginTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/LoginTest.java
index d0f50fb..24f1a09 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/LoginTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/LoginTest.java
@@ -20,7 +20,9 @@ package org.apache.archiva.web.test;
  */
 
 import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.junit.Assert;
 import org.junit.Test;
+import org.openqa.selenium.By;
 
 /**
  * Based on LoginTest of Emmanuel Venisse test.
@@ -59,6 +61,7 @@ public class LoginTest
     {
         goToLoginPage();
         setFieldValue( "user-login-form-password", "password" );
+        waitPage();
         clickLinkWithLocator( "modal-login-ok", true );
         assertTextPresent( "This field is required." );
     }
@@ -68,6 +71,8 @@ public class LoginTest
     {
         goToLoginPage();
         setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
+        Assert.assertTrue(getWebDriver().findElement( By.id("modal-login-ok") ).isDisplayed());
+        Assert.assertTrue(getWebDriver().findElement( By.id("modal-login-ok") ).isEnabled());
         clickLinkWithLocator( "modal-login-ok", true );
         assertTextPresent( "This field is required." );
     }

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/RepositoryAdminTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/RepositoryAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/RepositoryAdminTest.java
index 7bdca22..b519bd9 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/RepositoryAdminTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/RepositoryAdminTest.java
@@ -22,6 +22,8 @@ package org.apache.archiva.web.test;
 import org.apache.archiva.web.test.parent.AbstractArchivaTest;
 import org.junit.Assert;
 import org.junit.Test;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
 
 /**
  * Based on LoginTest of Emmanuel Venisse test.
@@ -40,9 +42,8 @@ public class RepositoryAdminTest
     {
         login( getAdminUsername(), getAdminPassword() );
         clickLinkWithLocator( "menu-repositories-list-a", true );
-        
         // add custom repo
-        assertTextPresent( "Repositories Administration " );
+        assertTextPresent( "Repositories Administration" );
         clickLinkWithXPath( "//a[@href='#remote-repositories-content']", true );
         
         clickLinkWithXPath( "//a[@href='#remote-repository-edit']", true );
@@ -60,16 +61,21 @@ public class RepositoryAdminTest
         assertTextPresent( "central" );
         assertTextNotPresent( "myrepoid" );
         clickButtonWithLocator( "proxy-connectors-view-tabs-a-edit", true );
-        getSelenium().select( "sourceRepoId", "internal" );
-        getSelenium().select( "targetRepoId", "myrepoid" );
+        selectValue( "sourceRepoId", "internal" );
+        // Workaround
+        // TODO: Check after upgrade of htmlunit, bootstrap or jquery
+        // TODO: Check whats wrong here
+        ( (JavascriptExecutor) getWebDriver() ).executeScript( "$('#targetRepoId').show();" );
+        // End of Workaround
+        selectValue( "targetRepoId", "myrepoid" );
         clickButtonWithLocator( "proxy-connector-btn-save", true);
         assertTextPresent( "central" );
         assertTextPresent( "myrepoid" );
         clickLinkWithXPath( "//i[contains(concat(' ',normalize-space(@class),' '),' icon-resize-vertical ')]/../..", true );
         assertTextPresent( "internal" );
         // order test
-        Assert.assertTrue( "First repo is myrepo",getSelenium().getText("xpath=//div[@id='proxy-connector-edit-order-div']/div[1]" ).contains( "myrepoid" ));
-        Assert.assertTrue( "Second repo is central",getSelenium().getText("xpath=//div[@id='proxy-connector-edit-order-div']/div[2]" ).contains( "central" ));
+        Assert.assertTrue( "First repo is myrepo",findElement("//div[@id='proxy-connector-edit-order-div']/div[1]").getText().contains("myrepoid"));
+        Assert.assertTrue( "Second repo is central",findElement("//div[@id='proxy-connector-edit-order-div']/div[2]" ).getText().contains( "central" ));
              
         // works until this point
         /*getSelenium().mouseDown( "xpath=//div[@id='proxy-connector-edit-order-div']/div[1]" );

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
index 6838cc2..7c7b718 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java
@@ -18,6 +18,8 @@ package org.apache.archiva.web.test;
  * under the License.
  */
 
+import com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor;
+import org.fluentlenium.adapter.junit.After;
 import org.fluentlenium.configuration.ConfigurationProperties;
 import org.fluentlenium.configuration.FluentConfiguration;
 import org.junit.Assert;
@@ -28,8 +30,11 @@ import org.fluentlenium.core.domain.FluentList;
 import org.fluentlenium.core.domain.FluentWebElement;
 import org.junit.Before;
 import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,9 +63,22 @@ public class WebDriverBrowseTest
     @Override
     public void takeScreenShot( String fileName )
     {
+        log.info("Taking screenshot "+fileName);
         WebdriverUtility.takeScreenShot( fileName, getDriver(), (a)->super.takeScreenShot( a ) );
     }
 
+    @Override
+    protected void failed( String testName )
+    {
+        takeScreenShot( testName + ".png" );
+    }
+
+    @Override
+    public boolean canTakeScreenShot()
+    {
+        return true;
+    }
+
     @Before
     public void init()
     {
@@ -68,6 +86,7 @@ public class WebDriverBrowseTest
         setScreenshotMode( TriggerMode.AUTOMATIC_ON_FAIL );
         setDriverLifecycle( DriverLifecycle.CLASS );
 
+
     }
 
     @Test
@@ -120,9 +139,21 @@ public class WebDriverBrowseTest
         }
         else
         {
-            elements = find( "#login-link-a" );
+            elements = find( By.id("login-link-a"));
             WebElement webElement = elements.get( 0 ).getElement();
-            Assert.assertEquals( "LOGIN", webElement.getText() );
+            for(FluentWebElement element : elements) {
+                log.info("Found login link: "+element.getElement().getTagName()+ " "+ element.getElement().getText());
+            }
+            log.info("innerText: "+webElement.getAttribute("innerText"));
+            log.info("value: "+webElement.getAttribute("value"));
+            log.info("innerHTML: "+webElement.getAttribute( "innerHTML" ));
+            log.info("JS: "+((( JavascriptExecutor)getDriver()).executeScript("return $(arguments[0]).text();", webElement)));
+            if (getDriver() instanceof HtmlUnitDriver) {
+                Assert.assertEquals( "LOGIN", webElement.getText().toUpperCase() );
+            } else
+            {
+                Assert.assertEquals( "LOGIN", webElement.getText() );
+            }
         }
 
     }

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
index c2980e9..bb01a89 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java
@@ -18,6 +18,7 @@ package org.apache.archiva.web.test;
  * under the License.
  */
 
+import org.fluentlenium.adapter.junit.After;
 import org.junit.Assert;
 import org.apache.archiva.web.test.tools.WebdriverUtility;
 import org.apache.commons.io.FileUtils;
@@ -28,8 +29,11 @@ import org.fluentlenium.core.domain.FluentList;
 import org.fluentlenium.core.domain.FluentWebElement;
 import org.junit.Before;
 import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,9 +56,21 @@ public class WebDriverTest
     @Override
     public void takeScreenShot( String fileName )
     {
+        log.info("Taking screenshot "+fileName);
         WebdriverUtility.takeScreenShot( fileName, getDriver(), (a)->super.takeScreenShot( a ) );
     }
 
+    @Override
+    protected void failed( String testName )
+    {
+        takeScreenShot( testName + ".png" );
+    }
+
+    @Override
+    public boolean canTakeScreenShot()
+    {
+        return true;
+    }
 
     @Before
     public void init() {
@@ -79,9 +95,22 @@ public class WebDriverTest
             WebElement webElement = elements.get(0).getElement();
             Assert.assertEquals("Create Admin User", webElement.getText());
         } else {
-            elements = find("#login-link-a");
+            elements = find( By.id("login-link-a"));
+            for(FluentWebElement element : elements) {
+                log.info("Found login link: "+element.getElement().getTagName()+ " "+ element.getElement().getText());
+            }
             WebElement webElement = elements.get(0).getElement();
-            Assert.assertEquals("LOGIN", webElement.getText());
+            log.info("innerText: "+webElement.getAttribute("innerText"));
+            log.info("value: "+webElement.getAttribute("value"));
+            log.info("innerHTML: "+webElement.getAttribute( "innerHTML" ));
+            log.info("JS: "+(((JavascriptExecutor)getDriver()).executeScript("return $(arguments[0]).text();", webElement)));
+            if (getDriver() instanceof HtmlUnitDriver ) {
+                Assert.assertEquals( "LOGIN", webElement.getText().toUpperCase() );
+            } else
+            {
+                Assert.assertEquals( "LOGIN", webElement.getText() );
+            }
+
         }
 
     }

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
index c4c343d..d05cbcc 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
@@ -174,7 +174,8 @@ public abstract class AbstractArchivaTest
 
     protected void logout()
     {
-        clickLinkWithText( "Logout" );
+        clickLinkWithLocator( "logout-link-a" );
+        waitPage();
         assertTextNotPresent( "Current User:" );
         assertLinkNotVisible( "Edit Details" );
         assertLinkNotVisible( "Logout" );

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
index daec10b..763bcc3 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
@@ -20,7 +20,6 @@ package org.apache.archiva.web.test.parent;
  */
 
 import com.thoughtworks.selenium.Selenium;
-//import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
 import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
 import org.apache.archiva.web.test.tools.ArchivaSeleniumExecutionRule;
 import org.apache.archiva.web.test.tools.WebdriverUtility;
@@ -39,7 +38,13 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import org.apache.commons.io.FileUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+import org.openqa.selenium.support.ui.Select;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,6 +75,8 @@ public abstract class AbstractSeleniumTest
 
     private Selenium selenium = null;
 
+    WebDriver webDriver = null;
+
     public Properties p;
 
     /**
@@ -113,9 +120,10 @@ public abstract class AbstractSeleniumTest
             {
                 WebDriver driver = WebdriverUtility.newWebDriver(browser, seleniumHost, seleniumPort, remoteSelenium);
                 WebDriverBackedSelenium selenium = new WebDriverBackedSelenium(driver, baseUrl);
-                selenium.getWrappedDriver();
-                selenium.start();
+                // selenium.start();
                 selenium.setTimeout( Integer.toString( maxWaitTimeInMs ) );
+                this.selenium = selenium;
+                this.webDriver = driver;
             }
         }
         catch ( Exception e )
@@ -146,8 +154,8 @@ public abstract class AbstractSeleniumTest
         // if not admin user created create one
         if ( isElementVisible( "create-admin-link" ) )
         {
-            Assert.assertFalse( getSelenium().isVisible( "login-link-a" ) );
-            Assert.assertFalse( getSelenium().isVisible( "register-link-a" ) );
+            Assert.assertFalse( isElementVisible( "login-link-a" ) );
+            Assert.assertFalse( isElementVisible( "register-link-a" ) );
             // skygo need to set to true for passing is that work as expected ?
             clickLinkWithLocator( "create-admin-link-a", true );
             assertCreateAdmin();
@@ -161,8 +169,14 @@ public abstract class AbstractSeleniumTest
         }
         else
         {
-            Assert.assertTrue( getSelenium().isVisible( "login-link-a" ) );
-            Assert.assertTrue( getSelenium().isVisible( "register-link-a" ) );
+            try
+            {
+                Assert.assertNotNull( getWebDriver().findElement( By.id( "login-link-a" ) ) );
+            } catch (NoSuchElementException e) {
+                logger.info("ASSERT: login-link-a not found!");
+            }
+            Assert.assertTrue( isElementVisible( "login-link-a" ) );
+            Assert.assertTrue( isElementVisible( "register-link-a" ) );
             login( getAdminUsername(), getAdminPassword() );
         }
 
@@ -173,6 +187,10 @@ public abstract class AbstractSeleniumTest
         return selenium;
     }
 
+    public WebDriver getWebDriver() {
+        return this.webDriver;
+    }
+
     protected String getProperty( String key )
     {
         return p.getProperty( key );
@@ -223,6 +241,7 @@ public abstract class AbstractSeleniumTest
     {
         getSelenium().open( baseUrl );
         waitPage();
+        getWebDriver().manage().window().maximize();
         // are we already logged in ?
         if ( isElementVisible( "logout-link" ) ) //isElementPresent( "logoutLink" ) )
         {
@@ -232,8 +251,17 @@ public abstract class AbstractSeleniumTest
         }
         else if ( isElementVisible( "login-link-a" ) )
         {
-            clickLinkWithLocator( "login-link-a" );
+            clickLinkWithLocator( "login-link-a", true );
         }
+        // This is a workaround for bug with HTMLUnit. The display attribute of the
+        // login dialog is not changed via the click.
+        // TODO: Check after changing jquery, bootstrap or htmlunit version
+        if (getWebDriver() instanceof HtmlUnitDriver)
+        {
+            ( (JavascriptExecutor) getWebDriver() ).executeScript( "$('#modal-login').show();" );
+        }
+        // END OF WORKAROUND
+
         assertLoginModal();
     }
 
@@ -245,6 +273,7 @@ public abstract class AbstractSeleniumTest
         assertElementPresent( "user-login-form-username" );
         assertElementPresent( "user-login-form-password" );
         assertButtonWithIdPresent( "modal-login-ok" );
+        Assert.assertTrue( isElementVisible( "modal-login-ok" ));
     }
 
 
@@ -261,7 +290,10 @@ public abstract class AbstractSeleniumTest
     public void submitLoginPage( String username, String password, boolean rememberMe, boolean validUsernamePassword,
                                  String assertReturnPage )
     {
-        clickLinkWithLocator( "login-link-a", false );
+        clickLinkWithLocator( "login-link-a", true );
+        // TODO: Check whats wrong here
+        ( (JavascriptExecutor) getWebDriver() ).executeScript( "$('#modal-login').show();" );
+
         setFieldValue( "user-login-form-username", username );
         setFieldValue( "user-login-form-password", password );
         /*
@@ -314,7 +346,7 @@ public abstract class AbstractSeleniumTest
     public void assertFieldValue( String fieldValue, String fieldName )
     {
         assertElementPresent( fieldName );
-        Assert.assertEquals( fieldValue, getSelenium().getValue( fieldName ) );
+        Assert.assertEquals( fieldValue, findElement(fieldName ).getAttribute( "value") );
     }
 
     public void assertPage( String title )
@@ -325,22 +357,22 @@ public abstract class AbstractSeleniumTest
     public String getTitle()
     {
         // Collapse spaces
-        return getSelenium().getTitle().replaceAll( "[ \n\r]+", " " );
+        return getWebDriver().getTitle().replaceAll( "[ \n\r]+", " " );
     }
 
     public String getHtmlContent()
     {
-        return getSelenium().getHtmlSource();
+        return getWebDriver().getPageSource();
     }
 
     public String getText( String locator )
     {
-        return getSelenium().getText( locator );
+        return findElement(locator ).getText();
     }
 
     public void assertTextPresent( String text )
     {
-        Assert.assertTrue( "'" + text + "' isn't present.", getSelenium().isTextPresent( text ) );
+        Assert.assertTrue( "'" + text + "' isn't present.", getWebDriver().getPageSource().contains( text ) );
     }
 
     /**
@@ -377,22 +409,22 @@ public abstract class AbstractSeleniumTest
 
     public void assertLinkPresent( String text )
     {
-        Assert.assertTrue( "The link '" + text + "' isn't present.", isElementPresent( "link=" + text ) );
+        Assert.assertTrue( "The link '" + text + "' isn't present.", isElementPresent( "//*[text()='" + text+"']//ancestor::a"  ) );
     }
 
     public void assertLinkNotPresent( String text )
     {
-        Assert.assertFalse( "The link('" + text + "' is present.", isElementPresent( "link=" + text ) );
+        Assert.assertFalse( "The link('" + text + "' is present.", isElementPresent( "//*[text()='" + text+"']//ancestor::a" ) );
     }
 
     public void assertLinkNotVisible( String text )
     {
-        Assert.assertFalse( "The link('" + text + "' is visible.", isElementVisible( "link=" + text ) );
+        Assert.assertFalse( "The link('" + text + "' is visible.", isElementVisible( "//*[text()='" + text+"']//ancestor::a"  ) );
     }
 
     public void assertLinkVisible( String text )
     {
-        Assert.assertTrue( "The link('" + text + "' is not visible.", isElementVisible( "link=" + text ) );
+        Assert.assertTrue( "The link('" + text + "' is not visible.", isElementVisible( "//*[text()='" + text+"']//ancestor::a" ) );
     }
 
     public void assertImgWithAlt( String alt )
@@ -426,17 +458,26 @@ public abstract class AbstractSeleniumTest
 
     public boolean isLinkPresent( String text )
     {
-        return isElementPresent( "link=" + text );
+        return isElementPresent( "//*[text()='" + text +"']//ancestor::a" );
     }
 
     public boolean isElementPresent( String locator )
     {
-        return getSelenium().isElementPresent( locator );
+        try
+        {
+            return findElement(locator ) != null;
+        } catch (Exception e) {
+            return false;
+        }
     }
 
-    public boolean isElementVisible( String locator )
+    public boolean isElementVisible(String locator )
     {
-        return getSelenium().isVisible( locator );
+        try {
+            return findElement(locator).isDisplayed();
+        } catch (Exception e) {
+            return false;
+        }
     }
 
 
@@ -465,7 +506,7 @@ public abstract class AbstractSeleniumTest
 
     public String getFieldValue( String fieldName )
     {
-        return getSelenium().getValue( fieldName );
+        return findElement(fieldName ).getAttribute( "value" );
     }
 
     public String getCellValueFromTable( String tableElement, int row, int column )
@@ -475,25 +516,19 @@ public abstract class AbstractSeleniumTest
 
     public void selectValue( String locator, String value )
     {
-        getSelenium().select( locator, "label=" + value );
+        WebElement element = findElement(locator );
+        Select select = new Select(element);
+        select.selectByValue( value );
     }
 
-
-    public void assertOptionPresent( String selectField, String[] options )
-    {
-        assertElementPresent( selectField );
-        String[] optionsPresent = getSelenium().getSelectOptions( selectField );
-        List<String> expected = Arrays.asList( options );
-        List<String> present = Arrays.asList( optionsPresent );
-        Assert.assertTrue( "Options expected are not included in present options", present.containsAll( expected ) );
+    public WebElement findElement(String locator) {
+        if (locator.startsWith("/")) {
+            return getWebDriver().findElement( By.xpath( locator ) );
+        } else {
+            return getWebDriver().findElement( By.id(locator) );
+        }
     }
 
-    public void assertSelectedValue( String value, String fieldName )
-    {
-        assertElementPresent( fieldName );
-        String optionsPresent = getSelenium().getSelectedLabel( value );
-        Assert.assertEquals( optionsPresent, value );
-    }
 
     public void submit()
     {
@@ -572,7 +607,7 @@ public abstract class AbstractSeleniumTest
 
     public void clickLinkWithText( String text, boolean wait )
     {
-        clickLinkWithLocator( "link=" + text, wait );
+        clickLinkWithLocator( "//*[text()='" + text +"']//ancestor::a", wait );
     }
 
     public void clickLinkWithXPath( String xpath )
@@ -582,7 +617,7 @@ public abstract class AbstractSeleniumTest
 
     public void clickLinkWithXPath( String xpath, boolean wait )
     {
-        clickLinkWithLocator( "xpath=" + xpath, wait );
+        clickLinkWithLocator( xpath, wait );
     }
 
     public void clickLinkWithLocator( String locator )
@@ -593,7 +628,7 @@ public abstract class AbstractSeleniumTest
     public void clickLinkWithLocator( String locator, boolean wait )
     {
         assertElementPresent( locator );
-        getSelenium().click( locator );
+        findElement(locator).click();
         if ( wait )
         {
             waitPage();
@@ -608,7 +643,7 @@ public abstract class AbstractSeleniumTest
     public void clickButtonWithLocator( String locator, boolean wait )
     {
         assertElementPresent( locator );
-        getSelenium().click( locator );
+        findElement(locator ).click();
         if ( wait )
         {
             waitPage();
@@ -623,50 +658,49 @@ public abstract class AbstractSeleniumTest
         {
             entry = entries.next();
 
-            getSelenium().type( entry.getKey(), entry.getValue() );
+            setFieldValue( entry.getKey(), entry.getValue() );
         }
     }
 
     public void setFieldValue( String fieldName, String value )
     {
-        getSelenium().type( fieldName, value );
+        findElement(fieldName ).sendKeys( value );
     }
 
     public void checkField( String locator )
     {
-        getSelenium().check( locator );
+        WebElement element = findElement(locator );
+        if (!element.isSelected()) {
+            element.click();
+        }
     }
 
     public void uncheckField( String locator )
     {
-        getSelenium().uncheck( locator );
+        WebElement element = findElement(locator );
+        if (element.isSelected()) {
+            element.click();
+        }
     }
 
     public boolean isChecked( String locator )
     {
-        return getSelenium().isChecked( locator );
+        return findElement(locator ).isSelected();
     }
 
     public void assertIsChecked( String locator )
     {
-        Assert.assertTrue( getSelenium().isChecked( locator ) );
+
+        Assert.assertTrue( isChecked( locator ));
     }
 
     public void assertIsNotChecked( String locator )
     {
-        Assert.assertFalse( getSelenium().isChecked( locator ) );
-    }
 
-    public void assertXpathCount( String locator, int expectedCount )
-    {
-        int count = getSelenium().getXpathCount( locator ).intValue();
-        Assert.assertEquals( count, expectedCount );
+        Assert.assertFalse( isChecked( locator ) );
     }
 
-    public void assertElementValue( String locator, String expectedValue )
-    {
-        Assert.assertEquals( getSelenium().getValue( locator ), expectedValue );
-    }
+
 
     public String captureScreenShotOnFailure( Throwable failure, String methodName, String className )
     {
@@ -687,31 +721,45 @@ public abstract class AbstractSeleniumTest
 
         targetPath.mkdirs();
         Selenium selenium = getSelenium();
-        String fileBaseName = methodName + "_" + className + ".java_" + lineNumber + "-" + time;
-
-        selenium.windowMaximize();
-        
-        try
-        {
-            // save html to have a minimum feedback if jenkins firefox not up
-            File fileNameHTML = new File( new File( "target", "errorshtmlsnap" ) , fileBaseName + ".html" );
-            FileUtils.writeStringToFile( fileNameHTML, selenium.getHtmlSource() );
-        }
-        catch ( IOException e )
+        if (selenium!=null)
         {
-            System.out.print( e.getMessage() );
-            e.printStackTrace();
-        }
-        
-        File fileName = new File( targetPath, fileBaseName + ".png" );
+            String fileBaseName = methodName + "_" + className + ".java_" + lineNumber + "-" + time;
+            File fileName = new File( targetPath, fileBaseName + ".png" );
+            selenium.windowMaximize();
 
-        try
-        {
-            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
-        } catch (UnsupportedOperationException ex) {
-            logger.warn("Could not create screenshot. Not supported by this webdriver. "+selenium.getClass().getName());
+            if (selenium instanceof WebDriverBackedSelenium)
+            {
+                WebdriverUtility.takeScreenShot( fileName.getName(), ( (WebDriverBackedSelenium) selenium ).getWrappedDriver(),
+                    (a)->selenium.captureEntirePageScreenshot( a, "background=#FFFFFF" )
+                    );
+            } else
+            {
+
+                try
+                {
+                    // save html to have a minimum feedback if jenkins firefox not up
+                    File fileNameHTML = new File( new File( "target", "errorshtmlsnap" ), fileBaseName + ".html" );
+                    FileUtils.writeStringToFile( fileNameHTML, selenium.getHtmlSource() );
+                }
+                catch ( IOException e )
+                {
+                    System.out.print( e.getMessage() );
+                    e.printStackTrace();
+                }
+
+
+                try
+                {
+                }
+                catch ( UnsupportedOperationException ex )
+                {
+                    logger.warn( "Could not create screenshot. Not supported by this webdriver. " + selenium.getClass().getName() );
+                }
+            }
+            return fileName.getAbsolutePath();
+        } else {
+            return "";
         }
-        return fileName.getAbsolutePath();
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java
index 08cb960..779ebd6 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java
@@ -24,6 +24,8 @@ import org.junit.rules.MethodRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author Olivier Lamy
@@ -31,6 +33,9 @@ import org.junit.runners.model.Statement;
 public class ArchivaSeleniumExecutionRule
     implements MethodRule //TestRule
 {
+
+    final Logger log = LoggerFactory.getLogger( ArchivaSeleniumExecutionRule.class );
+
     // FIXME cerate a separate TestRule for open and close calls ?
     public Selenium selenium;
 
@@ -43,6 +48,7 @@ public class ArchivaSeleniumExecutionRule
         }
         catch ( Throwable e )
         {
+            log.info("Exception thrown in Selenium test: "+e.getClass().getName()+" - "+e.getMessage());
             String fileName =
                 ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(),
                                                                               target.getClass().getName() );
@@ -52,6 +58,7 @@ public class ArchivaSeleniumExecutionRule
         finally
         {
             ( (AbstractSeleniumTest) target ).close();
+
         }
         return new Statement()
         {

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java
index 0011dc6..177c1fc 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java
@@ -18,6 +18,7 @@ package org.apache.archiva.web.test.tools;
  * under the License.
  */
 
+import com.gargoylesoftware.htmlunit.WebClient;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.openqa.selenium.Capabilities;
@@ -122,8 +123,18 @@ public class WebdriverUtility
             {
                 DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
                 capabilities.setJavascriptEnabled( true );
-                capabilities.setVersion( "firefox-51" );
-                return new HtmlUnitDriver( capabilities  );
+                capabilities.setVersion( "firefox-52" );
+                HtmlUnitDriver driver = new HtmlUnitDriver( capabilities  ) {
+                    @Override
+                    protected WebClient modifyWebClient( WebClient client )
+                    {
+                        client.getOptions().setThrowExceptionOnFailingStatusCode( false );
+                        client.getOptions().setThrowExceptionOnScriptError( false );
+                        client.getOptions().setCssEnabled( true );
+                        return client;
+                    }
+                };
+                return driver;
             }
 
         } catch (MalformedURLException e) {

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
index 61f9f01..d86502c 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/log4j2-test.xml
@@ -30,6 +30,10 @@
     <logger name="org.springframework" level="error"/>
     <logger name="com.gargoylesoftware.htmlunit.DefaultCssErrorHandler" level="error" />
     <logger name="com.gargoylesoftware.htmlunit.html.HtmlScript" level="error" />
+    <logger name="com.gargoylesoftware.htmlunit.javascript" level="error" />
+    <logger name="com.gargoylesoftware.htmlunit" level="error" />
+    <logger name="com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter" level="off" />
+
 
     <root level="info">
       <appender-ref ref="console"/>

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml
index b88e7ba..0ebd605 100644
--- a/archiva-modules/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml
@@ -963,6 +963,143 @@
       </plugin>
       -->
       <plugin>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-maven-plugin</artifactId>
+        <version>9.4.5.v20170502</version>
+        <configuration>
+          <scanIntervalSeconds>10</scanIntervalSeconds>
+          <webApp>
+            <contextPath>/archiva</contextPath>
+          </webApp>
+          <jettyXml>${basedir}/src/test/jetty/jetty-env.xml</jettyXml>
+
+          <systemProperties>
+            <systemProperty>
+              <name>plexus.home</name>
+              <value>${archivaAppServerBase}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>appserver.base</name>
+              <value>${archivaAppServerBase}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>appserver.home</name>
+              <value>${archivaAppServerBase}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>derby.system.home</name>
+              <value>${archivaAppServerBase}/logs</value>
+            </systemProperty>
+            <systemProperty>
+              <name>java.io.tmpdir</name>
+              <value>${project.build.directory}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>archiva.user.configFileName</name>
+              <value>${archivaAppServerBase}/conf/archiva.xml</value>
+            </systemProperty>
+            <systemProperty>
+              <name>archiva.devMode</name>
+              <value>${archiva.devMode}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>archiva.javascriptLog</name>
+              <value>${archiva.javascriptLog}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>archiva.logMissingI18n</name>
+              <value>${archiva.logMissingI18n}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>cassandra.host</name>
+              <value>${cassandra.host}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>cassandra.port</name>
+              <value>${cassandra.port}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>archiva.repositorySessionFactory.id</name>
+              <value>${archiva.repositorySessionFactory.id}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>org.apache.sirona.configuration.sirona.properties</name>
+              <value>${archiva.sirona.configuration}</value>
+            </systemProperty>
+            <systemProperty>
+              <name>AsyncLoggerConfig.WaitStrategy</name>
+              <value>Block</value>
+            </systemProperty>
+            <systemProperty>
+              <name>AsyncLogger.WaitStrategy</name>
+              <value>Block</value>
+            </systemProperty>
+            <systemProperty>
+              <name>openjpa.Log</name>
+              <value>${openjpa.Log}</value>
+            </systemProperty>
+          </systemProperties>
+
+        </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.apache.derby</groupId>
+              <artifactId>derby</artifactId>
+              <version>${derbyVersion}</version>
+            </dependency>
+            <dependency>
+              <groupId>javax.mail</groupId>
+              <artifactId>mail</artifactId>
+              <version>${javaxMailVersion}</version>
+            </dependency>
+            <dependency>
+              <groupId>org.apache.openjpa</groupId>
+              <artifactId>openjpa</artifactId>
+              <version>${openjpaVersion}</version>
+            </dependency>
+            <dependency>
+              <groupId>org.apache.geronimo.specs</groupId>
+              <artifactId>geronimo-jpa_2.0_spec</artifactId>
+              <version>1.1</version>
+            </dependency>
+            <dependency>
+              <groupId>org.apache.geronimo.specs</groupId>
+              <artifactId>geronimo-jta_1.1_spec</artifactId>
+              <version>1.1.1</version>
+            </dependency>
+            <dependency>
+              <groupId>net.sourceforge.serp</groupId>
+              <artifactId>serp</artifactId>
+              <version>1.15.1</version>
+            </dependency>
+
+            <dependency>
+              <groupId>org.eclipse.jetty</groupId>
+              <artifactId>jetty-io</artifactId>
+              <version>9.4.5.v20170502</version>
+            </dependency>
+            <dependency>
+              <groupId>org.eclipse.jetty</groupId>
+              <artifactId>jetty-util</artifactId>
+              <version>9.4.5.v20170502</version>
+            </dependency>
+            <dependency>
+              <groupId>org.eclipse.jetty</groupId>
+              <artifactId>jetty-client</artifactId>
+              <version>9.4.5.v20170502</version>
+            </dependency>
+            <dependency>
+              <groupId>org.eclipse.jetty.websocket</groupId>
+              <artifactId>websocket-client</artifactId>
+              <version>9.4.5.v20170502</version>
+            </dependency>
+
+          </dependencies>
+
+      </plugin>
+
+
+      <plugin>
         <groupId>org.apache.tomcat.maven</groupId>
         <artifactId>tomcat7-maven-plugin</artifactId>
         <configuration>

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/menu.html
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/menu.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/menu.html
index df8c42e..30bb261 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/menu.html
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/menu.html
@@ -88,7 +88,7 @@
               </a>
             </li>
             <li id="login-link" style="display: none">
-              <a onclick="loginBox();" id="login-link-a">
+              <a onclick="loginBox(); return false;" id="login-link-a">
                 <span class="btn btn-success label force-upper-case">${$.i18n.prop('login')}</span>
               </a>
             </li>

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml
index 1668649..bed63bf 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0"  encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
 
 <Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/archiva-modules/archiva-web/archiva-webdav/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml
index 73a8654..a277f11 100644
--- a/archiva-modules/archiva-web/archiva-webdav/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml
@@ -193,8 +193,14 @@
     <dependency>
       <groupId>net.sourceforge.htmlunit</groupId>
       <artifactId>htmlunit</artifactId>
-      <version>2.13</version>
+      <version>${htmlUnitVersion}</version>
       <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-websocket</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>

http://git-wip-us.apache.org/repos/asf/archiva/blob/7b8d3bb3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8b1bad4..50aef79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -99,6 +99,7 @@
     <plexus-utils.version>3.0.15</plexus-utils.version>
     <asfTomcatMavenPluginVersion>2.2</asfTomcatMavenPluginVersion>
     <tomcat7Version>7.0.54</tomcat7Version>
+    <htmlUnitVersion>2.27</htmlUnitVersion>
 
     <release.preparationGoals>clean install</release.preparationGoals>
     <springockito.version>1.0.9</springockito.version>