geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r673552 - in /geronimo/server/branches/2.1: ./ testsupport/testsupport-selenium/ testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/ testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/...
Date Thu, 03 Jul 2008 00:32:35 GMT
Author: dwoods
Date: Wed Jul  2 17:32:35 2008
New Revision: 673552

URL: http://svn.apache.org/viewvc?rev=673552&view=rev
Log:
Upgrade to selenium 1.0-beta-1 artifacts and the 1.0-beta-3 maven plugin.  Merge in code from
trunk to synchronize start/stop of SeleniumClient.

Modified:
    geronimo/server/branches/2.1/pom.xml
    geronimo/server/branches/2.1/testsupport/testsupport-selenium/pom.xml
    geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java
    geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/console/ConsoleTestSupport.java

Modified: geronimo/server/branches/2.1/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/pom.xml?rev=673552&r1=673551&r2=673552&view=diff
==============================================================================
--- geronimo/server/branches/2.1/pom.xml (original)
+++ geronimo/server/branches/2.1/pom.xml Wed Jul  2 17:32:35 2008
@@ -1926,7 +1926,7 @@
                 <plugin>
                     <groupId>org.codehaus.mojo</groupId>
                     <artifactId>selenium-maven-plugin</artifactId>
-                    <version>1.0-beta-2</version>
+                    <version>1.0-beta-3</version>
                 </plugin>
 
                 <plugin>

Modified: geronimo/server/branches/2.1/testsupport/testsupport-selenium/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsupport/testsupport-selenium/pom.xml?rev=673552&r1=673551&r2=673552&view=diff
==============================================================================
--- geronimo/server/branches/2.1/testsupport/testsupport-selenium/pom.xml (original)
+++ geronimo/server/branches/2.1/testsupport/testsupport-selenium/pom.xml Wed Jul  2 17:32:35
2008
@@ -25,7 +25,6 @@
         <groupId>org.apache.geronimo.testsupport</groupId>
         <artifactId>testsupport</artifactId>
         <version>2.1.2-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>testsupport-selenium</artifactId>
@@ -46,34 +45,47 @@
             <scope>compile</scope>
         </dependency>
         
-        <!-- selenium -->
         <dependency>
             <groupId>org.openqa.selenium.client-drivers</groupId>
             <artifactId>selenium-java-client-driver</artifactId>
-            <version>0.8.1</version>
+            <version>1.0-beta-1</version>
         </dependency>
+        
         <dependency>
             <groupId>org.openqa.selenium.server</groupId>
             <artifactId>selenium-server</artifactId>
-            <version>0.8.1</version>
+            <version>1.0-beta-1</version>
         </dependency>
+        
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <classifier>jdk15</classifier>
             <version>5.1</version>
+            <classifier>jdk15</classifier>
         </dependency>
     </dependencies>
 
-
     <!--
-    NOTE: This is needed to pull Selenium artifacts.
+    NOTE: These are needed to pull Selenium artifacts.
     -->
+    
     <repositories>
         <repository>
-            <id>openqa</id>
-            <name>OpenQA Repository</name>
-            <url>http://maven.openqa.org</url>
+            <id>releases.openqa.org</id>
+            <name>Openqa Release Repository</name>
+            <url>http://archiva.openqa.org/repository/releases</url>
+            <layout>default</layout>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+        </repository>
+        <repository>
+            <id>snapshots.openqa.org</id>
+            <name>Openqa Snapshot Repository</name>
+            <url>http://archiva.openqa.org/repository/snapshots</url>
             <layout>default</layout>
             <snapshots>
                 <enabled>true</enabled>
@@ -81,9 +93,9 @@
                 <checksumPolicy>ignore</checksumPolicy>
             </snapshots>
             <releases>
-                <enabled>true</enabled>
+                <enabled>false</enabled>
             </releases>
         </repository>
     </repositories>
     
-</project>
\ No newline at end of file
+</project>

Modified: geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java?rev=673552&r1=673551&r2=673552&view=diff
==============================================================================
--- geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java
(original)
+++ geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/SeleniumTestSupport.java
Wed Jul  2 17:32:35 2008
@@ -29,7 +29,7 @@
 import org.testng.annotations.AfterSuite;
 
 /**
- * ???
+ * Provides support for Selenium test cases.
  *
  * @version $Rev$ $Date$
  */
