From 0643a0fb3f08fe80f2a5317569dc17108ca1d6ca Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sat, 10 Jun 2017 00:20:04 +0200 Subject: [PATCH] Trying additional fix for chrome WebDriver --- .../web/test/parent/AbstractSeleniumTest.java | 16 +++++++++++++--- src/ci/docker/webtest/Dockerfile | 4 ++-- src/ci/scripts/container_webtest.sh | 3 +++ 3 files changed, 18 insertions(+), 5 deletions(-) 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 40d3f9852..df0c09ddb 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 @@ -37,6 +37,7 @@ import java.util.function.Function; import org.openqa.selenium.*; import org.openqa.selenium.htmlunit.HtmlUnitDriver; +import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.FluentWait; import org.openqa.selenium.support.ui.Select; @@ -626,16 +627,24 @@ public abstract class AbstractSeleniumTest WebDriverWait wait = new WebDriverWait( getWebDriver(), maxWaitTimeInS ); V result = null; Exception ex = null; + WebElement el = null; while(count>0) { try { - WebElement el = wait.until(ExpectedConditions.elementToBeClickable( clickableLocator )); + el = wait.until(ExpectedConditions.elementToBeClickable( clickableLocator )); + Actions actions = new Actions(getWebDriver()); + actions.moveToElement(el); + actions.perform(); el.click(); result = wait.until( conditions ); - count=0; - ex = null; + return result; } 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()); + } ex = e; count--; } @@ -694,6 +703,7 @@ public abstract class AbstractSeleniumTest result = wait.until( conditions ); return result; } catch (Exception e) { + logger.info("Error: {}, {}",count, e.getMessage()); ex = e; count--; } diff --git a/src/ci/docker/webtest/Dockerfile b/src/ci/docker/webtest/Dockerfile index b4c416f40..8a7c2d0a4 100644 --- a/src/ci/docker/webtest/Dockerfile +++ b/src/ci/docker/webtest/Dockerfile @@ -65,8 +65,8 @@ COPY chrome_launcher.sh /usr/bin/google-chrome RUN chmod +x /opt/bin/entry_point.sh RUN chmod +x /usr/bin/google-chrome -ENV SCREEN_WIDTH 1360 -ENV SCREEN_HEIGHT 1020 +ENV SCREEN_WIDTH 1600 +ENV SCREEN_HEIGHT 1200 ENV SCREEN_DEPTH 24 ENV X_START_NUM=3 diff --git a/src/ci/scripts/container_webtest.sh b/src/ci/scripts/container_webtest.sh index e06d5d299..fbd2c1a12 100644 --- a/src/ci/scripts/container_webtest.sh +++ b/src/ci/scripts/container_webtest.sh @@ -33,6 +33,9 @@ INSTANCE_NAME="archiva-webtest" PORT_MAPPING="4444:4444" NETWORK_TYPE="host" +export SCREEN_WIDTH="1600" +export SCREEN_HEIGHT="1200" + HERE=`dirname $0` TAG="${CONTAINER_NAME}:${CONTAINER_VERSION}" -- 2.39.5