From 0bbedd7201a85118c52cc0d5bca7d3804bfcf5c2 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 4 Jun 2017 18:20:40 +0200 Subject: [PATCH] Migrating selenium tests --- .../archiva-web/archiva-webapp-test/pom.xml | 152 ++++++++++-------- .../archiva/web/test/WebDriverBrowseTest.java | 90 ++++------- .../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 ++ .../src/test/jetty/jetty-env.xml | 30 ++++ pom.xml | 2 +- 10 files changed, 374 insertions(+), 178 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverInitializer.java create mode 100644 archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/jetty/jetty-env.xml create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index 1ba04f187..ad2b77fed 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 @@ ${project.build.directory}/tomcat-port.properties 10000 - 2.3 - 2.53.1 - 0.10.2 + 3.4.0 + 3.2.0 + 0.13.2 @@ -70,7 +70,18 @@ org.seleniumhq.selenium selenium-java + test ${selenium-server.version} + + + commons-logging + commons-logging + + + javax.servlet + javax.servlet-api + + org.seleniumhq.selenium.client-drivers @@ -81,12 +92,43 @@ commons-logging commons-logging + + javax.servlet + javax.servlet-api + org.seleniumhq.selenium selenium-remote-driver + test + ${selenium-server.version} + + + commons-logging + commons-logging + + + javax.servlet + javax.servlet-api + + + + + org.seleniumhq.selenium + selenium-leg-rc + test ${selenium-server.version} + + + org.testng + testng + + + javax.servlet + javax.servlet-api + + org.apache.commons @@ -96,29 +138,52 @@ org.seleniumhq.selenium htmlunit-driver - 2.24 + 2.26 + + org.seleniumhq.selenium + selenium-server + test + ${selenium-server.version} + + + commons-logging + commons-logging + + + javax.servlet + javax.servlet-api + + + org.fluentlenium - fluentlenium-festassert + fluentlenium-core ${fluentlenium.version} test - xerces - xercesImpl + org.fluentlenium + fluentlenium-festassert + ${fluentlenium.festassert.version} + test org.fluentlenium - fluentlenium-core + fluentlenium-junit ${fluentlenium.version} test + + xerces + xercesImpl + + jdom @@ -182,37 +247,6 @@ - - org.codehaus.mojo - selenium-maven-plugin - - - org.seleniumhq.selenium - selenium-server - ${selenium-server.version} - - - org.seleniumhq.selenium - selenium-remote-driver - ${selenium-server.version} - - - org.seleniumhq.selenium - selenium-api - ${selenium-server.version} - - - org.apache.commons - commons-exec - 1.3 - - - org.seleniumhq.selenium - htmlunit-driver - 2.24 - - - org.apache.rat apache-rat-plugin @@ -274,6 +308,7 @@ ${maxWaitTimeInMs} ${seleniumHost} ${seleniumPort} + ${seleniumRemote} ${tomcat.propertiesPortFilePath} @@ -439,38 +474,29 @@ - localhost - 4444 + false - - - - org.codehaus.mojo - selenium-maven-plugin - - - pre-integration-test - - start-server - - - true - ${seleniumPort} - true - - - - - - - firefox + htmlunit !browser + + *htmlunit + + + + + firefox + + + browser + firefox + + *firefox 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 4ed311db2..7f83b3464 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 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 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(); } } 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 deec6c0e2..5a020e265 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 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(); } } 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 3a886c7c4..a8403cd58 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 Emmanuel Venisse @@ -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(); } 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 000000000..c3ddc1a64 --- /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"); + } + + } +} 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 000000000..bed63bfa3 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/jetty/jetty-env.xml @@ -0,0 +1,48 @@ + + + + + + + + jdbc/users + + + database/users;create=true + sa + + + + + + + + mail/Session + + + + + localhost + + + + + + \ No newline at end of file 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 9294964db..dec6d75a8 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 @@ + + + diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 6d101a4a5..b88e7ba6e 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -717,6 +717,12 @@ org.apache.archiva.redback redback-rest-services + + + javax.servlet + javax.servlet-api + + org.apache.archiva.redback @@ -801,6 +807,12 @@ redback-rest-services tests test + + + javax.servlet + javax.servlet-api + + 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 000000000..1668649ca --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml @@ -0,0 +1,30 @@ + + + + + + + jdbc/users + + + database/users;create=true + sa + + + + + + + + mail/Session + + + + + localhost + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index f4f80dd05..8b1bad495 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ 4.4.4 1.4 9.4.5.v20170502 - 16.0.1 + 22.0 2.4.1 -- 2.39.5