@@ -42,19 +42,29 @@
         super.setUp();
         
         if (url == null) {
-            url = "http://localhost:" + SeleniumServer.DEFAULT_PORT;
+            // url = "http://localhost:" + SeleniumServer.DEFAULT_PORT;
+            // post 1.0-beta-1 builds don't define DEFAULT_PORT
+            url = "http://localhost:4444";
         }
         
-        log.info("Creating Selenium client for URL: " + url);
+        String browser = System.getProperty("browser", "*firefox");
+
+        log.info("Creating Selenium client for URL: " + url + ", Browser: " + browser);
         
-        ExtendedSelenium selenium = new ExtendedSelenium(
-            "localhost", SeleniumServer.DEFAULT_PORT, "*firefox", url);
+        //ExtendedSelenium selenium = new ExtendedSelenium("localhost", SeleniumServer.DEFAULT_PORT,
"*firefox", url);
+        ExtendedSelenium selenium = new ExtendedSelenium("localhost", 4444, browser, url);
         
         return selenium;
     }
     
+    protected void ensureSeleniumClientInitialized() {
+        if (selenium == null) {
+            throw new IllegalStateException("Selenium client was not initalized");
+        }
+    }
+    
     @BeforeSuite
-    protected void startSeleniumClient() throws Exception {
+    protected synchronized void startSeleniumClient() throws Exception {
         log.info("Starting Selenium client");
         
         selenium = createSeleniumClient("http://localhost:8080/");
@@ -62,31 +72,18 @@
     }
     
     @AfterSuite
-    protected void stopSeleniumClient() throws Exception {
+    protected synchronized void stopSeleniumClient() throws Exception {
+        ensureSeleniumClientInitialized();
+        
         log.info("Stopping Selenium client");
         
         selenium.stop();
     }
-
-    /**
-     * junit's per class setup.
-     * 
-    protected void setUp() throws Exception {
-        log.info("Starting Selenium client");
-        
-        selenium = createSeleniumClient("http://localhost:8080/");
-        selenium.start();
-    }
-     */
     
-    /**
-     * junit's per class teardown.
-     * 
-    protected void tearDown() throws Exception {
-        log.info("Stopping Selenium client");
+    protected void waitForPageLoad() throws Exception {
+        ensureSeleniumClientInitialized();
         
-        selenium.stop();
+        selenium.waitForPageToLoad("30000");
     }
-     */
 }
 

Modified: geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/console/ConsoleTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/console/ConsoleTestSupport.java?rev=673552&r1=673551&r2=673552&view=diff
==============================================================================
--- geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/console/ConsoleTestSupport.java
(original)
+++ geronimo/server/branches/2.1/testsupport/testsupport-selenium/src/main/java/org/apache/geronimo/testsupport/console/ConsoleTestSupport.java
Wed Jul  2 17:32:35 2008
@@ -22,7 +22,7 @@
 import org.apache.geronimo.testsupport.SeleniumTestSupport;
 
 /**
- * ???
+ * Provides support for console-related tests.
  *
  * @version $Rev$ $Date$
  */
@@ -31,28 +31,26 @@
 {
     protected void login() throws Exception {
         selenium.open("/");
-        selenium.waitForPageToLoad("30000");
+        waitForPageLoad();
+        
         assertEquals("Apache Geronimo", selenium.getTitle());
         
         selenium.click("link=Console");
-        selenium.waitForPageToLoad("30000");
+        waitForPageLoad();
+        
         assertEquals("Geronimo Console Login", selenium.getTitle());
         
         selenium.type("j_username", "system");
         selenium.type("j_password", "manager");
         selenium.click("submit");
-        selenium.waitForPageToLoad("30000");
+        waitForPageLoad();
         assertEquals("Geronimo Console", selenium.getTitle());
     }
     
     protected void logout() throws Exception {
-        // log body for debugging purposes
-        if (!selenium.isElementPresent("//a[contains(@href, '/console/logout.jsp')]")) {
-            System.out.println(selenium.getBodyText());
-        }
-
         selenium.click("//a[contains(@href, '/console/logout.jsp')]");
-        selenium.waitForPageToLoad("30000");
+        waitForPageLoad();
+        
         assertEquals("Geronimo Console Login", selenium.getTitle());
         
         //selenium.removeCookie("JSESSIONID", "/");



Mime
View raw message