]> source.dussan.org Git - archiva.git/commitdiff
Trying to stabilize htmlunit tests
authorMartin Stockhammer <martin_s@apache.org>
Sun, 11 Jun 2017 20:40:32 +0000 (22:40 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 11 Jun 2017 20:40:32 +0000 (22:40 +0200)
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java

index 44907ab2e176a29cdbdb5bf05412298d2b65a723..66696bc2ecdc0c0f54b8b643ba458da9b303f260 100644 (file)
@@ -116,11 +116,11 @@ public abstract class AbstractArchivaTest
 
         el.click();
 
-        wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("user-messages"),"User " + userName + " created." ));
-        assertElementPresent( "users-grid-user-id-" + userName );
-
         if ( valid )
         {
+            wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("user-messages"),"User " + userName + " created." ));
+            wait.until(ExpectedConditions.visibilityOfElementLocated( By.id("users-grid-user-id-" + userName) ));
+
             //String[] columnValues = { userName, fullName, emailAd };
             //assertElementPresent( XPathExpressionUtil.getTableRow( columnValues ) );
 
index b6741b19b3ceeef941c3ab5249c08fd988588383..4d51fa270c9d44cff5a31f0bbe0d3c1c46591579 100644 (file)
@@ -647,8 +647,14 @@ public abstract class AbstractSeleniumTest
             } catch (Exception e) {
                 logger.info("Error: {}, {}, {}",count,e.getClass().getName(), e.getMessage());
                 if (el!=null) {
-                    Point elLoc = el.getLocation();
-                    logger.info("Location: x={} y={}", elLoc.getX(), elLoc.getY());
+                    // Elements may be stale and throw an exception, if the location is requested
+                    try
+                    {
+                        Point elLoc = el.getLocation();
+                        logger.info( "Location: x={} y={}", elLoc.getX(), elLoc.getY() );
+                    } catch (Throwable e2) {
+                        logger.info("Could not determine location");
+                    }
                 }
                 ex = e;
                 count--;