Package org.jboss.seam.example.common.test.selenium

Examples of org.jboss.seam.example.common.test.selenium.SeamSelenium


    * @return Modified SeamSelenium browser
    */
   @Override
   public SeamSelenium startBrowser()
   {
      SeamSelenium newBrowser = new SeamSelenium(HOST, PORT, BROWSER, BROWSER_URL)
      {
         /**
          * Wait until service says it is executing a request
          */
         @Override
         public void waitForAJAXUpdate(String timeout)
         {
            waitForCondition("selenium.browserbot.getCurrentWindow().selectedService.active===false", timeout);
            waitForElementContent(SeleniumValueRetriever.TEXTAREA, RESPONSE_AREA, "</env:Envelope>", timeout);
         };

         /**
          * Check typed result in the request field
          */
         @Override
         public void type(String locator, String value)
         {
            super.type(locator, value);
            waitForElementContent(SeleniumValueRetriever.TEXTAREA, REQUEST_AREA, value, TIMEOUT);
         }
      };
      newBrowser.start();
      newBrowser.allowNativeXpath("false");
      newBrowser.setSpeed(SPEED);
      newBrowser.setTimeout(TIMEOUT);
      return newBrowser;
   }
View Full Code Here


   {
      String firstBidderName = "honestjoe";
      String secondBidderName = "bidTester";
      String title = "Nikon D80 Digital Camera";

      SeamSelenium firstBrowser = browser;
      SeamSelenium secondBrowser = startBrowser();
      try
      {
         // register new user in first browser
         browser.clickAndWait(getProperty("REGISTRATION"));
         submitRegistrationForm(secondBidderName, "password", "password", "Slovakia");
         assertTrue("Creating new user failed.", isLoggedIn());
         // place a bid for a camera
         search(title);
         browser.clickAndWait(getProperty("SEARCH_RESULTS_FIRST_ROW_LINK"));
         placeBid("2000");
         // switch to second browser and place several bids
         browser = secondBrowser;
         browser.open(CONTEXT_PATH + getProperty("HOME_PAGE"));
         login();
         search(title);
         browser.clickAndWait(getProperty("SEARCH_RESULTS_FIRST_ROW_LINK"));
         for (int i = 1100; i < 2000; i += 200)
         {
            placeBid(String.valueOf(i));
            assertTrue("'You have been outbid' page expected.", browser.isElementPresent(getProperty("BID_OUTBID")));
         }
         placeBid("2200");
         assertFalse("Outbid unexpectedly", browser.isElementPresent(getProperty("BID_OUTBID")));
         assertEquals("High bidder not recognized.", firstBidderName, browser.getText(getProperty("BID_HIGH_BIDDER")));
         // switch to first browser again and place the highest bid again
         browser = firstBrowser;
         placeBid("2100");
         assertTrue("'You have been outbid' page expected.", browser.isElementPresent(getProperty("BID_OUTBID")));
         placeBid("2500");
         assertEquals("High bidder not recognized.", secondBidderName, browser.getText(getProperty("BID_HIGH_BIDDER")));
      }
      finally
      {
         browser = firstBrowser;
         secondBrowser.stop();
      }
   }
View Full Code Here

   /**
    * Create new browser instance.
    */
   public SeamSelenium startBrowser()
   {
      SeamSelenium newBrowser = new SeamSelenium(SELENIUM_HOST, SELENIUM_SERVER_PORT, SELENIUM_BROWSER, SELENIUM_BROWSER_URL);
      newBrowser.start();
      newBrowser.allowNativeXpath("false");
      newBrowser.setSpeed(SELENIUM_SPEED);
      newBrowser.setTimeout(SELENIUM_TIMEOUT);
      if (ICEFACES)
      {
         newBrowser.setIcefacesDetection(true);
      }
      newBrowser.setIcefacesWaitTime(SELENIUM_ICEFACES_WAIT_TIME);
      return newBrowser;
   }
View Full Code Here

   public void waitForAppToDeploy(String url, String element)
   {
      int step = 5000;
      int i = DEPLOY_TIMEOUT;

      SeamSelenium browser = startBrowser();

      browser.open(url);
      try
      {
         while (!browser.isElementPresent(element))
         {
            i -= step;
            if (i <= 0)
            {
               throw new RuntimeException("Timeout waiting for " + element + " at " + url);
            }
            Thread.sleep(step);
            browser.open(url); // try again
         }
      }
      catch (InterruptedException ie)
      {
         throw new RuntimeException(ie);
      }
      finally
      {
         browser.stop();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.seam.example.common.test.selenium.SeamSelenium

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.