From: Martin Stockhammer Date: Sun, 11 Jun 2017 19:08:44 +0000 (+0200) Subject: Timeout fix for WebDriver test X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9e3a3c60af449cce45c8c3d4760ba1d5f3440b87;p=archiva.git Timeout fix for WebDriver test --- 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 7b034aa49..0f52af3b4 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 @@ -96,7 +96,7 @@ public class RepositoryAdminTest waitPage(); el = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("proxy-connector-edit-order-div"))); assertTextPresent( "internal" ); - List repos = el.findElements(By.xpath("./div")); + List repos = wait.until(ExpectedConditions.numberOfElementsToBe( By.xpath("//div[@id='proxy-connector-edit-order-div']/div"), 2)); Assert.assertTrue("First repo is myrepo", repos.get(0).getText().contains("myrepoid")); Assert.assertTrue("Second repo is central", repos.get(1).getText().contains("central")); 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 a1fbca3bf..6dbbb228d 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 @@ -120,18 +120,19 @@ public class WebdriverUtility } } + DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit(); + capabilities.setJavascriptEnabled( true ); + capabilities.setVersion( "firefox-52" ); + WebDriver driver; if ( seleniumRemote ) { - return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ), - DesiredCapabilities.htmlUnit() + driver = new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ), + capabilities ); } else { - DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit(); - capabilities.setJavascriptEnabled( true ); - capabilities.setVersion( "firefox-52" ); - HtmlUnitDriver driver = new HtmlUnitDriver( capabilities ) { + driver = new HtmlUnitDriver( capabilities ) { @Override protected WebClient modifyWebClient( WebClient client ) { @@ -141,8 +142,9 @@ public class WebdriverUtility return client; } }; - return driver; + } + return driver; } catch (MalformedURLException e) { throw new RuntimeException("Initializion of remote driver failed");