<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>2.2.3-SNAPSHOT</version>
+ <version>2.2.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-webapp-test</artifactId>
<packaging>pom</packaging>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.24</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>16.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-chrome-driver</artifactId>
+ <version>${selenium-server.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-support</artifactId>
+ <version>${selenium-server.version}</version>
+ </dependency>
+
</dependencies>
</plugin>
<plugin>
</goals>
<configuration>
<tasks>
- <delete file="${user.home}/.m2/archiva.xml" quiet="true"/>
+ <delete file="${user.home}/.m2/archiva.xml" quiet="true" />
</tasks>
</configuration>
</execution>
fill( "#confirmPassword" ).with( p.getProperty( "ADMIN_PASSWORD" ) );
find( "#user-create-form-register-button" ).click();
- await().atMost( 2, TimeUnit.SECONDS ).until( "#logout-link" ).isPresent();
+ await().atMost( 10, TimeUnit.SECONDS ).until( "#logout-link" ).isPresent();
+ await().atMost( 10, TimeUnit.SECONDS ).until( "#footer-content" ).isPresent();
- FluentList<FluentWebElement> elementss = find( "#menu-find-browse-a" );
+ FluentList<FluentWebElement> elementss = find( "#menu-find-search-a" );
WebElement webElsement = elementss.get( 0 ).getElement();
webElsement.click();
- await().atMost( 2, TimeUnit.SECONDS ).until( "#main_browse_result" ).isPresent();
+ elementss = find( "#menu-find-browse-a" );
+ webElsement = elementss.get( 0 ).getElement();
+ webElsement.click();
+ await().atMost( 120, TimeUnit.SECONDS ).until( "#main_browse_result" ).isPresent();
// give me search page :( not browse page
takeScreenShot( "search.png" );
import org.apache.commons.io.FileUtils;
import org.fluentlenium.core.Fluent;
import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Olivier Lamy
public class WebDriverTest
extends FluentTest {
+ Logger logger = LoggerFactory.getLogger( WebDriverTest.class );
+
@Override
public Fluent 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) {
+ } catch (Throwable e) {
System.out.print(e.getMessage());
e.printStackTrace();
}
String seleniumHost = System.getProperty("seleniumHost", "localhost");
int seleniumPort = Integer.getInteger("seleniumPort", 4444);
try {
+ logger.info("Remote Web Driver: {}, {}", seleniumBrowser, seleniumPort);
if (StringUtils.contains(seleniumBrowser, "chrome")) {
return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"),
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
public abstract class AbstractSeleniumTest
{
+ final Logger logger = LoggerFactory.getLogger( AbstractSeleniumTest.class );
@Rule
public ArchivaSeleniumExecutionRule archivaSeleniumExecutionRule = new ArchivaSeleniumExecutionRule();
baseUrl = "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en";
+
open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs );
+ logger.info("Selected Browser: {}", browser);
archivaSeleniumExecutionRule.selenium = selenium;
assertAdminCreated();
}
File fileName = new File( targetPath, fileBaseName + ".png" );
- selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
+ try
+ {
+ selenium.captureEntirePageScreenshot( fileName.getAbsolutePath( ), "background=#FFFFFF" );
+ } catch (Throwable e) {
+ try
+ {
+ selenium.captureScreenshot( fileName.getAbsolutePath( ) );
+ } catch (Throwable e1) {
+ logger.error("Could not capture screenshot {}:", e1.getMessage(), e1);
+ }
+ }
return fileName.getAbsolutePath();
}