You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/02/08 03:08:49 UTC

svn commit: r619739 - /tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java

Author: hlship
Date: Thu Feb  7 18:08:46 2008
New Revision: 619739

URL: http://svn.apache.org/viewvc?rev=619739&view=rev
Log:
TAPESTRY-2027: AbstractIntegrationTestSuite does not allow custom selenium browser selection

Modified:
    tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java

Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java?rev=619739&r1=619738&r2=619739&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java (original)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java Thu Feb  7 18:08:46 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -47,6 +47,11 @@
     public static final String DEFAULT_WEB_APP_ROOT = "src/main/webapp";
 
     /**
+     * Default browser in which to run tests - firefox
+     */
+    public static final String DEFAULT_WEB_BROWSER_COMMAND = "*firefox";
+
+    /**
      * 15 seconds
      */
     public static final String PAGE_LOAD_TIMEOUT = "15000";
@@ -64,6 +69,8 @@
 
     private final String _webappRoot;
 
+    private final String _seleniumBrowserCommand;
+
     private JettyRunner _jettyRunner;
 
     private Selenium _selenium;
@@ -75,7 +82,7 @@
      */
     public AbstractIntegrationTestSuite()
     {
-        this(DEFAULT_WEB_APP_ROOT);
+        this(DEFAULT_WEB_APP_ROOT, DEFAULT_WEB_BROWSER_COMMAND);
     }
 
     /**
@@ -83,7 +90,18 @@
      */
     protected AbstractIntegrationTestSuite(String webAppRoot)
     {
+        this(webAppRoot, DEFAULT_WEB_BROWSER_COMMAND);
+    }
+
+    /**
+     * @param webAppRoot     web application root (default src/main/webapp)
+     * @param browserCommand browser command to pass to selenium. Default is *firefox, syntax for custom
+     *                       browsers is *custom <path_to_browser>, e.g. *custom /usr/lib/mozilla-firefox/firefox
+     */
+    protected AbstractIntegrationTestSuite(String webAppRoot, String browserCommand)
+    {
         _webappRoot = webAppRoot;
+        _seleniumBrowserCommand = browserCommand;
     }
 
     protected final void assertSourcePresent(String... expected)
@@ -190,7 +208,8 @@
 
         _server.start();
 
-        CommandProcessor cp = new HttpCommandProcessor("localhost", SeleniumServer.DEFAULT_PORT, "*firefox", BASE_URL);
+        CommandProcessor cp = new HttpCommandProcessor("localhost", SeleniumServer.DEFAULT_PORT,
+                                                       _seleniumBrowserCommand, BASE_URL);
 
         _selenium = new DefaultSelenium(new ErrorReportingCommandProcessor(cp));