Author: jharting
Date: 2011-02-16 05:09:15 -0500 (Wed, 16 Feb 2011)
New Revision: 14048
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java
Log:
JBPAPP-5057
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java 2011-02-15
23:17:51 UTC (rev 14047)
+++
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java 2011-02-16
10:09:15 UTC (rev 14048)
@@ -26,7 +26,6 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.fail;
-import org.jboss.seam.example.common.test.selenium.SeamSelenium;
import org.testng.annotations.Test;
/**
@@ -60,46 +59,46 @@
{
String firstBidderName = "honestjoe";
String secondBidderName = "bidTester";
+ String secondBidderPassword = "password";
String title = "Nikon D80 Digital Camera";
- SeamSelenium firstBrowser = browser;
- SeamSelenium secondBrowser = startBrowser();
- try
+ /*
+ * Second user registers, logs in and places a bid
+ */
+ browser.clickAndWait(getProperty("REGISTRATION"));
+ submitRegistrationForm(secondBidderName, secondBidderPassword,
secondBidderPassword, "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");
+ logout();
+ /*
+ * First user logs in and places several bids
+ */
+ 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)
{
- // 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");
+ placeBid(String.valueOf(i));
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();
- }
+ placeBid("2200");
+ assertFalse("Outbid unexpectedly",
browser.isElementPresent(getProperty("BID_OUTBID")));
+ assertEquals("High bidder not recognized.", firstBidderName,
browser.getText(getProperty("BID_HIGH_BIDDER")));
+ logout();
+ /*
+ * Switch to the second user again and place the highest bid again
+ */
+ login(secondBidderName, secondBidderPassword);
+ search(title);
+ browser.clickAndWait(getProperty("SEARCH_RESULTS_FIRST_ROW_LINK"));
+ 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")));
}
public void placeBid(String price)
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java 2011-02-15
23:17:51 UTC (rev 14047)
+++
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java 2011-02-16
10:09:15 UTC (rev 14048)
@@ -67,6 +67,11 @@
{
return browser.isElementPresent(getProperty("LOGOUT"));
}
+
+ public void logout()
+ {
+ browser.clickAndWait(getProperty("LOGOUT"));
+ }
public void submitRegistrationForm(String username, String password, String verify,
String location)
{
Show replies by date