]> source.dussan.org Git - archiva.git/commitdiff
Timeout fix for WebDriver test
authorMartin Stockhammer <martin_s@apache.org>
Sun, 11 Jun 2017 19:08:44 +0000 (21:08 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 11 Jun 2017 19:08:44 +0000 (21:08 +0200)
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/RepositoryAdminTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java

index 7b034aa490167180c49532b702ab80fc89b7408a..0f52af3b4cf9f9d5a8b8658bc53589187b4fdad5 100644 (file)
@@ -96,7 +96,7 @@ public class RepositoryAdminTest
         waitPage();
         el = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("proxy-connector-edit-order-div")));
         assertTextPresent( "internal" );
-        List<WebElement> repos = el.findElements(By.xpath("./div"));
+        List<WebElement> 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"));
 
index a1fbca3bf0114d8abca3c3ab37c1c33224a8c800..6dbbb228d1b1be2dd86804ec052d07b403fbf47d 100644 (file)
@@ -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");