{
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();
}
}