[seam-commits] Seam SVN: r13238 - in branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking: src/org/jboss/seam/example/nestedbooking/test/selenium and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Jun 18 04:11:41 EDT 2010
Author: mgencur at redhat.com
Date: 2010-06-18 04:11:40 -0400 (Fri, 18 Jun 2010)
New Revision: 13238
Added:
branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/NestedConversationTest.java
Modified:
branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/jboss5.xml
branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/nestedbooking.properties
Log:
JBSEAM-4645, functional test for nested conversations of NestedBooking example
Modified: branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/jboss5.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/jboss5.xml 2010-06-18 06:14:19 UTC (rev 13237)
+++ branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/jboss5.xml 2010-06-18 08:11:40 UTC (rev 13238)
@@ -28,7 +28,9 @@
<class
name="org.jboss.seam.example.common.test.booking.selenium.BackButtonTest" />
<class
- name="org.jboss.seam.example.nestedbooking.test.selenium.NestedSimpleBookingTest"></class>
+ name="org.jboss.seam.example.nestedbooking.test.selenium.NestedSimpleBookingTest" />
+ <class
+ name="org.jboss.seam.example.nestedbooking.test.selenium.NestedConversationTest" />
</classes>
</test>
</suite>
\ No newline at end of file
Added: branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/NestedConversationTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/NestedConversationTest.java (rev 0)
+++ branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/NestedConversationTest.java 2010-06-18 08:11:40 UTC (rev 13238)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.example.nestedbooking.test.selenium;
+
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.fail;
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+import org.jboss.seam.example.common.test.selenium.SeamSelenium;
+import org.jboss.seam.example.common.test.booking.selenium.SeleniumBookingTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * This class alters behaviour of SimpleBookingTest to test nested conversations
+ *
+ * @author mgencur
+ */
+public class NestedConversationTest extends SeamSeleniumTest
+{
+
+ protected final int timeout = 5000;
+ protected final String CREDIT_CARD = "0123456789012345";
+ protected final String CREDIT_CARD_NAME = "visa";
+
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ }
+
+ @AfterMethod
+ public void tearDown()
+ {
+ super.tearDown();
+ }
+
+ @Test
+ public void nestedConversationTest()
+ {
+ browser.open(CONTEXT_PATH + getProperty("MAIN_PAGE"));
+ pause(timeout);
+ //browser.openWindow(CONTEXT_PATH + getProperty("MAIN_PAGE"), "0");
+ //pause(timeout);
+ browser.openWindow(CONTEXT_PATH + getProperty("MAIN_PAGE"), "0");
+ pause(timeout);
+ browser.selectWindow("0");
+ login("demo", "demo");
+ SeleniumBookingTest t = new SeleniumBookingTest();
+ t.enterSearchQuery("W Hotel");
+ browser.click(getProperty("SEARCH_RESULT_TABLE_SECOND_ROW_LINK"));
+ pause(timeout);
+
+ //open the url in a second window
+ String url = browser.getLocation();
+ browser.openWindow(url, "1");
+
+ //go next to confirm button in browser 1
+ browser.selectWindow("0");
+ browser.clickAndWait(getProperty("BOOKING_BOOK"));
+ browser.clickAndWait(getProperty("SELECT_ROOM_BUTTON"));
+ browser.clickAndWait(getProperty("SELECT_WONDERFUL_ROOM"));
+ browser.type(getProperty("PAYMENT_CREDIT_CARD"), CREDIT_CARD);
+ browser.type(getProperty("PAYMENT_CREDIT_CARD_NAME"), CREDIT_CARD_NAME);
+ browser.click(getProperty("PAYMENT_PROCEED"));
+
+ //go next to confirm button in browser 2
+ browser.selectWindow("1");
+ browser.clickAndWait(getProperty("BOOKING_BOOK"));
+ browser.clickAndWait(getProperty("SELECT_ROOM_BUTTON"));
+ browser.clickAndWait(getProperty("SELECT_FANTASTIC_ROOM"));
+ browser.type(getProperty("PAYMENT_CREDIT_CARD"), CREDIT_CARD);
+ browser.type(getProperty("PAYMENT_CREDIT_CARD_NAME"), CREDIT_CARD_NAME);
+ browser.click(getProperty("PAYMENT_PROCEED"));
+
+ //confirm in browser 1 (WONDERFUL room should be selected)
+ browser.selectWindow("0");
+ browser.clickAndWait(getProperty("CONFIRM_CONFIRM"));
+
+ assertTrue(browser.isTextPresent("$450.00") && browser.isTextPresent("Wonderful Room"));
+ assertFalse(browser.isTextPresent("$1,000.00") || browser.isTextPresent("Fantastic Suite"));
+ }
+
+ public void login(String username, String password)
+ {
+ browser.waitForPageToLoad(TIMEOUT);
+ browser.type(getProperty("LOGIN_USERNAME_FIELD"), username);
+ browser.type(getProperty("LOGIN_PASSWORD_FIELD"), password);
+ browser.click(getProperty("LOGIN_SUBMIT"));
+ browser.waitForPageToLoad(TIMEOUT);
+ }
+
+ private void pause(int millis)
+ {
+ try
+ {
+ Thread.sleep(millis);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+}
Modified: branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/nestedbooking.properties
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/nestedbooking.properties 2010-06-18 06:14:19 UTC (rev 13237)
+++ branches/community/Seam_2_2/src/test/ftest/examples/nestedbooking/src/org/jboss/seam/example/nestedbooking/test/selenium/nestedbooking.properties 2010-06-18 08:11:40 UTC (rev 13238)
@@ -39,6 +39,7 @@
NO_HOTELS_FOUND id=NoHotelsFoundMessage
SEARCH_RESULT_TABLE xpath=//table[@id = 'hotels']/tbody
SEARCH_RESULT_TABLE_FIRST_ROW_LINK id=hotels:0:viewHotel
+SEARCH_RESULT_TABLE_SECOND_ROW_LINK id=hotels:1:viewHotel
BOOKING_BOOK id=hotel:bookHotel
BOOKING_CANCEL id=hotel:cancel
BOOKING_SELECT_ROOM id=booking:room_preference
@@ -84,4 +85,8 @@
WORKSPACE_VIEW_TEXT View hotel: {0}
WORKSPACE_TABLE_LINK_BY_ID id=ConversationListForm:ConversationListDataTable:{0}:EntryDescriptionLink
WORKSPACE_TABLE_ROW_COUNT = //table[@id\='ConversationListForm\:ConversationListDataTable']/tbody/tr
-SPINNER id\=main\:SpinnerGif
\ No newline at end of file
+SPINNER id\=main\:SpinnerGif
+SELECT_ROOM_BUTTON id=booking:room_preference
+SELECT_WONDERFUL_ROOM id=room_selections_form:rooms:0:selectRoomPreference
+SELECT_FANTASTIC_ROOM id=room_selections_form:rooms:2:selectRoomPreference
+
More information about the seam-commits
mailing list