Seam SVN: r12051 - branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium.
by seam-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2010-02-14 05:11:08 -0500 (Sun, 14 Feb 2010)
New Revision: 12051
Modified:
branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
Log:
JBQA-2983, wait for credentials updates is no more ambiguous
Modified: branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java 2010-02-12 13:44:38 UTC (rev 12050)
+++ branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java 2010-02-14 10:11:08 UTC (rev 12051)
@@ -130,7 +130,9 @@
browser.click(LOGIN_LINK);
waitForElementPresent(LOGIN_INPUT_PASSWORD, TIMEOUT);
browser.type(LOGIN_INPUT_USERNAME, username);
+ browser.waitForCondition("var elem = selenium.browserbot.getCurrentWindow().document.getElementById('serviceRequest'); elem.value.indexOf('<arg0>"+username+"</arg0>')!=-1;", TIMEOUT);
browser.type(LOGIN_INPUT_PASSWORD, password);
+ browser.waitForCondition("var elem = selenium.browserbot.getCurrentWindow().document.getElementById('serviceRequest'); elem.value.indexOf('<arg1>"+password+"</arg1>')!=-1;", TIMEOUT);
browser.click(INVOKE_SERVICE_BUTTON);
browser.waitForAJAXUpdate();
}
14 years, 11 months
Seam SVN: r12050 - branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium.
by seam-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2010-02-12 08:44:38 -0500 (Fri, 12 Feb 2010)
New Revision: 12050
Modified:
branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
Log:
JBQA-2983, using AJAX waits for webservices
Modified: branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java 2010-02-12 13:43:38 UTC (rev 12049)
+++ branches/community/Seam_2_2/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java 2010-02-12 13:44:38 UTC (rev 12050)
@@ -18,38 +18,33 @@
* 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 static org.testng.AssertJUnit.assertTrue;
+
+import org.jboss.seam.example.common.test.selenium.SeamSelenium;
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
+ * This class tests a functionality of web service test page available directly
* from SeamBay home page
*
* @author Martin Gencur
+ * @author kpiwko
*
*/
public class WebServiceTestPageTest extends SeleniumSeamBayTest
{
-
- protected static final Long TIMEOUT = 35000L; //35 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 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\")]";
@@ -60,75 +55,110 @@
protected static final String CONFIRM_AUCTION_LINK = "xpath=//a[contains(text(),\"Confirm auction\")]";
protected static final String FIND_AUCTIONS_LINK = "xpath=//a[contains(text(),\"Find Auctions\")]";
protected static final String LOGOUT_LINK = "xpath=//a[contains(text(),\"Logout\")]";
-
- /*login parameters*/
+
+ /* login parameters */
protected static final String LOGIN_INPUT_USERNAME = "id=username";
protected static final String LOGIN_INPUT_PASSWORD = "id=password";
-
- /*create new auction parameters*/
+
+ /* 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*/
+
+ /* parameters for other tests */
protected static final String SEARCH_TERM = "id=searchTerm";
protected static final String AUCTION_DURATION = "id=duration";
protected static final String STARTING_PRICE = "id=price";
+
+ /**
+ * Modifies AJAX waits to match behavior of asynchronous services
+ *
+ * @return Modified SeamSelenium browser
+ */
+ @Override
+ public SeamSelenium startBrowser()
+ {
+ SeamSelenium newBrowser = new SeamSelenium(HOST, PORT, BROWSER, BROWSER_URL)
+ {
+ /**
+ * Wait until service says it is executing a request
+ */
+ @Override
+ public void waitForAJAXUpdate(String timeout)
+ {
+ waitForCondition("selenium.browserbot.getCurrentWindow().selectedService.active===false", timeout);
+ };
+ /**
+ * Check typed result in the request field
+ */
+ @Override
+ public void type(String locator, String value)
+ {
+ super.type(locator, value);
+ waitForCondition("var elem = selenium.browserbot.getCurrentWindow().document.getElementById('serviceRequest'); elem.value.indexOf('"+value+"')!=-1;", TIMEOUT);
+ }
+ };
+ newBrowser.start();
+ newBrowser.allowNativeXpath("false");
+ newBrowser.setSpeed(SPEED);
+ newBrowser.setTimeout(TIMEOUT);
+ return newBrowser;
+ }
+
@Test
- public void simplePageContentTest(){
+ public void simplePageContentTest()
+ {
browser.clickAndWait(HERE_LINK);
waitForElementPresent(RESPONSE_AREA, TIMEOUT);
- assertTrue("Page should contain service page heading",browser.isTextPresent(SERVICE_PAGE_HEADING));
+ assertTrue("Page should contain service page heading", browser.isTextPresent(SERVICE_PAGE_HEADING));
}
-
- @Test(dependsOnMethods={"simplePageContentTest"})
- public void loginTest(){
- loginService();
+
+ @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(){
+ assertTrue("Response area should contain \"true\"", x.contains(getProperty("LOGIN_RIGHT_RESPONSE")));
+ }
+
+ public void loginService()
+ {
String username = "demo";
- String password = "demo";
+ String password = "demo";
browser.clickAndWait(HERE_LINK);
browser.click(LOGIN_LINK);
waitForElementPresent(LOGIN_INPUT_PASSWORD, TIMEOUT);
browser.type(LOGIN_INPUT_USERNAME, username);
- browser.type(LOGIN_INPUT_PASSWORD, password);
- try
- {
- Thread.sleep(TIMEOUT/2);
- }
- catch (InterruptedException e)
- {
- }
+ browser.type(LOGIN_INPUT_PASSWORD, password);
browser.click(INVOKE_SERVICE_BUTTON);
- waitForElementContent(RESPONSE_AREA, TIMEOUT);
+ browser.waitForAJAXUpdate();
}
-
- @Test(dependsOnMethods={"loginTest"})
- public void listCategoriesTest(){
- loginService();
+
+ @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);
+ browser.waitForAJAXUpdate();
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();
+ 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(){
+ 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";
@@ -139,36 +169,38 @@
waitForElementPresent(AUCTION_CATEGORY_ID, TIMEOUT);
browser.type(AUCTION_TITLE, title);
browser.type(AUCTION_DESCRIPTION, description);
- browser.type(AUCTION_CATEGORY_ID, categoryId);
+ browser.type(AUCTION_CATEGORY_ID, categoryId);
waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
browser.click(INVOKE_SERVICE_BUTTON);
- waitForElementContent(RESPONSE_AREA, TIMEOUT);
+ browser.waitForAJAXUpdate();
}
-
- @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
- public void findAuctionsTest(){
- String searchTerm = "Animals";
- loginService();
- createNewAuctionService();
+
+ @Test(dependsOnMethods = { "loginTest", "createNewAuctionTest" })
+ public void findAuctionsTest()
+ {
+ String searchTerm = "Animals";
+ loginService();
+ createNewAuctionService();
confirmAuctionService();
waitForElementPresent(FIND_AUCTIONS_LINK, TIMEOUT);
browser.click(FIND_AUCTIONS_LINK);
- waitForElementPresent(SEARCH_TERM, TIMEOUT);
+ waitForElementPresent(SEARCH_TERM, TIMEOUT);
browser.type(SEARCH_TERM, searchTerm);
waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
browser.click(INVOKE_SERVICE_BUTTON);
- waitForElementContent(RESPONSE_AREA, TIMEOUT);
+ browser.waitForAJAXUpdate();
String x = browser.getValue(RESPONSE_AREA);
- assertTrue("Response area should contain information about finding auction.", x.contains(getProperty("FIND_AUCTIONS_RESPONSE")));
- }
-
- @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
- public void updateAuctionTest(){
+ assertTrue("Response area should contain information about finding auction.", x.contains(getProperty("FIND_AUCTIONS_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods = { "loginTest", "createNewAuctionTest" })
+ public void updateAuctionTest()
+ {
String title = "Animals";
String description = "Another description";
- String categoryId = "5";
- loginService();
- createNewAuctionService();
+ String categoryId = "5";
+ loginService();
+ createNewAuctionService();
waitForElementPresent(UPDATE_AUCTION_DETAILS_LINK, TIMEOUT);
browser.click(UPDATE_AUCTION_DETAILS_LINK);
waitForElementPresent(AUCTION_TITLE, TIMEOUT);
@@ -176,89 +208,96 @@
waitForElementPresent(AUCTION_CATEGORY_ID, TIMEOUT);
browser.type(AUCTION_TITLE, title);
browser.type(AUCTION_DESCRIPTION, description);
- browser.type(AUCTION_CATEGORY_ID, categoryId);
+ browser.type(AUCTION_CATEGORY_ID, categoryId);
waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
browser.click(INVOKE_SERVICE_BUTTON);
- waitForElementContent(RESPONSE_AREA, TIMEOUT);
+ browser.waitForAJAXUpdate();
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();
+ 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);
+ waitForElementPresent(AUCTION_DURATION, TIMEOUT);
browser.type(AUCTION_DURATION, duration);
waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
browser.click(INVOKE_SERVICE_BUTTON);
- waitForElementContent(RESPONSE_AREA, TIMEOUT);
+ browser.waitForAJAXUpdate();
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();
+ 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);
+ waitForElementPresent(STARTING_PRICE, TIMEOUT);
browser.type(STARTING_PRICE, price);
waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
browser.click(INVOKE_SERVICE_BUTTON);
- waitForElementContent(RESPONSE_AREA, TIMEOUT);
+ browser.waitForAJAXUpdate();
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();
+ 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);
+ browser.waitForAJAXUpdate();
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();
+ 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);
+ browser.waitForAJAXUpdate();
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();
+ assertTrue("Response area should contain logout confirmation.", x.contains(getProperty("LOGOUT_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods = { "loginTest", "createNewAuctionTest" })
+ public void confirmAuctionTest()
+ {
+ loginService();
+ createNewAuctionService();
confirmAuctionService();
String x = browser.getValue(RESPONSE_AREA);
- assertTrue("Response area should contain information about confirmation.", x.contains(getProperty("CONFIRMATION_RESPONSE")));
- }
-
- public void confirmAuctionService(){
+ assertTrue("Response area should contain information about confirmation.", x.contains(getProperty("CONFIRMATION_RESPONSE")));
+ }
+
+ public void confirmAuctionService()
+ {
waitForElementPresent(CONFIRM_AUCTION_LINK, TIMEOUT);
browser.click(CONFIRM_AUCTION_LINK);
waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
browser.click(INVOKE_SERVICE_BUTTON);
- waitForElementContent(RESPONSE_AREA, TIMEOUT);
+ browser.waitForAJAXUpdate();
}
-
- public void waitForElementPresent(final String locator, Long timeout){
+
+ protected void waitForElementPresent(final String locator, String timeout)
+ {
new Wait()
{
@Override
@@ -266,18 +305,7 @@
{
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. Element: " + locator+ ", " + "Content length: "
- + browser.getValue(locator).length(), timeout);
- } //waitForElementContent
+ }.wait("Timeout while waiting for element " + locator + " present.", Long.parseLong(timeout));
+ } // waitForElementPresent
+
}
14 years, 11 months
Seam SVN: r12049 - branches/community/Seam_2_2/src/test/ftest/examples/tasks/src/org/jboss/seam/example/tasks/test/selenium.
by seam-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2010-02-12 08:43:38 -0500 (Fri, 12 Feb 2010)
New Revision: 12049
Modified:
branches/community/Seam_2_2/src/test/ftest/examples/tasks/src/org/jboss/seam/example/tasks/test/selenium/SeleniumTasksTest.java
Log:
JBQA-2983, modified to use SeamSelenium AJAX wait
Modified: branches/community/Seam_2_2/src/test/ftest/examples/tasks/src/org/jboss/seam/example/tasks/test/selenium/SeleniumTasksTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/tasks/src/org/jboss/seam/example/tasks/test/selenium/SeleniumTasksTest.java 2010-02-12 13:41:56 UTC (rev 12048)
+++ branches/community/Seam_2_2/src/test/ftest/examples/tasks/src/org/jboss/seam/example/tasks/test/selenium/SeleniumTasksTest.java 2010-02-12 13:43:38 UTC (rev 12049)
@@ -29,8 +29,8 @@
import org.testng.annotations.Test;
/**
- * This is the base class for Tasks functional tests.
- * Uses jQuery library and Selenium to match AJAX updates.
+ * This is the base class for Tasks functional tests. Uses jQuery library and
+ * Selenium to match AJAX updates.
*
* @author kpiwko
*
@@ -166,14 +166,6 @@
}
/**
- * Waits until all existing jQuery request are processed
- */
- protected void waitForJQueryUpdate()
- {
- browser.waitForCondition("selenium.browserbot.getCurrentWindow().jQuery.active===0", TIMEOUT);
- }
-
- /**
* Presses undo button for given task
*
* @param task The task name
@@ -211,7 +203,7 @@
protected void navigate(String anchor)
{
browser.clickAndWait(anchor);
- waitForJQueryUpdate();
+ browser.waitForAJAXUpdate();
}
/**
@@ -225,11 +217,12 @@
{
String btn = buttonPresent(description, button);
browser.click(btn);
- waitForJQueryUpdate();
+ browser.waitForAJAXUpdate();
}
/**
* Checks whether button is present on page
+ *
* @param description The task/category associated with button
* @param button Button type label
* @return Button locator
@@ -243,6 +236,7 @@
/**
* Checks whether button is not present on page
+ *
* @param description The task/category associated with button
* @param button Button type label
* @return Button locator
@@ -256,6 +250,7 @@
/**
* Creates new task
+ *
* @param category Category of the task
* @param description Description of the task
*/
@@ -264,11 +259,12 @@
browser.select(NEW_TASK_CATEGORY, String.format("value=%s", category));
browser.type(NEW_TASK_DESCRIPTION, description);
browser.click(NEW_TASK_SUBMIT);
- waitForJQueryUpdate();
+ browser.waitForAJAXUpdate();
}
/**
- * Edits task
+ * Edits task
+ *
* @param task Old description of the task
* @param newCategory New category
* @param newDescription Old description of the task
@@ -277,22 +273,23 @@
{
String btn = buttonPresent(task, EDIT_BTN_TITLE);
browser.click(btn);
- waitForJQueryUpdate();
+ browser.waitForAJAXUpdate();
browser.select(EDIT_TASK_CATEGORY, String.format("value=%s", newCategory));
browser.type(EDIT_TASK_DESCRIPTION, newDescription);
browser.click(EDIT_TASK_SUBMIT);
- waitForJQueryUpdate();
+ browser.waitForAJAXUpdate();
}
/**
* Creates new category
+ *
* @param category Category description
*/
protected void newCategory(String category)
{
browser.type(NEW_CATEGORY_DESCRIPTION, category);
browser.click(NEW_CATEGORY_SUBMIT);
- waitForJQueryUpdate();
+ browser.waitForAJAXUpdate();
}
}
14 years, 11 months
Seam SVN: r12048 - branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium.
by seam-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2010-02-12 08:41:56 -0500 (Fri, 12 Feb 2010)
New Revision: 12048
Modified:
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
Log:
JBQA-2983, added AJAX wait to Seam selenium
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-02-12 13:39:26 UTC (rev 12047)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-02-12 13:41:56 UTC (rev 12048)
@@ -36,20 +36,20 @@
*/
public class SeamSelenium extends DefaultSelenium
{
-
+
private String timeout = "30000";
private boolean icefacesDetection = false;
private long icefacesWaitTime = 1000;
private long windowMaximizeWaitTime = 5000L;
-
+
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;']";
-
+
public SeamSelenium(String serverHost, int serverPort, String browserStartCommand, String browserURL)
{
super(serverHost, serverPort, browserStartCommand, browserURL);
}
-
+
/**
* Same as click method but waits for page to load after clicking. Default
* timeout can be changed by setTimeout() method.
@@ -61,7 +61,7 @@
click(locator);
waitForPageToLoad();
}
-
+
/**
* Simulates a user pressing "back" button and waits for page to load.
* Default timeout can be changed by setTimeout() method.
@@ -71,7 +71,7 @@
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.
@@ -81,25 +81,25 @@
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)
{
@@ -112,26 +112,52 @@
super.waitForPageToLoad(timeout);
}
}
-
+
/**
+ * Waits until any AJAX worker is registered by underlying framework performs update.
+ * Uses default (global) timeout
+ */
+ public void waitForAJAXUpdate()
+ {
+ waitForAJAXUpdate(timeout);
+ }
+
+ /**
+ * Waits until any AJAX worker is registered by underlying framework performs update.
+ *
+ * @param timeout Timeout in milliseconds
+ */
+ public void waitForAJAXUpdate(String timeout)
+ {
+ // there are two frameworks supposed, either jQuery or Prototype
+ if (icefacesDetection)
+ {
+ // Prototype style
+ waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount===0", timeout);
+ }
+ else
+ {
+ // jQuery style
+ waitForCondition("selenium.browserbot.getCurrentWindow().jQuery.active===0", timeout);
+ }
+ }
+
+ /**
* Waits until element is asynchronously loaded on page. Uses global Selenium
* timeout
*
- * @param locator
- * Locator of element
+ * @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
+ * @param timeout Timeout in milliseconds
+ * @param locator Locator of element
*/
public void waitForElement(final String locator, long timeout)
{
@@ -144,14 +170,12 @@
}
}.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
+ * @param timeout Timeout in milliseconds
+ * @param locator Locator of element
*/
public void waitForElementNotPresent(final String locator, long timeout)
{
@@ -164,12 +188,11 @@
}
}.wait("Timeout while waiting for asynchronous update of " + locator, timeout);
}
-
+
/**
* Selects windows by its id. Waits until windows is refreshed.
*
- * @param windowID
- * Identification of window which is selected
+ * @param windowID Identification of window which is selected
*/
@Override
public void selectWindow(String windowID)
@@ -178,7 +201,7 @@
refresh();
waitForPageToLoad();
}
-
+
/**
* Returns true if icefaces detection is turned on
*/
@@ -186,7 +209,7 @@
{
return icefacesDetection;
}
-
+
/**
* Switch icefaces detection on/off
*
@@ -196,7 +219,7 @@
{
this.icefacesDetection = icefacesDetection;
}
-
+
/**
* This wait time will be used when waiting for response after invoking
* icefaces action
@@ -205,7 +228,7 @@
{
return icefacesWaitTime;
}
-
+
/**
* This wait time will be used when waiting for response after invoking
* icefaces action
@@ -216,7 +239,7 @@
{
this.icefacesWaitTime = icefacesWaitTime;
}
-
+
/**
* Captures a screenshot and stores it into a file. Active windows is
* maximized before capturing a screenshot.
@@ -234,7 +257,7 @@
}
super.captureScreenshot(path);
}
-
+
/**
* Logs HTML body into a file.
*
@@ -265,7 +288,7 @@
}
}
}
-
+
private void waitForIcefaces(Long waitTime, Long timeout)
{
new Wait()
14 years, 11 months
Seam SVN: r12047 - branches/community/Seam_2_2/examples/seambay/view.
by seam-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2010-02-12 08:39:26 -0500 (Fri, 12 Feb 2010)
New Revision: 12047
Modified:
branches/community/Seam_2_2/examples/seambay/view/test.js
Log:
JBSEAM-4541, added active flag to ServiceMetadata
Modified: branches/community/Seam_2_2/examples/seambay/view/test.js
===================================================================
--- branches/community/Seam_2_2/examples/seambay/view/test.js 2010-02-12 11:59:51 UTC (rev 12046)
+++ branches/community/Seam_2_2/examples/seambay/view/test.js 2010-02-12 13:39:26 UTC (rev 12047)
@@ -14,6 +14,7 @@
this.group = group;
this.parameters = new Array();
this.conversational = false;
+ this.active = false;
webServices[name] = this;
@@ -24,6 +25,7 @@
ServiceMetadata.prototype.getRequest = function() { return this.request; };
ServiceMetadata.prototype.setConversational = function(val) { this.conversational = val; };
ServiceMetadata.prototype.isConversational = function() { return this.conversational; };
+ ServiceMetadata.prototype.setActive = function(val) { this.active = val; };
}
// start of web service definitions
@@ -291,6 +293,7 @@
req.open("POST", getEndpoint(), true);
req.setRequestHeader("Content-type", "text/xml");
req.send(document.getElementById("serviceRequest").value);
+ selectedService.setActive(true);
}
function receiveResponse(req)
@@ -309,7 +312,8 @@
document.getElementById("conversationId").value = cid;
}
}
-
+ selectedService.setActive(false);
+
if (req.status != 200)
{
alert("There was an error processing your request. Error code: " + req.status);
@@ -367,4 +371,4 @@
}
}
-initServices();
\ No newline at end of file
+initServices();
14 years, 11 months
Seam SVN: r12046 - tags.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-02-12 06:59:51 -0500 (Fri, 12 Feb 2010)
New Revision: 12046
Added:
tags/JBPAPP_5_0_1-CR1/
Log:
created tag for EAP 5.0.1 CR1 build
Copied: tags/JBPAPP_5_0_1-CR1 (from rev 12021, branches/enterprise/JBPAPP_5_0)
14 years, 11 months
Seam SVN: r12045 - in branches/community/Seam_2_2/src: main/org/jboss/seam/navigation and 1 other directories.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-02-12 06:54:10 -0500 (Fri, 12 Feb 2010)
New Revision: 12045
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/faces/DateConverter.java
branches/community/Seam_2_2/src/main/org/jboss/seam/navigation/Param.java
branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java
Log:
JBSEAM-4413
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/faces/DateConverter.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/faces/DateConverter.java 2010-02-12 11:49:22 UTC (rev 12044)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/faces/DateConverter.java 2010-02-12 11:54:10 UTC (rev 12045)
@@ -12,6 +12,7 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
+import org.jboss.seam.Component;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
@@ -117,4 +118,10 @@
}
return super.getAsString(context, component, value);
}
+
+ public static javax.faces.convert.Converter getInstance(){
+
+ return (javax.faces.convert.Converter) Component.getInstance("org.jboss.seam.faces.dateConverter");
+
+ }
}
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/navigation/Param.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/navigation/Param.java 2010-02-12 11:49:22 UTC (rev 12044)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/navigation/Param.java 2010-02-12 11:54:10 UTC (rev 12045)
@@ -1,5 +1,6 @@
package org.jboss.seam.navigation;
+import java.util.Date;
import java.util.Map;
import javax.el.ELContext;
@@ -67,15 +68,23 @@
else if (valueExpression==null)
{
return null;
- }
+ }
else
{
Class<?> type = valueExpression.getType();
- if (type==null)
+ if (type == null)
{
return null;
}
- return FacesContext.getCurrentInstance().getApplication().createConverter(type);
+
+ if (type.equals(Date.class))
+ {
+ return org.jboss.seam.faces.DateConverter.getInstance();
+ }
+ else
+ {
+ return FacesContext.getCurrentInstance().getApplication().createConverter(type);
+ }
}
}
Modified: branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java 2010-02-12 11:49:22 UTC (rev 12044)
+++ branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java 2010-02-12 11:54:10 UTC (rev 12045)
@@ -1,5 +1,7 @@
package org.jboss.seam.test.unit;
+import java.util.Date;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.IntegerConverter;
@@ -10,6 +12,7 @@
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Validators;
+import org.jboss.seam.faces.DateConverter;
import org.jboss.seam.navigation.Param;
import org.testng.annotations.Test;
@@ -45,6 +48,15 @@
}
@Test
+ public void testDateConverter()
+ {
+ Param param = setupParam(false);
+
+ assert DateConverter.class.equals(param.getConverter().getClass());
+
+ }
+
+ @Test
public void testGetValidatorById() throws ClassNotFoundException
{
String validatorId = "TestValidator";
@@ -84,6 +96,20 @@
}
return param;
}
+
+ protected Param setupParam(boolean disableModelValidator)
+ {
+ installComponent(Contexts.getApplicationContext(), DateConverter.class);
+ Param param = new Param("birthDate");
+ param.setValueExpression(Expressions.instance().createValueExpression("#{bean.birthDate}"));
+ Bean bean = new Bean();
+ bean.setBirthDate(new Date());
+ Contexts.getEventContext().set("bean", bean);
+ if (disableModelValidator) {
+ param.setValidateModel(false);
+ }
+ return param;
+ }
public static class TestValidator implements Validator
{
@@ -94,6 +120,15 @@
class Bean {
private String value;
+ private Date birthDate;
+ public Date getBirthDate()
+ {
+ return birthDate;
+ }
+ public void setBirthDate(Date birth)
+ {
+ this.birthDate = birth;
+ }
@Length(min = 3, max = 10)
public String getValue() {
return value;
14 years, 11 months
Seam SVN: r12044 - branches/community/Seam_2_2/examples/booking/view.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-02-12 06:49:22 -0500 (Fri, 12 Feb 2010)
New Revision: 12044
Modified:
branches/community/Seam_2_2/examples/booking/view/register.xhtml
Log:
removed unnecessarily comma in footer
Modified: branches/community/Seam_2_2/examples/booking/view/register.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/booking/view/register.xhtml 2010-02-12 11:46:06 UTC (rev 12043)
+++ branches/community/Seam_2_2/examples/booking/view/register.xhtml 2010-02-12 11:49:22 UTC (rev 12044)
@@ -93,7 +93,7 @@
</div>
- <div id="footer">Created with JBoss EJB 3.0, Seam, JSF (Mojarra), and Facelets</div>
+ <div id="footer">Created with JBoss EJB 3.0, Seam, JSF (Mojarra) and Facelets</div>
</div>
14 years, 11 months
Seam SVN: r12043 - branches/community/Seam_2_2.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-02-12 06:46:06 -0500 (Fri, 12 Feb 2010)
New Revision: 12043
Modified:
branches/community/Seam_2_2/build.xml
Log:
updated condition for ant version
Modified: branches/community/Seam_2_2/build.xml
===================================================================
--- branches/community/Seam_2_2/build.xml 2010-02-12 09:30:42 UTC (rev 12042)
+++ branches/community/Seam_2_2/build.xml 2010-02-12 11:46:06 UTC (rev 12043)
@@ -3,7 +3,11 @@
<!-- Check that we are using Ant 1.7.0. Not using <antversion> as it wasn't available until 1.7.0. -->
<condition property="compatible.ant">
- <contains string="${ant.version}" substring="1.7.0"/>
+ <or>
+ <contains string="${ant.version}" substring="1.7.0"/>
+ <contains string="${ant.version}" substring="1.8.0"/>
+ </or>
+
</condition>
<fail unless="compatible.ant">You are using ${ant.version}. You must use Ant 1.7.0 to build Seam. Ant 1.7.1 has known bugs.</fail>
14 years, 11 months
Seam SVN: r12042 - branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-02-12 04:30:42 -0500 (Fri, 12 Feb 2010)
New Revision: 12042
Modified:
branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/TestEjbLocal.java
Log:
JBPAPP-3713 tests
Modified: branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/TestEjbLocal.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/TestEjbLocal.java 2010-02-12 05:56:06 UTC (rev 12041)
+++ branches/enterprise/JBPAPP_5_0/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/TestEjbLocal.java 2010-02-12 09:30:42 UTC (rev 12042)
@@ -6,4 +6,5 @@
public interface TestEjbLocal
{
boolean foo();
+ void remove();
}
14 years, 11 months