Revision: 916
          http://jwebunit.svn.sourceforge.net/jwebunit/?rev=916&view=rev
Author:   henryju
Date:     2011-09-23 13:57:52 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
Deprecate gotoWindow(windowID) and fix gotoRootWindow().

Modified Paths:
--------------
    
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
    
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
    
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
    
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
    trunk/src/changes/changes.xml

Modified: 
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
===================================================================
--- 
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
 2011-09-22 09:18:05 UTC (rev 915)
+++ 
trunk/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/FramesAndWindowsTest.java
 2011-09-23 13:57:52 UTC (rev 916)
@@ -57,12 +57,6 @@
         assertTextPresent("child 1");
     }
     
-    @Test public void testGotoWindowByID() {
-        gotoRootAndOpenChild("ChildPage3");
-        gotoWindow(1);
-        assertTextPresent("child 3");
-    }
-
     @Test public void testGotoWindowByTitle() {
         gotoRootAndOpenChild("ChildPage2");
         gotoWindowByTitle("Child Page 2");
@@ -74,13 +68,6 @@
         assertPassFail("assertWindowPresentWithTitle", new Object[]{"Child 
Page 2"}, new Object[]{"NoSuchTitle"});
     }
 
-    @Test public void testSwitchWindows() {
-        gotoRootAndOpenChild("ChildPage1");
-        gotoWindow("ChildPage1");
-        gotoRootWindow();
-        assertTextPresent("This is the Root");
-    }
-
     @Test public void testCloseWindow() {
         beginAt("RootPage.html");
         assertTitleEquals("This is the Root");

Modified: 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
===================================================================
--- 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
  2011-09-22 09:18:05 UTC (rev 915)
+++ 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
  2011-09-23 13:57:52 UTC (rev 916)
@@ -130,18 +130,23 @@
      * Goto window with the given Javascript ID.
      * 
      * @param windowID Javascript ID of the window
+     * @deprecated Javascript ID does'nt not exists. Currently this is an index
+     * in the list of available windows, but this is not portable (and 
probably not stable).
+     * Use {@link #gotoWindow(String)} or {@link #gotoWindowByTitle(String)} 
instead.
      */
+    @Deprecated
     void gotoWindow(int windowID);
 
     /**
-     * Make the root window active.
+     * Make the root window active. Used to reset the effect of {@link 
ITestingEngine#gotoFrame(String)}.
+     * 
      */
     void gotoRootWindow();
 
     /**
-     * Get the number of openend Windows.
+     * Get the number of opened Windows.
      * 
-     * @return Number of openend Windows.
+     * @return Number of opened Windows.
      */
     int getWindowCount();
 

Modified: 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java
===================================================================
--- 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java 
    2011-09-22 09:18:05 UTC (rev 915)
+++ 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/junit/WebTester.java 
    2011-09-23 13:57:52 UTC (rev 916)
@@ -2984,14 +2984,18 @@
      * Make a given window active.
      *
      * @param windowID Javascript ID of the window
+     * @deprecated Javascript ID does'nt not exists. Currently this is an index
+     * in the list of available windows, but this is not portable (and 
probably not stable).
+     * Use {@link #gotoWindow(String)} or {@link #gotoWindowByTitle(String)} 
instead.
      */
+    @Deprecated
     public void gotoWindow(int windowID) {
         assertWindowPresent(windowID);
         getTestingEngine().gotoWindow(windowID);
     }
 
     /**
-     * Make the root window active.
+     * Make the root window active. Used to reset the effect of {@link 
ITestingEngine#gotoFrame(String)}.
      */
     public void gotoRootWindow() {
         getTestingEngine().gotoRootWindow();

Modified: 
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
===================================================================
--- 
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
       2011-09-22 09:18:05 UTC (rev 915)
+++ 
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
       2011-09-23 13:57:52 UTC (rev 916)
@@ -2192,10 +2192,10 @@
     }
 
     /**
-     * Make the root window in the current conversation active.
+     * {@inheritDoc}
      */
     public void gotoRootWindow() {
-        setMainWindow((WebWindow) wc.getWebWindows().get(0));
+        win = win.getTopWindow();
     }
 
     private void setMainWindow(WebWindow win) {

Modified: trunk/src/changes/changes.xml
===================================================================
--- trunk/src/changes/changes.xml       2011-09-22 09:18:05 UTC (rev 915)
+++ trunk/src/changes/changes.xml       2011-09-23 13:57:52 UTC (rev 916)
@@ -30,6 +30,14 @@
         </author>
     </properties>
     <body>
+        <release version="3.1" date="UNKNOW" description="Cleanup for 
Webdriver integration">
+            <action type="update" dev="henryju">
+                gotoRootWindow() now goes to the root "frame" in a multi-frame 
window. Previously it was only by chance.
+            </action>
+            <action type="update" dev="henryju">
+                Deprecated gotoWindow(windowID) method as implementation is 
not stable and window ID is not something well-defined.
+            </action>
+        </release>
         <release version="3.0.1" date="UNKNOW" description="Minor fixes">
             <action type="fix" dev="henryju" issue="3395872" due-to="Tim 
Pizey">
                 HtmlUnitTestingEngineImpl.gotoPage no longer returns the 
failing status. Broken since 2.5 after applying

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
JWebUnit-development mailing list
JWebUnit-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to