]> source.dussan.org Git - archiva.git/commitdiff
Fixing maven config for remote selenium server
authorMartin Stockhammer <martin_s@apache.org>
Fri, 9 Jun 2017 20:24:54 +0000 (22:24 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Fri, 9 Jun 2017 20:24:54 +0000 (22:24 +0200)
archiva-modules/archiva-web/archiva-webapp-test/pom.xml
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java

index a5239a66deeeee7d041c5b37bfc4a618167b93f1..40eb946be93083ed160c91d99940cb51635d6409 100644 (file)
@@ -36,8 +36,7 @@
     <selenium-server.version>3.4.0</selenium-server.version>
     <fluentlenium.version>3.2.0</fluentlenium.version>
     <fluentlenium.festassert.version>0.13.2</fluentlenium.festassert.version>
-    <seleniumHost></seleniumHost>
-    <seleniumPort></seleniumPort>
+
 
     <browserPath></browserPath>
   </properties>
                 <maxWaitTimeInMs>${maxWaitTimeInMs}</maxWaitTimeInMs>
                 <seleniumHost>${seleniumHost}</seleniumHost>
                 <seleniumPort>${seleniumPort}</seleniumPort>
+                <seleniumRemote>${seleniumRemote}</seleniumRemote>
                 <container.propertiesPortFilePath>${container.propertiesPortFilePath}</container.propertiesPortFilePath>
                 <container.http.port>${container.http.port}</container.http.port>
               </systemPropertyVariables>
       </properties>
     </profile>
 
+
+    <profile>
+      <id>seleniumHost</id>
+      <activation>
+        <property>
+          <name>!seleniumHost</name>
+        </property>
+      </activation>
+      <properties>
+        <seleniumHost>localhost</seleniumHost>
+      </properties>
+    </profile>
+    <profile>
+      <id>seleniumPort</id>
+      <activation>
+        <property>
+          <name>!seleniumPort</name>
+        </property>
+      </activation>
+      <properties>
+        <seleniumPort></seleniumPort>
+      </properties>
+    </profile>
+    <profile>
+      <id>seleniumRemote</id>
+      <activation>
+        <property>
+          <name>!seleniumRemote</name>
+        </property>
+      </activation>
+      <properties>
+        <seleniumRemote>false</seleniumRemote>
+      </properties>
+    </profile>
+
     <profile>
       <id>htmlunit</id>
       <activation>
index 698d6a045c7435323a6ecf1500e7bf2fc21006ee..2cfe0705cd74156439934d79cc2f933b2176a867 100644 (file)
@@ -59,7 +59,7 @@ public abstract class AbstractSeleniumTest
     public String browser = System.getProperty( "browser" );
 
     public String baseUrl =
-        "http://localhost:" + System.getProperty( "tomcat.maven.http.port" ) + "/archiva/index.html?request_lang=en";
+        "http://localhost:" + System.getProperty( "container.http.port" ) + "/archiva/index.html?request_lang=en";
 
     public int maxWaitTimeInMs = Integer.getInteger( "maxWaitTimeInMs" );
 
@@ -67,7 +67,7 @@ public abstract class AbstractSeleniumTest
 
     public int seleniumPort = Integer.getInteger( "seleniumPort", 4444 );
 
-    public boolean remoteSelenium = Boolean.parseBoolean( System.getProperty( "remoteSelenium", "false" ) );
+    public boolean remoteSelenium = Boolean.parseBoolean( System.getProperty( "seleniumRemote", "false" ) );
 
     WebDriver webDriver = null;
 
index 0f3af86bbad94eca705b24409ba485658d5c44c4..12546c340e6d1621d75aaa7bf3f4424d30999681 100644 (file)
@@ -62,6 +62,10 @@ public class WebdriverUtility
     }
 
     public static WebDriver newWebDriver(String seleniumBrowser, String seleniumHost, int seleniumPort, boolean seleniumRemote) {
+        log.info("WebDriver {}, {}, {}, {}", seleniumBrowser, seleniumHost, seleniumPort, seleniumRemote);
+        if (seleniumRemote && StringUtils.isEmpty( seleniumHost )) {
+            throw new IllegalArgumentException( "seleniumHost must be set, when seleniumRemote=true" );
+        }
         try {
 
             if ( StringUtils.contains(seleniumBrowser, "chrome")) {