[seam-commits] Seam SVN: r11554 - branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Oct 7 10:37:24 EDT 2009
Author: mgencur at redhat.com
Date: 2009-10-07 10:37:23 -0400 (Wed, 07 Oct 2009)
New Revision: 11554
Modified:
branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/WicketSimpleBookingTest.java
branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/wicket.properties
Log:
Fix of functional test for wicket example
Modified: branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/WicketSimpleBookingTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/WicketSimpleBookingTest.java 2009-10-07 12:59:16 UTC (rev 11553)
+++ branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/WicketSimpleBookingTest.java 2009-10-07 14:37:23 UTC (rev 11554)
@@ -21,6 +21,11 @@
*/
package org.jboss.seam.example.wicket.test.selenium;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.fail;
+
+import java.text.MessageFormat;
+
import org.jboss.seam.example.common.test.booking.selenium.SimpleBookingTest;
/**
@@ -39,4 +44,34 @@
"index=1");
browser.select(getProperty("HOTEL_CREDIT_CARD_EXPIRY_YEAR"), "index=1");
}
+
+ @Override
+ protected int bookHotel(String hotelName, int bed, int smoking,
+ String creditCard, String creditCardName) {
+ if (!isLoggedIn())
+ fail();
+ if (!browser.isElementPresent(getProperty("SEARCH_SUBMIT"))) {
+ browser.open(CONTEXT_PATH + getProperty("MAIN_PAGE"));
+ browser.waitForPageToLoad(TIMEOUT);
+ }
+ enterSearchQuery(hotelName);
+ browser.click(getProperty("SEARCH_RESULT_TABLE_FIRST_ROW_LINK"));
+ browser.waitForPageToLoad(TIMEOUT);
+ // booking page
+ browser.click(getProperty("BOOKING_BOOK"));
+ browser.waitForPageToLoad(TIMEOUT);
+ // hotel page
+ populateBookingFields(bed, smoking, creditCard, creditCardName);
+ browser.click(getProperty("HOTEL_PROCEED"));
+ browser.waitForPageToLoad(TIMEOUT);
+ // confirm page
+ browser.click(getProperty("HOTEL_CONFIRM"));
+ browser.waitForPageToLoad(TIMEOUT);
+ // main page
+ String message = browser.getText(MessageFormat.format(getProperty("ORDER_CONFIRMATION_NUMBER"), hotelName));
+
+ int confirmationNumber = Integer.parseInt(message);
+ return confirmationNumber;
+ }
+
}
Modified: branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/wicket.properties
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/wicket.properties 2009-10-07 12:59:16 UTC (rev 11553)
+++ branches/community/Seam_2_2/src/test/ftest/examples/wicket/src/org/jboss/seam/example/wicket/test/selenium/wicket.properties 2009-10-07 14:37:23 UTC (rev 11554)
@@ -47,12 +47,12 @@
HOTEL_CHECKIN_DATE_MESSAGE xpath=//span[@id='message']//span
HOTEL_CHECKOUT_DATE_FIELD identifier=checkoutDateBorder:checkoutDate:date
HOTEL_CHECKOUT_DATE_MESSAGE xpath=//span[@id='message']//span
-HOTEL_SMOKING_1 id=smokingBorder:smoking_true
-HOTEL_SMOKING_2 id=smokingBorder:smoking_false
+HOTEL_SMOKING_1 xpath\=//span[@id\='smoking']/input[@value\='true']
+HOTEL_SMOKING_2 xpath\=//span[@id\='smoking']/input[@value\='false']
HOTEL_CREDIT_CARD identifier=creditCardBorder:creditCard
HOTEL_CREDIT_CARD_NAME identifier=creditCardNameBorder:creditCardName
-HOTEL_CREDIT_CARD_EXPIRY_MONTH identifier=creditCardExpiryBorder:creditCardExpiryMonth
-HOTEL_CREDIT_CARD_EXPIRY_YEAR identifier=creditCardExpiryBorder:creditCardExpiryYear
+HOTEL_CREDIT_CARD_EXPIRY_MONTH xpath\=//select[contains(@id,'creditCardExpiryMonth')]
+HOTEL_CREDIT_CARD_EXPIRY_YEAR xpath\=//select[contains(@id,'creditCardExpiryYear')]
HOTEL_PROCEED id=proceed
HOTEL_CANCEL id=cancel
HOTEL_CONFIRM id=confirm
@@ -82,4 +82,5 @@
SPINNER xpath=//span[contains(@id, 'ajax-indicator')]
# ajax is used in wicket example but search button has to be clicked
USE_AJAX_SEARCH TRUE
-USE_SEARCH_BUTTON TRUE
\ No newline at end of file
+USE_SEARCH_BUTTON TRUE
+ORDER_CONFIRMATION_NUMBER=xpath\=//table[@id\="bookings"]/tbody/tr[normalize-space(td[1]/span/text()) \= "{0}"]/td[6]/span
More information about the seam-commits
mailing list