Seam SVN: r11508 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore: src/org/jboss/seam/example/dvd/test/selenium and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-23 02:53:25 -0400 (Wed, 23 Sep 2009)
New Revision: 11508
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/jboss.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ShoppingCartTest.java
Log:
JBPAPP-2829 Backported new version of functional test files
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml 2009-09-22 13:53:09 UTC (rev 11507)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml 2009-09-23 06:53:25 UTC (rev 11508)
@@ -22,7 +22,7 @@
-->
<project name="dvdstore.ftest.build" basedir="." default="build">
<property name="example.name" value="dvdstore" />
- <property name="jboss.example.ready.check.url" value="seam-dvd/search.seam" />
+ <property name="jboss.example.ready.check.url" value="seam-dvd" />
<import file="../build.xml" />
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/jboss.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/jboss.xml 2009-09-22 13:53:09 UTC (rev 11507)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/jboss.xml 2009-09-23 06:53:25 UTC (rev 11508)
@@ -28,11 +28,11 @@
<classes>
<class
name="org.jboss.seam.example.dvd.test.selenium.LoginTest" />
-<!-- <class name="org.jboss.seam.example.dvd.test.selenium.RegistrationTest" />-->
+ <class name="org.jboss.seam.example.dvd.test.selenium.RegistrationTest" />
<class
name="org.jboss.seam.example.dvd.test.selenium.SearchTest" />
<class
name="org.jboss.seam.example.dvd.test.selenium.ShoppingCartTest" />
</classes>
</test>
-</suite>
\ No newline at end of file
+</suite>
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ShoppingCartTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ShoppingCartTest.java 2009-09-22 13:53:09 UTC (rev 11507)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ShoppingCartTest.java 2009-09-23 06:53:25 UTC (rev 11508)
@@ -27,9 +27,6 @@
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.text.ParseException;
-import java.util.Currency;
-import java.util.Locale;
-
import org.testng.annotations.Test;
/**
@@ -40,6 +37,8 @@
*
*/
public class ShoppingCartTest extends SeleniumDvdTest {
+
+ private NumberFormat nf = NumberFormat.getNumberInstance();
@Test(dependsOnGroups = { "search" })
public void simpleCartTest() {
@@ -60,8 +59,6 @@
@Test(dependsOnMethods = { "simpleCartTest" })
public void testCartCostCalculation() throws ParseException {
String[] dvds = new String[] { "Top Gun", "Pulp Fiction", "Top Gun" };
- NumberFormat nf = NumberFormat.getCurrencyInstance();
- nf.setCurrency(Currency.getInstance(Locale.US));
BigDecimal expectedSum = BigDecimal.ZERO;
for (String dvd : dvds) {
addDVDToCart(dvd);
@@ -72,18 +69,14 @@
.intValue();
assertNotSame("Cart should not be empty.", 0, items);
for (int i = 0; i < items; i++) {
- BigDecimal quantity = BigDecimal.valueOf(Double.parseDouble(browser
- .getValue(MessageFormat.format(
- getProperty("CART_TABLE_QUANTITY_BY_ID"), i))));
- BigDecimal price = BigDecimal.valueOf(nf.parse(
- browser.getText(MessageFormat.format(
- getProperty("CART_TABLE_PRICE_BY_ID"), i)))
- .doubleValue());
+ BigDecimal quantity = parseBalance(browser.getValue(MessageFormat.format(
+ getProperty("CART_TABLE_QUANTITY_BY_ID"), i)));
+ BigDecimal price = parseBalance(browser.getText(MessageFormat.format(
+ getProperty("CART_TABLE_PRICE_BY_ID"), i)));
BigDecimal priceForCurrentRow = price.multiply(quantity);
expectedSum = expectedSum.add(priceForCurrentRow);
}
- BigDecimal actualSum = BigDecimal.valueOf((nf.parse(browser
- .getText(getProperty("CART_SUBTOTAL"))).doubleValue()));
+ BigDecimal actualSum = parseBalance(browser.getText(getProperty("CART_SUBTOTAL")));
assertEquals("Price sum in cart is incorrect.", 0, expectedSum
.compareTo(actualSum));
}
@@ -144,4 +137,9 @@
browser.click(getProperty("SEARCH_RESULT_UPDATE_BUTTON"));
browser.waitForPageToLoad(TIMEOUT);
}
+
+ private BigDecimal parseBalance(String text) throws ParseException {
+ String number = text.replaceAll("\\$", "").trim();
+ return BigDecimal.valueOf(nf.parse(number).doubleValue());
+ }
}
15 years, 3 months
Seam SVN: r11507 - branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-22 09:53:09 -0400 (Tue, 22 Sep 2009)
New Revision: 11507
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/readme.txt
Log:
JBPAPP-2829 Readme file updated
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/readme.txt
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/readme.txt 2009-09-22 11:00:10 UTC (rev 11506)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/readme.txt 2009-09-22 13:53:09 UTC (rev 11507)
@@ -54,14 +54,14 @@
2.) Check setup in ../ftest.properties
a) check that selenium.browser property is set to your desired browser
- b) check that container property is set to either jboss4 or jboss5
- c) check that jboss*.deploy.waittime is set to sensible value
- d) check that jboss*.home points to the location of your application server
- e) check that seamgen.delete.project property is set to true if you want the generated applications
+ b) check that jboss*.deploy.waittime is set to sensible value
+ c) check that jboss*.home points to the location of your application server
+ d) check that seamgen.delete.project property is set to true if you want the generated applications
to be deleted immediately after testrun
- f) check that workspace.home property points to a folder where generated applications should be stored temporarily
- g) check that seam-gen project properties (at the end of ftest.properties) are set correctly.
+ e) check that workspace.home property points to a folder where generated applications should be stored temporarily
+ f) check that seam-gen project properties (at the end of ftest.properties) are set correctly.
Pay special attention to database connection related properties (Configure to use MySQL with exported tables).
+ g) copy mysql connector jar file to jboss_as/server/xx/lib where xx is configuration (default, production, ...) chosen for deploying the artifacts
3.) Start application server. Make sure there are no application deployed from previous test run.
#TODO automate this step
15 years, 3 months
Seam SVN: r11506 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay: src/org/jboss/seam/example/seambay/test/selenium and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-22 07:00:10 -0400 (Tue, 22 Sep 2009)
New Revision: 11506
Added:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/jboss.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
Log:
JBPAPP-2829 Backported a functional test for web service test page of seambay example
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/jboss.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/jboss.xml 2009-09-22 06:30:02 UTC (rev 11505)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/jboss.xml 2009-09-22 11:00:10 UTC (rev 11506)
@@ -29,6 +29,7 @@
<class name="org.jboss.seam.example.seambay.test.selenium.SellTest" />
<class name="org.jboss.seam.example.seambay.test.selenium.SearchTest" />
<class name="org.jboss.seam.example.seambay.test.selenium.BidTest" />
+ <class name="org.jboss.seam.example.seambay.test.selenium.WebServiceTestPageTest" />
</classes>
</test>
</suite>
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java 2009-09-22 11:00:10 UTC (rev 11506)
@@ -0,0 +1,257 @@
+/*
+ * 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.seambay.test.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.fail;
+
+import com.thoughtworks.selenium.Wait;
+
+/**
+ * This class tests a functionality of web service test page available directly
+ * from SeamBay home page
+ *
+ * @author Martin Gencur
+ *
+ */
+public class WebServiceTestPageTest extends SeleniumSeamBayTest
+{
+
+ protected static final Long TIMEOUT = 3000L; //3 seconds
+ protected static final String HERE_LINK = "xpath=//a[contains(text(),\"here\")]";
+ protected static final String SERVICE_PAGE_HEADING= "seamBay Web Services - Test Page";
+
+ protected static final String INVOKE_SERVICE_BUTTON = "xpath=//button[contains(@onclick,\"sendRequest\")]";
+ protected static final String REQUEST_AREA = "id=serviceRequest";
+ protected static final String RESPONSE_AREA = "id=serviceResponse";
+
+ protected static final String LOGIN_LINK = "xpath=//a[contains(text(),\"Login\")]";
+ protected static final String LIST_CATEGORIES_LINK = "xpath=//a[contains(text(),\"List Categories\")]";
+ protected static final String CREATE_NEW_AUCTION_LINK = "xpath=//a[contains(text(),\"Create new auction\")]";
+ protected static final String UPDATE_AUCTION_DETAILS_LINK = "xpath=//a[contains(text(),\"Update auction details\")]";
+ protected static final String SET_AUCTION_DURATION_LINK = "xpath=//a[contains(text(),\"Set auction duration\")]";
+ protected static final String SET_STARTING_PRICE_LINK = "xpath=//a[contains(text(),\"Set starting price\")]";
+ protected static final String GET_AUCTION_DETAILS_LINK = "xpath=//a[contains(text(),\"Get the auction details\")]";
+ protected static final String CONFIRM_AUCTION_LINK = "xpath=//a[contains(text(),\"Confirm auction\")]";
+ protected static final String FIND_AUCTIONS_LINK = "xpath=/html/body/div[@id='services']/div[1]/a[2]";
+ protected static final String LOGOUT_LINK = "xpath=//a[contains(text(),\"Logout\")]";
+
+ /*login parameters*/
+ protected static final String LOGIN_INPUT_USERNAME = "id=username";
+ protected static final String LOGIN_INPUT_PASSWORD = "id=password";
+
+ /*create new auction parameters*/
+ protected static final String AUCTION_TITLE = "id=title";
+ protected static final String AUCTION_DESCRIPTION = "id=description";
+ protected static final String AUCTION_CATEGORY_ID = "id=categoryId";
+
+ /*parameters for other tests*/
+ protected static final String SEARCH_TERM = "/html/body/div[@id='detail']/div[4]/div[@id='parameters']/table/tbody/tr/td[2]/input[@id='searchTerm']";
+ protected static final String AUCTION_DURATION = "id=duration";
+ protected static final String STARTING_PRICE = "id=price";
+
+ @Test
+ public void simplePageContentTest(){
+ browser.clickAndWait(HERE_LINK);
+ waitForElementPresent(RESPONSE_AREA, TIMEOUT);
+ assertTrue("Page should contain service page heading",browser.isTextPresent(SERVICE_PAGE_HEADING));
+ }
+
+ @Test(dependsOnMethods={"simplePageContentTest"})
+ public void loginTest(){
+ loginService();
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain \"true\"", x.contains(getProperty("LOGIN_RIGHT_RESPONSE")));
+ }
+
+ public void loginService(){
+ String username = "demo";
+ String password = "demo";
+ browser.clickAndWait(HERE_LINK);
+ waitForElementPresent(RESPONSE_AREA, TIMEOUT);
+ waitForElementPresent(LOGIN_LINK, TIMEOUT);
+ browser.click(LOGIN_LINK);
+ waitForElementPresent(LOGIN_INPUT_USERNAME, TIMEOUT);
+ waitForElementPresent(LOGIN_INPUT_PASSWORD, TIMEOUT);
+ browser.type(LOGIN_INPUT_USERNAME, username);
+ browser.type(LOGIN_INPUT_PASSWORD, password);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ }
+
+ @Test(dependsOnMethods={"loginTest"})
+ public void listCategoriesTest(){
+ loginService();
+ waitForElementPresent(LIST_CATEGORIES_LINK, TIMEOUT);
+ browser.click(LIST_CATEGORIES_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain a list of categories.", x.contains(getProperty("LIST_CATEGORIES_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest"})
+ public void createNewAuctionTest(){
+ loginService();
+ createNewAuctionService();
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about creating the auction.", x.contains(getProperty("CREATE_NEW_AUCTION_RESPONSE")));
+ }
+
+ public void createNewAuctionService(){
+ String title = "Animals";
+ String description = "You can buy an animal here";
+ String categoryId = "6";
+ waitForElementPresent(CREATE_NEW_AUCTION_LINK, TIMEOUT*5);
+ browser.click(CREATE_NEW_AUCTION_LINK);
+ waitForElementPresent(AUCTION_TITLE, TIMEOUT);
+ waitForElementPresent(AUCTION_DESCRIPTION, TIMEOUT);
+ waitForElementPresent(AUCTION_CATEGORY_ID, TIMEOUT);
+ browser.type(AUCTION_TITLE, title);
+ browser.type(AUCTION_DESCRIPTION, description);
+ browser.type(AUCTION_CATEGORY_ID, categoryId);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void updateAuctionTest(){
+ String title = "Animals";
+ String description = "Another description";
+ String categoryId = "5";
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(UPDATE_AUCTION_DETAILS_LINK, TIMEOUT);
+ browser.click(UPDATE_AUCTION_DETAILS_LINK);
+ waitForElementPresent(AUCTION_TITLE, TIMEOUT);
+ waitForElementPresent(AUCTION_DESCRIPTION, TIMEOUT);
+ waitForElementPresent(AUCTION_CATEGORY_ID, TIMEOUT);
+ browser.type(AUCTION_TITLE, title);
+ browser.type(AUCTION_DESCRIPTION, description);
+ browser.type(AUCTION_CATEGORY_ID, categoryId);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about updating the auction.", x.contains(getProperty("UPDATE_AUCTION_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void setAuctionDurationTest(){
+ String duration = "20";
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(SET_AUCTION_DURATION_LINK, TIMEOUT);
+ browser.click(SET_AUCTION_DURATION_LINK);
+ waitForElementPresent(AUCTION_DURATION, TIMEOUT);
+ browser.type(AUCTION_DURATION, duration);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about setting duration.", x.contains(getProperty("SET_DURATION_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void setStartingPriceTest(){
+ String price = "1000";
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(SET_STARTING_PRICE_LINK, TIMEOUT);
+ browser.click(SET_STARTING_PRICE_LINK);
+ waitForElementPresent(STARTING_PRICE, TIMEOUT);
+ browser.type(STARTING_PRICE, price);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about setting starting price.", x.contains(getProperty("SET_STARTING_PRICE_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void getAuctionDetailsTest(){
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(GET_AUCTION_DETAILS_LINK, TIMEOUT);
+ browser.click(GET_AUCTION_DETAILS_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain auction details.", x.contains(getProperty("AUCTION_DETAILS_PRICE_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest"})
+ public void logOutTest(){
+ loginService();
+ waitForElementPresent(LOGOUT_LINK, TIMEOUT);
+ browser.click(LOGOUT_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain logout confirmation.", x.contains(getProperty("LOGOUT_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void confirmAuctionTest(){
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(CONFIRM_AUCTION_LINK, TIMEOUT);
+ browser.click(CONFIRM_AUCTION_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about confirmation.", x.contains(getProperty("CONFIRMATION_RESPONSE")));
+ }
+
+ public void waitForElementPresent(final String locator, Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isElementPresent(locator);
+ }
+ }.wait("Timeout while waiting for element "+ locator +" present.", timeout);
+ } //waitForElementPresent
+
+ public void waitForElementContent(final String locator, Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return (browser.getValue(locator).length() != 0);
+ }
+ }.wait("Timeout while waiting for element content."+browser.getValue(locator).length()+","+locator , timeout);
+ } //waitForElementContent
+}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-09-22 06:30:02 UTC (rev 11505)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-09-22 11:00:10 UTC (rev 11506)
@@ -53,4 +53,14 @@
BID_HISTORY_COUNT //table[@id='history']/tbody/tr
BID_OUTBID id=outbid
BID_HIGH_BIDDER id\=highBidder
-BID_HISTORY_BACK id\=back
+BID_HISTORY_BACK id\=back
+LIST_CATEGORIES_RESPONSE=<ns2\:listCategoriesResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"><return><categoryId>1</categoryId><name>Antiques</name></return><return><categoryId>2</categoryId><name>Art</name></return><return><categoryId>3</categoryId><name>Books</name></return><return><categoryId>4</categoryId><name>Cameras and Photography</name></return><return><categoryId>5</categoryId><name>Cars and Boats</name></return><return><categoryId>6</categoryId><name>Cell Phones</name></return><return><categoryId>7</categoryId><name>Clothing and Shoes</name></return><return><categoryId>8</categoryId><name>Computers</name></return><return><categoryId>9</categoryId><name>Music</name></return><return><categoryId>10</categoryId><name>Electronics</name></return><return><categoryId>11</categoryId><name>Home and Garden</name></return><return><categoryId>12</categoryId><name>Musical Instruments</name></return><return><categoryId>13</categoryId><name>Sporting goods</name></!
return><return><categoryId>14</categoryId><name>Toys</name></return><return><categoryId>15</categoryId><name>Video Games</name></return><return><categoryId>1001</categoryId><name>Furniture</name><parent><categoryId>1</categoryId><name>Antiques</name></parent></return><return><categoryId>1002</categoryId><name>Silverware</name><parent><categoryId>1</categoryId><name>Antiques</name></parent></return><return><categoryId>2001</categoryId><name>Paintings</name><parent><categoryId>2</categoryId><name>Art</name></parent></return><return><categoryId>2002</categoryId><name>Prints</name><parent><categoryId>2</categoryId><name>Art</name></parent></return><return><categoryId>2003</categoryId><name>Sculptures</name><parent><categoryId>2</categoryId><name>Art</name></parent></return><return><categoryId>3001</categoryId><name>Fiction</name><parent><categoryId>3</categoryId><name>Books</name></parent></return><return><categoryId>3002</categoryId><name>Non Fiction</name><parent><categoryId>!
3</categoryId><name>Books</name></parent></return><return><cat!
egoryId>
3003</categoryId><name>Comic Books</name><parent><categoryId>3</categoryId><name>Books</name></parent></return><return><categoryId>3004</categoryId><name>Children</name><parent><categoryId>3</categoryId><name>Books</name></parent></return><return><categoryId>4001</categoryId><name>Digital Cameras</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>4002</categoryId><name>Memory Cards</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>4003</categoryId><name>Film Cameras</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>4004</categoryId><name>Video Cameras</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>5001</categoryId><name>Cars</name><parent><categoryId>5</categoryId><name>Cars and Boats</name></parent></return><return><cate!
goryId>5002</categoryId><name>Motorcycles</name><parent><categoryId>5</categoryId><name>Cars and Boats</name></parent></return><return><categoryId>5003</categoryId><name>Car Parts</name><parent><categoryId>5</categoryId><name>Cars and Boats</name></parent></return><return><categoryId>6001</categoryId><name>Mobile Phones</name><parent><categoryId>6</categoryId><name>Cell Phones</name></parent></return><return><categoryId>6002</categoryId><name>Mobile Accessories</name><parent><categoryId>6</categoryId><name>Cell Phones</name></parent></return><return><categoryId>6003</categoryId><name>Prepaid cards</name><parent><categoryId>6</categoryId><name>Cell Phones</name></parent></return><return><categoryId>7001</categoryId><name>Women</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>7002</categoryId><name>Men</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>7003</c!
ategoryId><name>Girls</name><parent><categoryId>7</categoryId>!
<name>Cl
othing and Shoes</name></parent></return><return><categoryId>7004</categoryId><name>Boys</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>7005</categoryId><name>Babies</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>8001</categoryId><name>Notebooks</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8002</categoryId><name>Desktop PCs</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8003</categoryId><name>Servers</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8004</categoryId><name>Hardware</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8005</categoryId><name>Software</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><!
categoryId>9001</categoryId><name>CDs</name><parent><categoryId>9</categoryId><name>Music</name></parent></return><return><categoryId>9002</categoryId><name>Records</name><parent><categoryId>9</categoryId><name>Music</name></parent></return><return><categoryId>10001</categoryId><name>Home Audio</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>10002</categoryId><name>MP3 Players</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>10003</categoryId><name>Television</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>10004</categoryId><name>Home theatre</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>11001</categoryId><name>Kitchen</name><parent><categoryId>11</categoryId><name>Home and Garden</name></parent></return><return><categoryId>11002</categoryId><name>Real Esta!
te</name><parent><categoryId>11</categoryId><name>Home and Gar!
den</nam
e></parent></return><return><categoryId>11003</categoryId><name>Furniture</name><parent><categoryId>11</categoryId><name>Home and Garden</name></parent></return><return><categoryId>12001</categoryId><name>Guitars</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>12002</categoryId><name>Pianos and Keyboards</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>12003</categoryId><name>Percussion</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>12004</categoryId><name>Orchestral</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>13001</categoryId><name>Golf</name><parent><categoryId>13</categoryId><name>Sporting goods</name></parent></return><return><categoryId>13002</categoryId><name>Fishing</name><parent><categoryId>13</categoryId><name>Spo!
rting goods</name></parent></return><return><categoryId>13003</categoryId><name>Tennis</name><parent><categoryId>13</categoryId><name>Sporting goods</name></parent></return><return><categoryId>14001</categoryId><name>Remote control</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>14002</categoryId><name>Cars and trucks</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>14003</categoryId><name>Dolls</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>14004</categoryId><name>Educational</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>15001</categoryId><name>PC</name><parent><categoryId>15</categoryId><name>Video Games</name></parent></return><return><categoryId>15002</categoryId><name>Nintendo Wii</name><parent><categoryId>15</categoryId><name>Video Games</name></parent></return><return><categor!
yId>15003</categoryId><name>Sony Playstation 3</name><parent><!
category
Id>15</categoryId><name>Video Games</name></parent></return><return><categoryId>15004</categoryId><name>XBox 360</name><parent><categoryId>15</categoryId><name>Video Games</name></parent></return></ns2\:listCategoriesResponse>
+LOGIN_RIGHT_RESPONSE=<return>true</return>
+CREATE_NEW_AUCTION_RESPONSE=<ns2\:createAuctionResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+FIND_AUCTIONS_RESPONSE=<description>You can buy an animal here</description>
+UPDATE_AUCTION_RESPONSE=<ns2\:updateAuctionDetailsResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+SET_DURATION_RESPONSE=<ns2\:setAuctionDurationResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+SET_STARTING_PRICE_RESPONSE=<ns2\:setAuctionPriceResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+AUCTION_DETAILS_PRICE_RESPONSE=<ns2\:getNewAuctionDetailsResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"><return><account><accountId>1</accountId><feedbackPercent>0.0</feedbackPercent><feedbackScore>0</feedbackScore><location>Sydney, NSW, Australia</location>
+LOGOUT_RESPONSE=<ns2\:logoutResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"><return>true</return></ns2\:logoutResponse>
+CONFIRMATION_RESPONSE=<env\:Body><ns2\:confirmAuctionResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/></env\:Body>
15 years, 3 months
Seam SVN: r11505 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest: examples/ui/src/org/jboss/seam/example/ui/test and 2 other directories.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-22 02:30:02 -0400 (Tue, 22 Sep 2009)
New Revision: 11505
Added:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java
Log:
JBPAPP-2829 Backported a functional test for ui example
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml 2009-09-21 11:48:11 UTC (rev 11504)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml 2009-09-22 06:30:02 UTC (rev 11505)
@@ -36,6 +36,9 @@
<property name="lib.dir" value="${ftest.dir}/lib" />
<property name="log.dir" value="${ftest.dir}/log" />
+ <!-- Build resources -->
+ <import file="${seam.dir}/build/common.build.xml" />
+
<path id="selenium.server.classpath">
<fileset dir="${lib.dir}">
<include name="selenium-server-standalone.jar" />
@@ -206,10 +209,36 @@
</sequential>
</macrodef>
+ <!-- Target for declaring needed libraries for ftest tests -->
+ <target name="importlibraries">
+ <copyInlineDependencies id="allexamples" scope="compile" todir="${lib.dir}">
+ <dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit" version="2.3"/>
+ <dependency groupId="commons-httpclient" artifactId="commons-httpclient" version="3.1"/>
+ <dependency groupId="org.w3c" artifactId="sac" version="1.3"/>
+ <dependency groupId="commons-io" artifactId="commons-io" version="1.3.1"/>
+ <dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
+ <dependency groupId="apache-xerces" artifactId="xercesImpl" version="2.9.0"/>
+ <dependency groupId="commons-collections" artifactId="commons-collections" version="3.1"/>
+ <dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
+ <dependency groupId="apache-xalan" artifactId="xalan" version="j_2.7.0"/>
+ <dependency groupId="commons-codec" artifactId="commons-codec" version="1.3"/>
+ <dependency groupId="commons-logging" artifactId="commons-logging" version="1.1.1"/>
+ <dependency groupId="net.sourceforge.cssparser" artifactId="cssparser" version="0.9.5"/>
+ <dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit-core-js" version="2.4"/>
+ <dependency groupId="net.sourceforge.nekohtml" artifactId="nekohtml" version="1.9.9"/>
+ <dependency groupId="apache-xalan" artifactId="serializer" version="j_2.7.0"/>
+ <dependency groupId="xml-apis" artifactId="xml-apis" version="1.3.03"/>
+ </copyInlineDependencies>
+ </target>
+
<macrodef name="callExample">
<attribute name="path" />
<attribute name="target" />
<sequential>
+
+ <!-- Added for downloading libraries -->
+ <antcall target="importlibraries"> </antcall>
+
<ant dir="@{path}" target="@{target}" inheritall="false">
<property name="container" value="${container}">
</property>
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java 2009-09-22 06:30:02 UTC (rev 11505)
@@ -0,0 +1,122 @@
+/*
+ * 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.ui.test.htmlunit;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+
+import java.io.IOException;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.BrowserVersion;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlImage;
+import static org.testng.AssertJUnit.fail;
+import java.net.URL;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Functional test for uploadLink and graphicImage testcases of UI example
+ *
+ * @author mgencur
+ *
+ */
+public class HtmlUnitUITest
+{
+ public static final String PAGE_URL = "http://localhost:8080/seam-ui";
+ public static final String HOME_PAGE_TITLE = "UI Example:";
+ public static final String FILE_UPLOAD_FILE= "//input[@type='file']";
+ public static final String FILE_UPLOAD_UPDATE="//input[@type='submit'][@value='Update']";
+ public static final String IMAGE_TO_UPLOAD = "photo.jpg";
+ public static final String FILE_UPLOAD_RESPONSE="//ul/li[contains(text(),'Successfully updated')]";
+ public static final String FILE_UPLOAD_LINK = "//a[contains(@href,'fileUpload')]";
+ public static final String GRAPHIC_IMAGE_LINK = "//a[contains(@href,'graphicImage')]";
+ public static final String IMAGE = "//img";
+
+ public WebClient wc;
+ public HtmlPage page;
+
+ @BeforeMethod
+ public void setUp() throws Exception{
+ URL url = new URL(PAGE_URL);
+ wc = new WebClient(BrowserVersion.FIREFOX_2);
+ page = (HtmlPage) wc.getPage(url);
+ }
+
+
+ @AfterMethod
+ public void tearDown() {
+ wc.closeAllWindows();
+ }
+
+
+ @Test
+ public void homePageLoadTest()
+ {
+ assertEquals("Unexpected page title.", HOME_PAGE_TITLE, page.getTitleText());
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void fileUploadTest() throws IOException {
+ final HtmlAnchor linkEl = (HtmlAnchor) page.getFirstByXPath(FILE_UPLOAD_LINK);
+
+ final HtmlPage uploadPage = (HtmlPage) linkEl.click();
+ if (uploadPage == null){
+ fail("Could not read page");
+ }
+
+ final HtmlInput el1 = (HtmlInput) uploadPage.getFirstByXPath(FILE_UPLOAD_FILE);
+ if (el1 == null) {
+ fail("Element file upload file doesn't exist");
+ } else {
+ el1.type(IMAGE_TO_UPLOAD);
+ }
+
+ final HtmlInput el2 = (HtmlInput) uploadPage.getFirstByXPath(FILE_UPLOAD_UPDATE);
+ final HtmlPage finishPage = (HtmlPage) el2.click();
+ final HtmlElement el3 = (HtmlElement) finishPage.getFirstByXPath(FILE_UPLOAD_RESPONSE);
+
+ assertFalse("Page should contain \"Successfully updated\"", el3 == null);
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest","fileUploadTest"})
+ public void graphicImageTest() throws IOException {
+ final HtmlAnchor linkEl = (HtmlAnchor) page.getFirstByXPath(GRAPHIC_IMAGE_LINK);
+
+ final HtmlPage graphicPage = (HtmlPage) linkEl.click();
+ if (graphicPage == null){
+ fail("Could not read page");
+ }
+
+ final HtmlImage image = (HtmlImage) graphicPage.getFirstByXPath(IMAGE);
+
+ assertFalse("Page should contain image of Pete Muir", image == null);
+ }
+}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java 2009-09-21 11:48:11 UTC (rev 11504)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java 2009-09-22 06:30:02 UTC (rev 11505)
@@ -1,16 +1,49 @@
+/*
+ * 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.ui.test.selenium;
import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+/**
+ * This class tests functionality of UI example
+ *
+ * @author Martin Gencur
+ *
+ */
public class SeleniumUITest extends SeamSeleniumTest
{
public static final String HOME_PAGE = "/index.seam";
public static final String HOME_PAGE_TITLE = "UI Example:";
-
+ public static final String SELECT_ITEMS_LINK = "xpath=//a[contains(@href,\"selectItems\")]";
+ public static final String FRAGMENT_LINK = "xpath=//a[contains(@href,\"fragment\")]";
+ public static final String FOTMATTED_TEXT_LINK = "xpath=//a[contains(@href,\"formattedText\")]";
+ public static final String BUTTON_AND_SLINK_LINK = "xpath=//a[contains(@href,\"linkAndButton\")]";
+ public static final String CACHE_LINK = "xpath=//a[contains(@href,\"cache\")]";
+
@BeforeMethod
@Override
public void setUp()
@@ -26,5 +59,87 @@
public void homePageLoadTest()
{
assertEquals("Unexpected page title.", HOME_PAGE_TITLE, browser.getTitle());
+ }
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void selectItemsTest(){
+ String title = "Mr.";
+ String name = "Martin Gencur";
+ String continent = "Europe";
+ String age = "24";
+ String pet = "Dog (Needs lots of exercise)";
+ String colour1 = "Green", colour2 = "Yellow";
+ String book = "Pride and Prejudice by Jane Austin (British)";
+ String film = "Blade Runner directed by Ridley Scott";
+ browser.clickAndWait(SELECT_ITEMS_LINK);
+ browser.select(getProperty("SELECT_ITEMS_TITLE"), "label="+title);
+ browser.type(getProperty("SELECT_ITEMS_NAME"), name);
+ browser.select(getProperty("SELECT_ITEMS_CONTINENT"), "label="+continent);
+ browser.check(getProperty("SELECT_ITEMS_USER"));
+ browser.check(getProperty("SELECT_ITEMS_ADMIN"));
+ browser.check(getProperty("SELECT_ITEMS_MANAGER"));
+ browser.check(getProperty("SELECT_ITEMS_SUPERADMIN"));
+ browser.select(getProperty("SELECT_ITEMS_AGE"), "label="+age);
+ browser.select(getProperty("SELECT_ITEMS_PET"), "label="+pet);
+ browser.select(getProperty("SELECT_ITEMS_COLOURS"), "label="+colour1);
+ browser.select(getProperty("SELECT_ITEMS_COLOURS"), "label="+colour2);
+ browser.select(getProperty("SELECT_ITEMS_BOOK"), "label="+book);
+ browser.select(getProperty("SELECT_ITEMS_FILM"), "label="+film);
+ browser.clickAndWait(getProperty("SELECT_ITEMS_APPLY"));
+ browser.check(getProperty("SELECT_ITEMS_COUNTRY"));
+ browser.clickAndWait(getProperty("SELECT_ITEMS_APPLY"));
+ assertTrue("Page should contain \"Successfully updated\"", browser.isTextPresent("Successfully updated"));
}
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void fragmentTest(){
+ browser.clickAndWait(FRAGMENT_LINK);
+ assertTrue("Page should contain \"fragment is rendered\"", browser.isTextPresent("This fragment is rendered whilst"));
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void formattedTextTest(){
+ browser.clickAndWait(FOTMATTED_TEXT_LINK);
+ assertTrue("Page should contain information about Pete Muir working all the time on Seam", browser.isTextPresent("works on Seam, of course"));
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void buttonAndLinkTest(){
+ browser.clickAndWait(BUTTON_AND_SLINK_LINK);
+ assertTrue("Page should contain \"A fragment to jump to\"", browser.isTextPresent("A fragment to jump to"));
+ browser.clickAndWait(getProperty("JUMP_LINK"));
+ browser.clickAndWait(getProperty("JUMP_BUTTON"));
+ browser.clickAndWait(getProperty("LINK_LINK"));
+ browser.clickAndWait(getProperty("DO_ACTION_LINK"));
+ assertTrue("Page should contain \"A simple action was performed\"", browser.isTextPresent("A simple action was performed"));
+ browser.clickAndWait(getProperty("DO_ACTION_BUTTON"));
+ assertTrue("Page should contain \"A simple action was performed\"", browser.isTextPresent("A simple action was performed"));
+ assertTrue("Page should contain disabled link", browser.isElementPresent(getProperty("DISABLED_DO_ACTION_LINK")));
+ assertTrue("Page should contain disabled button", browser.isElementPresent(getProperty("DISABLED_DO_ACTION_BUTTON")));
+ browser.clickAndWait(getProperty("BEGIN_CONVERSATION_LINK"));
+ browser.clickAndWait(getProperty("END_CONVERSATION_BUTTON"));
+ assertTrue("Page shouldn't contain \"A simple action was performed\"", !browser.isTextPresent("A simple action was performed"));
+ browser.clickAndWait(getProperty("ADD_PARAMETER_LINK"));
+ browser.clickAndWait(getProperty("ADD_PARAMETER_BUTTON"));
+ assertTrue("Page should contain \"Foo = bar\"", browser.isTextPresent("Foo = bar"));
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void cacheTest(){
+ browser.clickAndWait(CACHE_LINK);
+ assertTrue("Page should contain some cached text", browser.isTextPresent("Some cached text"));
+ }
+
+
+ /**
+ * Resource download cannot be tested automatically because downloading a file needs user interaction
+ * with a window form
+ *
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void resourceDownloadTest(){
+ }*/
}
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties 2009-09-22 06:30:02 UTC (rev 11505)
@@ -0,0 +1,34 @@
+SELECT_ITEMS_TITLE=xpath\=//select[option[contains(@value,'MR')]]
+SELECT_ITEMS_NAME=xpath\=//input[contains(@value,'Peter Muir')]
+SELECT_ITEMS_CONTINENT=xpath\=//select[option[contains(text(),'Europe')]]
+SELECT_ITEMS_USER=xpath\=//input[@type\='checkbox'][@value\='USER']
+SELECT_ITEMS_ADMIN=xpath\=//input[@type\='checkbox'][@value\='ADMIN']
+SELECT_ITEMS_MANAGER=xpath\=//input[@type\='checkbox'][@value\='MANAGER']
+SELECT_ITEMS_SUPERADMIN=xpath\=//input[@type\='checkbox'][@value\='SUPERADMIN']
+SELECT_ITEMS_AGE=xpath\=//select[option[contains(text(),'24')]]
+SELECT_ITEMS_PET=xpath\=//form/div/div/span/select[option[contains(text(),'Dog')]]
+SELECT_ITEMS_COLOURS=xpath\=//select[option[contains(text(),'Green')]]
+SELECT_ITEMS_BOOK=xpath\=//select[option[contains(text(),'Pride and Prejudice by Jane Austin (British)')]]
+SELECT_ITEMS_FILM=xpath\=//select[option[contains(text(),'Blade Runner directed by Ridley Scott')]]
+SELECT_ITEMS_APPLY=xpath\=//input[@type\='submit'][@value\='Apply']
+SELECT_ITEMS_COUNTRY=xpath\=//input[@type\='radio'][@value\='18']
+JUMP_LINK=xpath\=//a[contains(text(),'Jump')]
+JUMP_BUTTON=xpath\=//input[@type\='button'][@value\='Jump']
+LINK_LINK=xpath\=//a[contains(text(),'Link')]
+DO_ACTION_LINK=xpath\=//a[contains(text(),'Do action')]
+DO_ACTION_BUTTON=xpath\=//input[@type\='button'][@value\='Do action']
+DISABLED_DO_ACTION_LINK=xpath\=//a[contains(text(),'Do action')][not(@href)]
+DISABLED_DO_ACTION_BUTTON=xpath\=//input[@type\='button'][@value\='Do action'][@disabled\='disabled']
+BEGIN_CONVERSATION_LINK=xpath\=//a[contains(text(),'Begin conversation')]
+END_CONVERSATION_BUTTON=xpath\=//input[@type\='button'][@value\='End conversation']
+ADD_PARAMETER_LINK=xpath\=//a[contains(text(),'Add a page parameter')]
+ADD_PARAMETER_BUTTON=xpath\=//input[@type\='button'][@value\='Add a page parameter']
+NAME_INPUT=xpath\=//input[@type\='text'][contains(@name,'name')][not(contains(@name,'nameVerification'))]
+NAME_VERIFICATION_INPUT=xpath\=//input[@type\='text'][contains(@name,'nameVerification')]
+CHECK_NAME_BUTTON=xpath\=//input[@type\='submit'][@value\='Check name']
+MINIMUM_AGE_INPUT=xpath\=//input[@type\='text'][contains(@name,'min')][not(contains(@name,'minVerification'))]
+MAXIMUM_AGE_INPUT=xpath\=//input[@type\='text'][contains(@name,'minVerification')]
+CHECK_AGES_BUTTON=xpath\=//input[@type\='submit'][@value\='Check ages']
+DATE_INPUT=xpath\=//input[contains(@name,'date')][not(contains(@name,'dateVerification'))]
+DATE_VERIFICATION_INPUT=xpath\=//input[contains(@name,'dateVerification')]
+CHECK_DATE_BUTTON=xpath\=//input[@type\='submit'][@value\='Check date']
15 years, 3 months
Seam SVN: r11504 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest: examples/remoting and 10 other directories.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-21 07:48:11 -0400 (Mon, 21 Sep 2009)
New Revision: 11504
Added:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
Log:
JBPAPP-2829 Backported a functional test of helloworld example
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml 2009-09-21 11:20:12 UTC (rev 11503)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml 2009-09-21 11:48:11 UTC (rev 11504)
@@ -67,6 +67,7 @@
<testexample name="quartz" />
<testexample name="registration" />
<testexample name="remoting/chatroom" />
+ <testexample name="remoting/helloworld" />
<testexample name="remoting/gwt" />
<testexample name="seambay" />
<testexample name="seamdiscs" />
@@ -112,6 +113,7 @@
<cleanexample name="quartz" />
<cleanexample name="registration" />
<cleanexample name="remoting/chatroom" />
+ <cleanexample name="remoting/helloworld" />
<cleanexample name="remoting/gwt" />
<cleanexample name="seambay" />
<cleanexample name="seamdiscs" />
@@ -141,6 +143,7 @@
<undeployexample name="quartz" />
<undeployexample name="registration" />
<undeployexample name="remoting/chatroom" />
+ <undeployexample name="remoting/helloworld" />
<undeployexample name="remoting/gwt" />
<undeployexample name="seambay" />
<undeployexample name="seamdiscs" />
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml 2009-09-21 11:48:11 UTC (rev 11504)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.
+-->
+<project name="remoting.helloworld.ftest.build" basedir="." default="build">
+ <property name="example.name" value="remoting/helloworld" />
+ <property name="jboss.example.ready.check.url" value="seam-helloworld" />
+
+ <import file="../../build.xml" />
+</project>
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml 2009-09-21 11:48:11 UTC (rev 11504)
@@ -0,0 +1,28 @@
+
+ <!--
+ 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.
+ -->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Helloworld example" verbose="2" parallel="false">
+ <test name="remoting_helloworld_jboss5">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/seam-helloworld" />
+ <classes>
+ <class
+ name="org.jboss.seam.example.remoting.helloworld.test.selenium.HelloworldTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java 2009-09-21 11:48:11 UTC (rev 11504)
@@ -0,0 +1,86 @@
+/*
+ * 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.remoting.helloworld.test.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+import static org.testng.AssertJUnit.*;
+
+/**
+ * This class tests a functionality of remoting/helloworld example.
+ *
+ * @author Martin Gencur
+ *
+ */
+public class HelloworldTest extends SeamSeleniumTest
+{
+ protected static final String HELLOWORLD_URL = "/helloworld.seam";
+ protected static final String HELLOWORLD_TITLE = "Seam Remoting - Hello World Example";
+ protected static final String SAYHELLO_BUTTON = "xpath=//button[contains(@onclick,\"sayHello\")]";
+ protected static final String PROMPT_ANSWER = "Martin";
+ protected static final String ALERT_MESSAGE = "Hello, Martin";
+ protected static final Long TIMEOUT = 10000L; //10 seconds
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + HELLOWORLD_URL);
+ }
+
+ @Test
+ public void simplePageContentTest()
+ {
+ assertTrue("Home page of Remoting/Helloworld Example expected", browser.getLocation().contains(HELLOWORLD_URL));
+ assertTrue("Different page title expected",browser.getTitle().contains(HELLOWORLD_TITLE));
+ assertTrue("Home page should contain Say Hello button", browser.isElementPresent(SAYHELLO_BUTTON));
+ }
+
+ @Test(dependsOnMethods = {"simplePageContentTest"})
+ public void sayHelloButtonTest(){
+ String result = "";
+ browser.answerOnNextPrompt(PROMPT_ANSWER);
+ browser.click(SAYHELLO_BUTTON);
+ waitForAlertPresent(TIMEOUT);
+ result = browser.getAlert();
+ assertTrue("An alert message should show up and should contain \"Hello,\" and name.", result.contains(ALERT_MESSAGE));
+ }
+
+ public void waitForAlertPresent(Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isAlertPresent();
+ }
+ }.wait("Timeout while waiting for alert window.", timeout);
+ }
+}
15 years, 3 months
Seam SVN: r11503 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest: examples/remoting and 10 other directories.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-21 07:20:12 -0400 (Mon, 21 Sep 2009)
New Revision: 11503
Added:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/build.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/jboss.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
Log:
JBPAPP-2829 Backported functional test for gwt example
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml 2009-09-21 11:01:44 UTC (rev 11502)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml 2009-09-21 11:20:12 UTC (rev 11503)
@@ -67,6 +67,7 @@
<testexample name="quartz" />
<testexample name="registration" />
<testexample name="remoting/chatroom" />
+ <testexample name="remoting/gwt" />
<testexample name="seambay" />
<testexample name="seamdiscs" />
<testexample name="seampay" />
@@ -111,6 +112,7 @@
<cleanexample name="quartz" />
<cleanexample name="registration" />
<cleanexample name="remoting/chatroom" />
+ <cleanexample name="remoting/gwt" />
<cleanexample name="seambay" />
<cleanexample name="seamdiscs" />
<cleanexample name="seampay" />
@@ -139,6 +141,7 @@
<undeployexample name="quartz" />
<undeployexample name="registration" />
<undeployexample name="remoting/chatroom" />
+ <undeployexample name="remoting/gwt" />
<undeployexample name="seambay" />
<undeployexample name="seamdiscs" />
<undeployexample name="seampay" />
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/build.xml (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/build.xml 2009-09-21 11:20:12 UTC (rev 11503)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.
+-->
+<project name="remoting.gwt.ftest.build" basedir="." default="build">
+ <property name="example.name" value="remoting/gwt" />
+ <property name="jboss.example.ready.check.url" value="seam-gwt/HelloWorld.html" />
+
+ <import file="../../build.xml" />
+</project>
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/jboss.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/jboss.xml (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/jboss.xml 2009-09-21 11:20:12 UTC (rev 11503)
@@ -0,0 +1,28 @@
+
+ <!--
+ 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.
+ -->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Gwt example" verbose="2" parallel="false">
+ <test name="remoting_gwt_jboss">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/seam-gwt" />
+ <classes>
+ <class
+ name="org.jboss.seam.example.remoting.gwt.test.selenium.GwtTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java 2009-09-21 11:20:12 UTC (rev 11503)
@@ -0,0 +1,102 @@
+/*
+ * 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.remoting.gwt.test.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+import static org.testng.AssertJUnit.*;
+
+/**
+ * This class tests a functionality of remoting/gwt example.
+ *
+ * @author Martin Gencur
+ *
+ */
+public class GwtTest extends SeamSeleniumTest
+{
+ protected static final String GWT_URL = "/HelloWorld.html";
+ protected static final String GWT_TITLE = "Wrapper HTML for HelloWorld";
+ protected static final String ASK_BUTTON = "dom=document.getElementsByTagName('button')[0]";
+ protected static final String TEXT_FIELD = "dom=document.getElementsByTagName('input')[0]";
+ protected static final Long TIMEOUT = 2000L; //2 seconds
+
+ protected static final String ENTER_TEXT_WITHOUT = "Text without question mark at the end";
+ protected static final String ENTER_TEXT_WITH = "Text WITH question mark at the end?";
+
+ protected static final String MESSAGE_WITHOUT = "A question has to end with a \'?\'";
+ protected static final String MESSAGE_WITH = "Its the real question that you seek now";
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + GWT_URL);
+ }
+
+ @Test
+ public void simplePageContentTest()
+ {
+ assertTrue("Home page of Remoting/Gwt Example expected", browser.getLocation().contains(GWT_URL));
+ assertTrue("Different page title expected ale je:"+ browser.getTitle(),browser.getTitle().contains(GWT_TITLE));
+ assertTrue("Home page should contain Text field", browser.isElementPresent(TEXT_FIELD));
+ assertTrue("Home page should contain Ask button", browser.isElementPresent(ASK_BUTTON));
+ }
+
+ @Test(dependsOnMethods = {"simplePageContentTest"})
+ public void withoutQuestionMarkTest(){
+ String result = "";
+ browser.type(TEXT_FIELD, ENTER_TEXT_WITHOUT);
+ browser.click(ASK_BUTTON);
+ waitForAlertPresent(TIMEOUT);
+ result = browser.getAlert();
+ assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITHOUT + "\"", result.contains(MESSAGE_WITHOUT));
+ }
+
+ @Test(dependsOnMethods = {"simplePageContentTest"})
+ public void withQuestionMarkTest(){
+ String result = "";
+ browser.type(TEXT_FIELD, ENTER_TEXT_WITH);
+ browser.click(ASK_BUTTON);
+ waitForAlertPresent(TIMEOUT);
+ result = browser.getAlert();
+ assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITH + "\"", result.contains(MESSAGE_WITH));
+ }
+
+ public void waitForAlertPresent(Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isAlertPresent();
+ }
+ }.wait("Timeout while waiting for alert window.", timeout);
+ }
+}
15 years, 3 months
Seam SVN: r11502 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest: src/main/org/jboss/seam/example/common/test/selenium and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-21 07:01:44 -0400 (Mon, 21 Sep 2009)
New Revision: 11502
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/test/selenium/SeleniumChatroomTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java
Log:
JBPAPP-2829 Backported functional test of chatroom example and base classes for selenium tests modified
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/test/selenium/SeleniumChatroomTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/test/selenium/SeleniumChatroomTest.java 2009-09-21 08:03:19 UTC (rev 11501)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/test/selenium/SeleniumChatroomTest.java 2009-09-21 11:01:44 UTC (rev 11502)
@@ -1,25 +1,161 @@
+/*
+ * 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.remoting.chatroom.test.selenium;
+import org.jboss.seam.example.common.test.selenium.SeamSelenium;
import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.testng.AssertJUnit.assertEquals;
+/**
+ * This class tests functionality of remoting/chatroom example.
+ * The test opens two browsers and tests communication between users.
+ *
+ * @author Martin Gencur
+ *
+ */
public class SeleniumChatroomTest extends SeamSeleniumTest
{
+ public static long timeout = 22000;
+
public static final String HOME_PAGE = "/chatroom.seam";
public static final String HOME_PAGE_TITLE = "Chat Room Example";
+ public static final String NAME_INPUT = "id=username";
+ public static final String CONNECT_BUTTON = "id=btnConnect";
+ public static final String DISCONNECT_BUTTON = "id=btnDisconnect";
+ public static final String CONNECT_BUTTON_DISABLED = "xpath=//input[@id='btnConnect'][@disabled]";
+ public static final String DISCONNECT_BUTTON_DISABLED = "xpath=//input[@id='btnDisconnect'][@disabled]";
+ public static final String MESSAGE_INPUT = "id=messageText";
+ public static final String CHAT_AREA = "id=channelDisplay";
+ public static final String NAME1 = "Martin";
+ public static final String NAME2 = "Jozef";
+ public static final String MARTIN_CONNECTED = "xpath=//div[@id='channelDisplay']/span[contains(text(),'Martin connected.')]";
+ public static final String MARTIN_LISTED = "xpath=//div/select[@id='userList']/option[contains(text(),'Martin')]";
+ public static final String JOZEF_CONNECTED = "xpath=//div[@id='channelDisplay']/span[contains(text(),'Jozef connected.')]";
+ public static final String JOZEF_LISTED = "xpath=//div/select[@id='userList']/option[contains(text(),'Jozef')]";
+ public static final String JOZEF_DISCONNECTED = "xpath=//div[@id='channelDisplay']/span[contains(text(),'Jozef disconnected.')]";
+ public static final String MESSAGE_FROM_MARTIN = "Hello";
+ public static final String MESSAGE_FROM_JOZEF = "Good evening";
+ public static final String MARTIN_GT = "xpath=//div[@id='channelDisplay']/span[contains(text(),'Martin>')]";
+ public static final String HELLO = "xpath=//div[@id='channelDisplay']/text()[contains(.,'"+ MESSAGE_FROM_MARTIN +"')]";
+ public static final String JOZEF_GT = "xpath=//div[@id='channelDisplay']/span[contains(text(),'Jozef>')]";
+ public static final String GOOD_MORNING = "xpath=//div[@id='channelDisplay']/text()[contains(.,'" + MESSAGE_FROM_JOZEF + "')]";
+
+ protected SeamSelenium browser2;
@BeforeMethod
@Override
public void setUp() {
super.setUp();
- browser.open(CONTEXT_PATH + HOME_PAGE);
+ startSecondBrowser();
+ browser.open(CONTEXT_PATH + HOME_PAGE);
+ browser2.open(CONTEXT_PATH + HOME_PAGE);
}
+ @AfterMethod
+ @Override
+ public void tearDown() {
+ stopSecondBrowser();
+ super.tearDown();
+ }
+
@Test // place holder - should be replaced by better tests as soon as JBSEAM-3944 is resolved
public void homePageLoadTest() {
assertEquals("Unexpected page title.", HOME_PAGE_TITLE, browser.getTitle());
}
-
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void connectAndChatTest(){
+ /*connect user to chat*/
+ connect();
+ /*verify that user is connected and is seen by other users*/
+ verifyConnecting();
+ /*exchange several messages*/
+ chat();
+ /*disconnect user from chat*/
+ disconnect();
+ /*verify that user is disconnected and is not in a list of users anymore*/
+ verifyDisconnecting();
+ }
+
+ public void connect(){
+ browser.type(NAME_INPUT, NAME1);
+ browser.click(CONNECT_BUTTON);
+ }
+
+ public void verifyConnecting(){
+ browser.waitForElement(MARTIN_CONNECTED, timeout);
+ browser.waitForElement(MARTIN_LISTED, timeout);
+ browser2.type(NAME_INPUT, NAME2);
+ browser2.click(CONNECT_BUTTON);
+ browser2.waitForElement(JOZEF_CONNECTED, timeout);
+ browser2.waitForElement(JOZEF_LISTED, timeout);
+ browser2.waitForElement(MARTIN_LISTED, timeout);
+ browser.waitForElement(JOZEF_CONNECTED, timeout);
+ browser.waitForElement(JOZEF_LISTED, timeout);
+ }
+
+ public void disconnect(){
+ browser2.click(DISCONNECT_BUTTON);
+ }
+
+ public void verifyDisconnecting(){
+ browser2.waitForElementNotPresent(JOZEF_LISTED, timeout);
+ browser2.waitForElement(DISCONNECT_BUTTON_DISABLED, timeout);
+ browser.waitForElement(JOZEF_DISCONNECTED, timeout);
+ browser.waitForElementNotPresent(JOZEF_LISTED, timeout);
+ browser.click(DISCONNECT_BUTTON);
+ browser.waitForElementNotPresent(MARTIN_LISTED, timeout);
+ browser.waitForElement(DISCONNECT_BUTTON_DISABLED, timeout);
+ }
+
+ public void chat(){
+ /*first user is sending a message*/
+ browser.type(MESSAGE_INPUT, MESSAGE_FROM_MARTIN);
+ browser.focus(MESSAGE_INPUT);
+ browser.keyPressNative("10");//browser.keyPressNative("13");
+ browser.keyPress(MESSAGE_INPUT,"13");
+ browser.waitForElement(MARTIN_GT, timeout);
+ browser.waitForElement(HELLO, timeout);
+ browser2.waitForElement(MARTIN_GT, timeout);
+ browser2.waitForElement(HELLO, timeout);
+ /*second user is sending a message*/
+ browser2.type(MESSAGE_INPUT, MESSAGE_FROM_JOZEF);
+ browser2.focus(MESSAGE_INPUT);
+ browser2.keyPressNative("10");
+ browser2.keyPress(MESSAGE_INPUT,"13");
+ browser2.waitForElement(JOZEF_GT, timeout);
+ browser2.waitForElement(GOOD_MORNING, timeout);
+ browser.waitForElement(JOZEF_GT, timeout);
+ browser.waitForElement(GOOD_MORNING, timeout);
+ }
+
+ public void startSecondBrowser(){
+ browser2 = super.startBrowser();
+ }
+
+ public void stopSecondBrowser(){
+ browser2.stop();
+ }
}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2009-09-21 08:03:19 UTC (rev 11501)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2009-09-21 11:01:44 UTC (rev 11502)
@@ -18,7 +18,7 @@
* 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.common.test.selenium;
import java.io.BufferedWriter;
@@ -30,16 +30,17 @@
/**
* This class slightly enhaces a Selenium API for controlling a browser.
+ *
* @author Jozef Hartinger
- *
+ *
*/
public class SeamSelenium extends DefaultSelenium
{
-
- protected String timeout = "30000";
+
+ private String timeout = "30000";
private boolean icefacesDetection = false;
private long icefacesWaitTime = 1000;
-
+
private final String ICEFACES_CONNECTION_STATUS = "xpath=//div[@class='iceOutConStat connectionStatus']";
private final String ICEFACES_IDLE_VISIBLE = "xpath=//div[@class='iceOutConStatInactv connectionStatusInactv'][@style='visibility: visible;']";
@@ -47,30 +48,57 @@
{
super(serverHost, serverPort, browserStartCommand, browserURL);
}
-
- @Override
- public void setTimeout(String timeout) {
- super.setTimeout(timeout);
- this.timeout = timeout;
- }
/**
- * Same as click method but waits for page to load after clicking. Default timeout can be changed by setTimeout() method.
+ * Same as click method but waits for page to load after clicking. Default
+ * timeout can be changed by setTimeout() method.
+ *
* @param locator
*/
- public void clickAndWait(String locator) {
+ public void clickAndWait(String locator)
+ {
click(locator);
waitForPageToLoad();
}
-
+
+ /**
+ * Simulates a user pressing "back" button and waits for page to load.
+ * Default timeout can be changed by setTimeout() method.
+ */
+ public void goBackAndWait()
+ {
+ super.goBack();
+ super.waitForPageToLoad(timeout);
+ }
+
+ /**
+ * Simulates a user pressing "refresh" button and waits for page to load.
+ * Default timeout can be changed by setTimeout() method.
+ */
+ public void refreshAndWait()
+ {
+ super.refresh();
+ super.waitForPageToLoad(timeout);
+ }
+
+ @Override
+ public void setTimeout(String timeout)
+ {
+ super.setTimeout(timeout);
+ this.timeout = timeout;
+ }
+
public String getTimeout()
{
return timeout;
}
+
public void waitForPageToLoad()
{
+
waitForPageToLoad(timeout);
}
+
@Override
public void waitForPageToLoad(String timeout)
{
@@ -83,8 +111,63 @@
super.waitForPageToLoad(timeout);
}
}
+
+ /**
+ * Waits until element is asynchronously loaded on page. Uses global Selenium
+ * timeout
+ *
+ * @param locator Locator of element
+ */
+ public void waitForElement(final String locator)
+ {
+ waitForElement(locator, Long.valueOf(timeout));
+ }
+
+ /**
+ * Waits until element is asynchronously loaded on page.
+ *
+ * @param timeout Timeout in milliseconds
+ * @param locator Locator of element
+ */
+ public void waitForElement(final String locator, long timeout)
+ {
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return isElementPresent(locator);
+ }
+ }.wait("Timeout while waiting for asynchronous update of " + locator, timeout);
+ }
/**
+ * Waits until element is asynchronously unloaded from page.
+ *
+ * @param timeout Timeout in milliseconds
+ * @param locator Locator of element
+ */
+ public void waitForElementNotPresent(final String locator, long timeout)
+ {
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return !isElementPresent(locator);
+ }
+ }.wait("Timeout while waiting for asynchronous update of " + locator, timeout);
+ }
+
+ /**
+ * Returns true if icefaces detection is turned on
+ */
+ public boolean isIcefacesDetection()
+ {
+ return icefacesDetection;
+ }
+
+ /**
* Switch icefaces detection on/off
*
* @param icefacesDetection
@@ -93,10 +176,19 @@
{
this.icefacesDetection = icefacesDetection;
}
-
+
/**
* This wait time will be used when waiting for response after invoking
* icefaces action
+ */
+ public long getIcefacesWaitTime()
+ {
+ return icefacesWaitTime;
+ }
+
+ /**
+ * This wait time will be used when waiting for response after invoking
+ * icefaces action
*
* @param icefacesWaitTime
*/
@@ -104,7 +196,7 @@
{
this.icefacesWaitTime = icefacesWaitTime;
}
-
+
/**
* Captures a screenshot and stores it into a file. Active windows is
* maximized before capturing a screenshot.
@@ -115,6 +207,7 @@
windowMaximize();
super.captureScreenshot(path);
}
+
/**
* Logs HTML body into a file.
*
@@ -145,23 +238,7 @@
}
}
}
-
- /**
- * Simulates a user pressing "back" button and waits for page to load. Default timeout can be changed by setTimeout() method.
- */
- public void goBackAndWait() {
- super.goBack();
- super.waitForPageToLoad(timeout);
- }
-
- /**
- * Simulates a user pressing "refresh" button and waits for page to load. Default timeout can be changed by setTimeout() method.
- */
- public void refreshAndWait() {
- super.refresh();
- super.waitForPageToLoad(timeout);
- }
-
+
private void waitForIcefaces(Long waitTime, Long timeout)
{
new Wait()
@@ -189,5 +266,4 @@
}
}.wait("Timeout while waiting for document body after icefaces click.", timeout);
}
-
}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java 2009-09-21 08:03:19 UTC (rev 11501)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java 2009-09-21 11:01:44 UTC (rev 11502)
@@ -104,4 +104,14 @@
}
return properties.getProperty(key, "Property not found: " + key);
}
+
+ public static String getBrowser()
+ {
+ return BROWSER;
+ }
+
+ public static void setBrowser(String browser)
+ {
+ BROWSER = browser;
+ }
}
15 years, 3 months
Seam SVN: r11501 - branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-21 04:03:19 -0400 (Mon, 21 Sep 2009)
New Revision: 11501
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties
Log:
JBPAPP-2829 Numberguess test changed to work with EAP4.3 example version
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java 2009-09-21 07:30:40 UTC (rev 11500)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/NumberGuessTest.java 2009-09-21 08:03:19 UTC (rev 11501)
@@ -28,6 +28,7 @@
import org.jboss.seam.example.common.test.numberguess.selenium.CommonNumberGuessTest;
import org.testng.annotations.Test;
+
/**
*
* @author Jozef Hartinger
@@ -73,11 +74,28 @@
browser.waitForPageToLoad(TIMEOUT);
browser.click(getProperty("CHEAT_YES_BUTTON"));
browser.waitForPageToLoad(TIMEOUT);
- number = Integer.parseInt(browser.getText(getProperty("CHEAT_NUMBER")));
+ number = Integer.parseInt(extractNumber(browser.getText(getProperty("CHEAT_NUMBER"))));
browser.click(getProperty("CHEAT_DONE_BUTTON"));
browser.waitForPageToLoad(TIMEOUT);
enterGuess(number);
assertTrue("User should win when cheating. Random number was " + number, isOnWinPage());
}
+
+ public String extractNumber(String str) {
+ if (str == null) {
+ return null;
+ }
+ StringBuffer strBuff = new StringBuffer();
+ char c;
+
+ for (int i = 0; i < str.length() ; i++) {
+ c = str.charAt(i);
+
+ if (Character.isDigit(c)) {
+ strBuff.append(c);
+ }
+ }
+ return strBuff.toString();
+ }
}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties 2009-09-21 07:30:40 UTC (rev 11500)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/numberguess/src/org/jboss/seam/example/numberguess/test/selenium/numberguess.properties 2009-09-21 08:03:19 UTC (rev 11501)
@@ -31,6 +31,6 @@
GUESS_RADIO_ITEM NumberGuessMain:selectGuessRadio:{0}
GUESS_SUBMIT NumberGuessMain:GuessButton
CHEAT_BUTTON NumberGuessMain:CheatButton
-CHEAT_YES_BUTTON confirm:YesButton
-CHEAT_NUMBER cheat:RandomNumber
-CHEAT_DONE_BUTTON cheat\:DoneButton
\ No newline at end of file
+CHEAT_YES_BUTTON xpath\=//input[@type\='submit'][@value\='Yes']
+CHEAT_NUMBER xpath\=//form/text()[contains(.,'answer')]
+CHEAT_DONE_BUTTON xpath\=//input[@type\='submit'][@value\='Done']
15 years, 3 months
Seam SVN: r11500 - branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/groovybooking.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-21 03:30:40 -0400 (Mon, 21 Sep 2009)
New Revision: 11500
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/groovybooking/build.xml
Log:
JBPAPP-2829 Build file of groovybooking example modified
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/groovybooking/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/groovybooking/build.xml 2009-09-18 10:35:21 UTC (rev 11499)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/groovybooking/build.xml 2009-09-21 07:30:40 UTC (rev 11500)
@@ -23,7 +23,7 @@
<project name="groovybooking.ftest.build" basedir="." default="build">
<property name="example.name" value="groovybooking" />
<property name="jboss.deploy.target" value="jbosswar.deploy" />
- <property name="jbosss.example.ready.check.url" value="jboss-seam-groovy/home.seam" />
+ <property name="jboss.example.ready.check.url" value="jboss-seam-groovy/home.seam" />
<import file="../build.xml" />
15 years, 3 months
Seam SVN: r11499 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples: seambay/src/org/jboss/seam/example/seambay/test/selenium and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-09-18 06:35:21 -0400 (Fri, 18 Sep 2009)
New Revision: 11499
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
Log:
JBPAPP-2829 Seambays joystick selling test changed and dvdstore build file updated
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml 2009-09-17 10:30:21 UTC (rev 11498)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/dvdstore/build.xml 2009-09-18 10:35:21 UTC (rev 11499)
@@ -22,7 +22,7 @@
-->
<project name="dvdstore.ftest.build" basedir="." default="build">
<property name="example.name" value="dvdstore" />
- <property name="jboss.example.ready.check.url" value="seam-dvdstore/search.seam" />
+ <property name="jboss.example.ready.check.url" value="seam-dvd/search.seam" />
<import file="../build.xml" />
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java 2009-09-17 10:30:21 UTC (rev 11498)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java 2009-09-18 10:35:21 UTC (rev 11499)
@@ -76,7 +76,7 @@
@Override
public boolean until()
{
- return browser.isElementPresent(getProperty("SELL_CATEGORY_SELECT"));
+ return browser.isElementPresent(getProperty("SELL_CATEGORY_SELECT_SECOND_OPTION"));
}
};
browser.select(getProperty("SELL_CATEGORY_SELECT"), "index=" + category);
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-09-17 10:30:21 UTC (rev 11498)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-09-18 10:35:21 UTC (rev 11499)
@@ -34,6 +34,7 @@
SELL_NEXT id=sellForm:next
SELL_CONFIRM id=sellForm:confirm
SELL_CATEGORY_SELECT id=rootCategory
+SELL_CATEGORY_SELECT_SECOND_OPTION xpath\=id("rootCategory")/option[14] \# availability of second option indicates that category list has been loaded (2)
SELL_SUBCATEGORY_SELECT id\=tier2
SEARCH_FIELD id=search:searchTerm
@@ -52,4 +53,4 @@
BID_HISTORY_COUNT //table[@id='history']/tbody/tr
BID_OUTBID id=outbid
BID_HIGH_BIDDER id\=highBidder
-BID_HISTORY_BACK id\=back
\ No newline at end of file
+BID_HISTORY_BACK id\=back
15 years, 3 months