[seam-commits] Seam SVN: r11618 - in branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test: selenium and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Oct 30 06:14:37 EDT 2009


Author: kpiwko at redhat.com
Date: 2009-10-30 06:14:37 -0400 (Fri, 30 Oct 2009)
New Revision: 11618

Modified:
   branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/booking/selenium/ConversationTest.java
   branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
Log:
JBQA-2764

Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/booking/selenium/ConversationTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/booking/selenium/ConversationTest.java	2009-10-26 09:22:05 UTC (rev 11617)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/booking/selenium/ConversationTest.java	2009-10-30 10:14:37 UTC (rev 11618)
@@ -48,8 +48,6 @@
         browser.openWindow(CONTEXT_PATH + getProperty("MAIN_PAGE"), "1");
         browser.openWindow(CONTEXT_PATH + getProperty("MAIN_PAGE"), "2");
         browser.selectWindow("1");
-        browser.refresh();
-        browser.waitForPageToLoad(TIMEOUT);
         if (!isLoggedIn()) {
             login();
         }
@@ -67,8 +65,6 @@
         browser.waitForPageToLoad(TIMEOUT);
         // Reload window 1 to check whether both workspaces are displayed
         browser.selectWindow("1");
-        browser.refresh();
-        browser.waitForPageToLoad(TIMEOUT);
         assertEquals("#1 workspace not present in workspace table",
                 MessageFormat.format(getProperty("WORKSPACE_BOOKING_TEXT"),
                         hotel1), browser.getText(MessageFormat.format(
@@ -92,8 +88,6 @@
         browser.waitForPageToLoad(TIMEOUT);
         // Second workspace should disappear
         browser.selectWindow("1");
-        browser.refresh();
-        browser.waitForPageToLoad(TIMEOUT);
         assertEquals("Workspace failure.", 1, browser
                 .getXpathCount(getProperty("WORKSPACE_TABLE_ROW_COUNT")));
     }

Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java	2009-10-26 09:22:05 UTC (rev 11617)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java	2009-10-30 10:14:37 UTC (rev 11618)
@@ -36,20 +36,20 @@
  */
 public class SeamSelenium extends DefaultSelenium
 {
-
+   
    private String timeout = "30000";
    private boolean icefacesDetection = false;
    private long icefacesWaitTime = 1000;
    private long windowMaximizeWaitTime = 5000L;
-
+   
    private final String ICEFACES_CONNECTION_STATUS = "xpath=//div[@class='iceOutConStat connectionStatus']";
    private final String ICEFACES_IDLE_VISIBLE = "xpath=//div[@class='iceOutConStatInactv connectionStatusInactv'][@style='visibility: visible;']";
-
+   
    public SeamSelenium(String serverHost, int serverPort, String browserStartCommand, String browserURL)
    {
       super(serverHost, serverPort, browserStartCommand, browserURL);
    }
-
+   
    /**
     * Same as click method but waits for page to load after clicking. Default
     * timeout can be changed by setTimeout() method.
@@ -61,7 +61,7 @@
       click(locator);
       waitForPageToLoad();
    }
-
+   
    /**
     * Simulates a user pressing "back" button and waits for page to load.
     * Default timeout can be changed by setTimeout() method.
@@ -71,7 +71,7 @@
       super.goBack();
       super.waitForPageToLoad(timeout);
    }
-
+   
    /**
     * Simulates a user pressing "refresh" button and waits for page to load.
     * Default timeout can be changed by setTimeout() method.
@@ -81,25 +81,25 @@
       super.refresh();
       super.waitForPageToLoad(timeout);
    }
-
+   
    @Override
    public void setTimeout(String timeout)
    {
       super.setTimeout(timeout);
       this.timeout = timeout;
    }
-
+   
    public String getTimeout()
    {
       return timeout;
    }
-
+   
    public void waitForPageToLoad()
    {
-
+      
       waitForPageToLoad(timeout);
    }
-
+   
    @Override
    public void waitForPageToLoad(String timeout)
    {
@@ -112,23 +112,26 @@
          super.waitForPageToLoad(timeout);
       }
    }
-
+   
    /**
     * Waits until element is asynchronously loaded on page. Uses global Selenium
     * timeout
     * 
-    * @param locator Locator of element
+    * @param locator
+    *           Locator of element
     */
    public void waitForElement(final String locator)
    {
       waitForElement(locator, Long.valueOf(timeout));
    }
-
+   
    /**
     * Waits until element is asynchronously loaded on page.
     * 
-    * @param timeout Timeout in milliseconds
-    * @param locator Locator of element
+    * @param timeout
+    *           Timeout in milliseconds
+    * @param locator
+    *           Locator of element
     */
    public void waitForElement(final String locator, long timeout)
    {
@@ -145,8 +148,10 @@
    /**
     * Waits until element is asynchronously unloaded from page.
     * 
-    * @param timeout Timeout in milliseconds
-    * @param locator Locator of element
+    * @param timeout
+    *           Timeout in milliseconds
+    * @param locator
+    *           Locator of element
     */
    public void waitForElementNotPresent(final String locator, long timeout)
    {
@@ -159,15 +164,29 @@
          }
       }.wait("Timeout while waiting for asynchronous update of " + locator, timeout);
    }
-
+   
    /**
+    * Selects windows by its id. Waits until windows is refreshed.
+    * 
+    * @param windowID
+    *           Identification of window which is selected
+    */
+   @Override
+   public void selectWindow(String windowID)
+   {
+      super.selectWindow(windowID);
+      refresh();
+      waitForPageToLoad();
+   }
+   
+   /**
     * Returns true if icefaces detection is turned on
     */
    public boolean isIcefacesDetection()
    {
       return icefacesDetection;
    }
-
+   
    /**
     * Switch icefaces detection on/off
     * 
@@ -177,7 +196,7 @@
    {
       this.icefacesDetection = icefacesDetection;
    }
-
+   
    /**
     * This wait time will be used when waiting for response after invoking
     * icefaces action
@@ -186,7 +205,7 @@
    {
       return icefacesWaitTime;
    }
-
+   
    /**
     * This wait time will be used when waiting for response after invoking
     * icefaces action
@@ -197,7 +216,7 @@
    {
       this.icefacesWaitTime = icefacesWaitTime;
    }
-
+   
    /**
     * Captures a screenshot and stores it into a file. Active windows is
     * maximized before capturing a screenshot.
@@ -215,7 +234,7 @@
       }
       super.captureScreenshot(path);
    }
-
+   
    /**
     * Logs HTML body into a file.
     * 
@@ -246,7 +265,7 @@
          }
       }
    }
-
+   
    private void waitForIcefaces(Long waitTime, Long timeout)
    {
       new Wait()



More information about the seam-commits mailing list