From 32acbe20f3be17af2e3ec02dee40345ecd5c61e9 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Fri, 30 Mar 2018 17:32:16 +0200 Subject: [PATCH] Adding Null checks for selenium --- .../archiva/web/test/parent/AbstractSeleniumTest.java | 8 ++++++-- .../web/test/tools/ArchivaSeleniumExecutionRule.java | 2 +- 2 files changed, 7 insertions(+), 3 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 082c4b373..48a1361c0 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 @@ -88,16 +88,20 @@ public abstract class AbstractSeleniumTest baseUrl = WebdriverUtility.getBaseUrl()+"/index.html?request_lang=en"; open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs, remoteSelenium ); + Assert.assertNotNull( getWebDriver() ); getWebDriver().manage().window().maximize(); assertAdminCreated(); } /** - * this method is called by the Rule after executing a tests + * this method is called by the Rule after executing a test */ public void close() { - getWebDriver().close(); + if (getWebDriver()!=null) + { + getWebDriver( ).close( ); + } } /** diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java index f8c107f51..b44b918ba 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java @@ -52,7 +52,7 @@ public class ArchivaSeleniumExecutionRule String fileName = ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(), target.getClass().getName() ); - + log.info("Screenshot: "+fileName); throw new RuntimeException( e.getMessage() + " see screenShot file:" + fileName, e ); } finally -- 2.39.5