[seam-commits] Seam SVN: r15620 - in branches/enterprise/WFK-2_1/examples: seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene and 5 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Oct 21 08:17:24 EDT 2013


Author: rsmeral
Date: 2013-10-21 08:17:24 -0400 (Mon, 21 Oct 2013)
New Revision: 15620

Modified:
   branches/enterprise/WFK-2_1/examples/seambay/seambay-ejb/
   branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/SellTest.java
   branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/WebServicesTest.java
   branches/enterprise/WFK-2_1/examples/seambay/seambay-web/
   branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb/
   branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/RoleTest.java
   branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/UserTest.java
   branches/enterprise/WFK-2_1/examples/tasks/tasks-ftest/src/test/java/org/jboss/seam/example/tasks/test/graphene/TasksFunctionalTest.java
   branches/enterprise/WFK-2_1/examples/ui/ui-ftest/src/test/java/org/jboss/seam/example/ui/test/graphene/UIHTMLUnitTest.java
Log:
Fix forgotten ftests for new Graphene API


Property changes on: branches/enterprise/WFK-2_1/examples/seambay/seambay-ejb
___________________________________________________________________
Added: svn:ignore
   + target


Modified: branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/SellTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/SellTest.java	2013-10-15 11:53:02 UTC (rev 15619)
+++ branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/SellTest.java	2013-10-21 12:17:24 UTC (rev 15620)
@@ -81,11 +81,11 @@
 
     protected void submitSell2Page(int category, int subcategory) {
         assertTrue("Navigation failure, sell2 page expected", browser.getCurrentUrl().contains(getProperty("SELL_2_URL")));
-        waitModel().until(element(getBy("SELL_CATEGORY_SELECT_SECOND_OPTION")).isPresent());
+        waitModel().until().element(getBy("SELL_CATEGORY_SELECT_SECOND_OPTION")).is().present();
         new Select(browser.findElement(getBy("SELL_CATEGORY_SELECT"))).selectByIndex(category);
 
         if (subcategory != 0) {
-            waitModel().until(element(getBy("SELL_SUBCATEGORY_SELECT")).isPresent());
+            waitModel().until().element(getBy("SELL_SUBCATEGORY_SELECT")).is().present();
             new Select(browser.findElement(getBy("SELL_SUBCATEGORY_SELECT"))).selectByIndex(subcategory);
         }
         clickAndWaitHttp(getBy("SELL_NEXT"));

Modified: branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/WebServicesTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/WebServicesTest.java	2013-10-15 11:53:02 UTC (rev 15619)
+++ branches/enterprise/WFK-2_1/examples/seambay/seambay-ftest/src/test/java/org/jboss/seam/example/seambay/test/graphene/WebServicesTest.java	2013-10-21 12:17:24 UTC (rev 15620)
@@ -4,8 +4,8 @@
 import java.net.MalformedURLException;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.container.test.api.RunAsClient;
-import static org.jboss.arquillian.graphene.Graphene.*;
 import org.jboss.arquillian.graphene.wait.WebDriverWait;
+import org.jboss.arquillian.graphene.wait.WebDriverWaitImpl;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.arquillian.junit.InSequence;
 import org.jboss.seam.example.common.test.DeploymentResolver;
@@ -106,7 +106,7 @@
 
         // the same as Selenium, must use getValue to retrieve text inside
         // <textarea></textarea>
-        waitCustom().withMessage("Response area should contain \"true\"").until(element(RESPONSE_AREA).attribute("value").contains(LOGIN_RIGHT_RESPONSE));
+        waitCustom().withMessage("Response area should contain \"true\"").until().element(RESPONSE_AREA).attribute("value").contains(LOGIN_RIGHT_RESPONSE);
     }
 
     @Test
@@ -116,7 +116,7 @@
         clickAndWaitForPage(LIST_CATEGORIES_LINK_TEXT);
         clickAndWaitAjax(INVOKE_SERVICE_BUTTON);
         waitForCidUpdate();
-        waitCustom().withMessage("Response area should contain a list of categories.").until(element(RESPONSE_AREA).attribute("value").contains(LIST_CATEGORIES_RESPONSE));
+        waitCustom().withMessage("Response area should contain a list of categories.").until().element(RESPONSE_AREA).attribute("value").contains(LIST_CATEGORIES_RESPONSE);
     }
 
     @Test
@@ -127,8 +127,8 @@
 
         waitCustom().withMessage("Response area should contain information about creating the auction.").until(new Predicate() {
             public boolean apply(Object t) {
-                return element(RESPONSE_AREA).attribute("value").contains(CREATE_NEW_AUCTION_RESPONSE_JBOSS_56).apply(browser)
-                        || element(RESPONSE_AREA).attribute("value").contains(CREATE_NEW_AUCTION_RESPONSE_JBOSS_4).apply(browser);
+                return browser.findElement(RESPONSE_AREA).getAttribute("value").contains(CREATE_NEW_AUCTION_RESPONSE_JBOSS_56)
+                        || browser.findElement(RESPONSE_AREA).getAttribute("value").contains(CREATE_NEW_AUCTION_RESPONSE_JBOSS_4);
             }
         });
     }
@@ -145,7 +145,7 @@
         type(SEARCH_TERM, searchTerm);
         clickAndWaitAjax(INVOKE_SERVICE_BUTTON);
         waitForCidUpdate();
-        waitCustom().withMessage("Response area should contain information about finding auction.").until(element(RESPONSE_AREA).attribute("value").contains(FIND_AUCTIONS_RESPONSE));
+        waitCustom().withMessage("Response area should contain information about finding auction.").until().element(RESPONSE_AREA).attribute("value").contains(FIND_AUCTIONS_RESPONSE);
     }
 
     @Test
@@ -165,8 +165,8 @@
         waitForCidUpdate();
         waitCustom().withMessage("Response area should contain information about updating the auction.").until(new Predicate() {
             public boolean apply(Object t) {
-                return element(RESPONSE_AREA).attribute("value").contains(UPDATE_AUCTION_RESPONSE_JBOSS_56).apply(browser)
-                        || element(RESPONSE_AREA).attribute("value").contains(UPDATE_AUCTION_RESPONSE_JBOSS_4).apply(browser);
+                return browser.findElement(RESPONSE_AREA).getAttribute("value").contains(UPDATE_AUCTION_RESPONSE_JBOSS_56)
+                        || browser.findElement(RESPONSE_AREA).getAttribute("value").contains(UPDATE_AUCTION_RESPONSE_JBOSS_4);
             }
         });
     }
@@ -184,8 +184,8 @@
         waitForCidUpdate();
         waitCustom().withMessage("Response area should contain information about setting duration.").until(new Predicate() {
             public boolean apply(Object t) {
-                return element(RESPONSE_AREA).attribute("value").contains(SET_DURATION_RESPONSE_JBOSS_56).apply(browser)
-                        || element(RESPONSE_AREA).attribute("value").contains(SET_DURATION_RESPONSE_JBOSS_4).apply(browser);
+                return browser.findElement(RESPONSE_AREA).getAttribute("value").contains(SET_DURATION_RESPONSE_JBOSS_56)
+                        || browser.findElement(RESPONSE_AREA).getAttribute("value").contains(SET_DURATION_RESPONSE_JBOSS_4);
             }
         });
 
@@ -204,8 +204,8 @@
         waitForCidUpdate();
         waitCustom().withMessage("Response area should contain information about setting starting price.").until(new Predicate() {
             public boolean apply(Object t) {
-                return element(RESPONSE_AREA).attribute("value").contains(SET_STARTING_PRICE_RESPONSE_JBOSS_56).apply(browser)
-                        || element(RESPONSE_AREA).attribute("value").contains(SET_STARTING_PRICE_RESPONSE_JBOSS_4).apply(browser);
+                return browser.findElement(RESPONSE_AREA).getAttribute("value").contains(SET_STARTING_PRICE_RESPONSE_JBOSS_56)
+                        || browser.findElement(RESPONSE_AREA).getAttribute("value").contains(SET_STARTING_PRICE_RESPONSE_JBOSS_4);
             }
         });
     }
@@ -220,7 +220,7 @@
         clickAndWaitAjax(INVOKE_SERVICE_BUTTON);
         waitUntilValueNotEmpty(RESPONSE_AREA);
         waitForCidUpdate();
-        waitCustom().withMessage("Response area should contain auction details.").until(element(RESPONSE_AREA).attribute("value").contains(AUCTION_DETAILS_PRICE_RESPONSE));
+        waitCustom().withMessage("Response area should contain auction details.").until().element(RESPONSE_AREA).attribute("value").contains(AUCTION_DETAILS_PRICE_RESPONSE);
     }
 
     @Test
@@ -230,7 +230,7 @@
         clickAndWaitForPage(LOGOUT_LINK_TEXT);
         clickAndWaitAjax(INVOKE_SERVICE_BUTTON);
 
-        waitCustom().withMessage("Response area should contain logout confirmation.").until(element(RESPONSE_AREA).attribute("value").contains(LOGOUT_RESPONSE));
+        waitCustom().withMessage("Response area should contain logout confirmation.").until().element(RESPONSE_AREA).attribute("value").contains(LOGOUT_RESPONSE);
     }
 
     @Test
@@ -241,8 +241,8 @@
         confirmAuctionService();
         waitCustom().withMessage("Response area should contain information about confirmation.").until(new Predicate() {
             public boolean apply(Object t) {
-                return element(RESPONSE_AREA).attribute("value").contains(CONFIRMATION_RESPONSE_JBOSS_56).apply(browser)
-                        || element(RESPONSE_AREA).attribute("value").contains(CONFIRMATION_RESPONSE_JBOSS_4).apply(browser);
+                return browser.findElement(RESPONSE_AREA).getAttribute("value").contains(CONFIRMATION_RESPONSE_JBOSS_56)
+                        || browser.findElement(RESPONSE_AREA).getAttribute("value").contains(CONFIRMATION_RESPONSE_JBOSS_4);
             }
         });
     }
@@ -255,7 +255,7 @@
         String password = "demo";
 
         open(contextPath.toString() + getProperty("HOME_PAGE"));
-        waitCustom().until(element(HERE_LINK).isPresent());
+        waitCustom().until().element(HERE_LINK).is().present();
         clickAndWaitHttp(HERE_LINK);
 
         clickAndWaitForPage(LOGIN_LINK_TEXT);
@@ -265,7 +265,7 @@
 
         clickAndWaitAjax(INVOKE_SERVICE_BUTTON);
         waitForCidUpdate();
-        waitCustom().until(element(RESPONSE_AREA).attribute("value").contains(LOGIN_RIGHT_RESPONSE));
+        waitCustom().until().element(RESPONSE_AREA).attribute("value").contains(LOGIN_RIGHT_RESPONSE);
     }
 
     protected void confirmAuctionService() {
@@ -287,9 +287,9 @@
     }
 
     protected void clickAndWaitForPage(String linkText) {
-        waitCustom().until(element(By.partialLinkText(linkText)).isPresent());
+        waitCustom().until().element(By.partialLinkText(linkText)).is().present();
         click(By.partialLinkText(linkText));
-        waitCustom().until(element(SELECTED_SERVICE).text().contains(linkText));
+        waitCustom().until().element(SELECTED_SERVICE).text().contains(linkText);
     }
 
     protected void waitForCidUpdate() {
@@ -302,7 +302,7 @@
     }
 
     public WebDriverWait waitCustom() {
-        return new WebDriverWait<Void>(null, browser, WAIT_TIMEOUT);
+        return new WebDriverWaitImpl<Void>(null, browser, WAIT_TIMEOUT);
     }
 
     protected void waitUntilValueNotEmpty(final By by) {


Property changes on: branches/enterprise/WFK-2_1/examples/seambay/seambay-web
___________________________________________________________________
Added: svn:ignore
   + target



Property changes on: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ejb
___________________________________________________________________
Added: svn:ignore
   + target


Modified: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/RoleTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/RoleTest.java	2013-10-15 11:53:02 UTC (rev 15619)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/RoleTest.java	2013-10-21 12:17:24 UTC (rev 15620)
@@ -108,7 +108,7 @@
         assertTrue("Expected role deletion confirmation.", confirm.getText().contains(getProperty("ROLE_TABLE_DELETE_CONFIRMATION")));
         confirm.accept();
         sleep(2000);
-        waitModel().until(element(getBy(roleRow)).not().isPresent());
+        waitModel().until().element(getBy(roleRow)).is().not().present();
         assertFalse("Removed role still present.", isElementPresent(getBy(roleRow)));
     }
 

Modified: branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/UserTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/UserTest.java	2013-10-15 11:53:02 UTC (rev 15619)
+++ branches/enterprise/WFK-2_1/examples/seamspace/seamspace-ftest/src/test/java/org/jboss/seam/example/seamspace/test/graphene/UserTest.java	2013-10-21 12:17:24 UTC (rev 15620)
@@ -97,7 +97,7 @@
         click(getBy(userRow + getProperty("USER_TABLE_DELETE")));
         browser.switchTo().alert().accept();
         browser.switchTo().window(windowHandle);
-        waitModel().until(element(getBy(userRow)).not().isPresent());
+        waitModel().until().element(getBy(userRow)).is().not().present();
         assertFalse("User " + username + " exists after deletion", isElementPresent(getBy(userRow)));
     }
 

Modified: branches/enterprise/WFK-2_1/examples/tasks/tasks-ftest/src/test/java/org/jboss/seam/example/tasks/test/graphene/TasksFunctionalTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/tasks/tasks-ftest/src/test/java/org/jboss/seam/example/tasks/test/graphene/TasksFunctionalTest.java	2013-10-15 11:53:02 UTC (rev 15619)
+++ branches/enterprise/WFK-2_1/examples/tasks/tasks-ftest/src/test/java/org/jboss/seam/example/tasks/test/graphene/TasksFunctionalTest.java	2013-10-21 12:17:24 UTC (rev 15620)
@@ -89,7 +89,7 @@
         type(getBy(LOGIN_PASSWORD), DEFAULT_PASSWORD);
         click(getBy(LOGIN_SUBMIT));
         sleep(2000);// ugly, but need to wait until the table is fully (ajax) loaded
-        waitModel().until(element(getBy(CATEGORIES_PRESENT)).isPresent());
+        waitModel().until().element(getBy(CATEGORIES_PRESENT)).is().present();
         
         assertTrue("Navigation failure. Tasks page expected.", browser.getCurrentUrl().contains(TASKS_URL));
     }
@@ -101,7 +101,7 @@
         buttonMissing(turing, RESOLVE_BTN_TITLE);
         click(getBy(RESOLVED_LINK));
         sleep(2000);// ugly, but need to wait until the table is fully (ajax) loaded
-        waitModel().until(element(getBy(TASKS_PRESENT)).isPresent());
+        waitModel().until().element(getBy(TASKS_PRESENT)).is().present();
 
         buttonPresent(turing, UNDO_BTN_TITLE);
         clickAndWaitHttp(getBy(LOGOUT_LINK));
@@ -114,7 +114,7 @@
         buttonMissing(milk, RESOLVE_BTN_TITLE);
         click(getBy(RESOLVED_LINK));
         sleep(2000);// ugly, but need to wait until the table is fully (ajax) loaded
-        waitModel().until(element(getBy(TASKS_PRESENT)).isPresent());
+        waitModel().until().element(getBy(TASKS_PRESENT)).is().present();
 
         buttonMissing(milk, UNDO_BTN_TITLE);
         clickAndWaitHttp(getBy(LOGOUT_LINK));
@@ -125,14 +125,14 @@
         String turtle = "Buy a turtle";
         click(getBy(RESOLVED_LINK));
         sleep(2000);// ugly, but need to wait until the table is fully (ajax) loaded
-        waitModel().until(element(getBy(TASKS_PRESENT)).isPresent());
+        waitModel().until().element(getBy(TASKS_PRESENT)).is().present();
 
         undoTask(turtle);
         buttonMissing(turtle, UNDO_BTN_TITLE);
 
         click(getBy(TASKS_LINK));
         sleep(2000);// ugly, but need to wait until the table is fully (ajax) loaded
-        waitModel().until(element(getBy(CATEGORIES_PRESENT)).isPresent());
+        waitModel().until().element(getBy(CATEGORIES_PRESENT)).is().present();
 
         buttonPresent(turtle, RESOLVE_BTN_TITLE);
         clickAndWaitHttp(getBy(LOGOUT_LINK));
@@ -153,7 +153,7 @@
         String category = "JBoss QA";
         click(getBy(CATEGORIES_LINK));
         sleep(2000);// ugly, but need to wait until the table is fully (ajax) loaded
-        waitModel().until(element(getBy(CATEGORIES_PRESENT)).isPresent());
+        waitModel().until().element(getBy(CATEGORIES_PRESENT)).is().present();
 
         newCategory(category);
         buttonPresent(category, DELETE_BTN_CAT_TITLE);
@@ -173,11 +173,11 @@
         String category = "School";
         click(getBy(CATEGORIES_LINK));
         sleep(2000);// ugly, but need to wait until the table is fully (ajax) loaded
-        waitModel().until(element(getBy(CATEGORIES_PRESENT)).isPresent());
+        waitModel().until().element(getBy(CATEGORIES_PRESENT)).is().present();
 
         buttonPress(category, DELETE_BTN_CAT_TITLE);
         By by = getBy(String.format(ACTION_BUTTON_FORMATTER, category, DELETE_BTN_CAT_TITLE));
-        waitModel().until(element(by).not().isPresent());
+        waitModel().until().element(by).is().not().present();
         buttonMissing(category, DELETE_BTN_CAT_TITLE);
 
         // all tasks from category are deleted as well
@@ -194,7 +194,7 @@
      */
     protected void undoTask(String task) {
         By by = buttonPress(task, UNDO_BTN_TITLE);
-        waitModel().until(element(by).not().isPresent());
+        waitModel().until().element(by).is().not().present();
     }
 
     /**
@@ -204,7 +204,7 @@
      */
     protected void resolveTask(String task) {
         By by = buttonPress(task, RESOLVE_BTN_TITLE);
-        waitModel().until(element(by).not().isPresent());
+        waitModel().until().element(by).is().not().present();
     }
 
     /**
@@ -214,7 +214,7 @@
      */
     protected void deleteTask(String task) {
         By by = buttonPress(task, DELETE_BTN_TITLE);
-        waitModel().until(element(by).not().isPresent());
+        waitModel().until().element(by).is().not().present();
     }
 
     /**
@@ -240,7 +240,7 @@
     protected By buttonPresent(String description, String button) {
         String btnStr = String.format(ACTION_BUTTON_FORMATTER, description, button);
         By btn = getBy(btnStr);
-        waitModel().until(element(btn).isPresent());
+        waitModel().until().element(btn).is().present();
         assertTrue("There should be a '" + button + "' button for: " + description + ".", isElementPresent(btn));
         return btn;
     }
@@ -270,7 +270,7 @@
         type(getBy(NEW_TASK_DESCRIPTION), description);
         clickAndWaitAjax(getBy(NEW_TASK_SUBMIT));
         By by = getBy(String.format(ACTION_BUTTON_FORMATTER, description, RESOLVE_BTN_TITLE));
-        waitModel().until(element(by).isPresent());
+        waitModel().until().element(by).is().present();
 
     }
 
@@ -289,7 +289,7 @@
         clickAndWaitAjax(getBy(EDIT_TASK_SUBMIT));
 
         By by = getBy(String.format(ACTION_BUTTON_FORMATTER, newDescription, RESOLVE_BTN_TITLE));
-        waitModel().until(element(by).isPresent());
+        waitModel().until().element(by).is().present();
 
     }
 
@@ -303,6 +303,6 @@
         type(getBy(NEW_CATEGORY_DESCRIPTION), category);
         clickAndWaitAjax(getBy(NEW_CATEGORY_SUBMIT));
         By by = getBy(String.format(ACTION_BUTTON_FORMATTER, category, DELETE_BTN_CAT_TITLE));
-        waitModel().until(element(by).isPresent());
+        waitModel().until().element(by).is().present();
     }
 }

Modified: branches/enterprise/WFK-2_1/examples/ui/ui-ftest/src/test/java/org/jboss/seam/example/ui/test/graphene/UIHTMLUnitTest.java
===================================================================
--- branches/enterprise/WFK-2_1/examples/ui/ui-ftest/src/test/java/org/jboss/seam/example/ui/test/graphene/UIHTMLUnitTest.java	2013-10-15 11:53:02 UTC (rev 15619)
+++ branches/enterprise/WFK-2_1/examples/ui/ui-ftest/src/test/java/org/jboss/seam/example/ui/test/graphene/UIHTMLUnitTest.java	2013-10-21 12:17:24 UTC (rev 15620)
@@ -67,13 +67,13 @@
         ((JavascriptExecutor) browser).executeScript("document.getElementById(arguments[0]).value = arguments[1]", browser.findElement(FILE_UPLOAD_FILE).getAttribute("id"), IMAGE_TO_UPLOAD);
 
         Graphene.guardHttp(browser.findElement(FILE_UPLOAD_UPDATE)).click();
-        assertTrue("Page should contain \"Successfully updated\"", Graphene.element(FILE_UPLOAD_RESPONSE).isPresent().apply(browser));
+        assertTrue("Page should contain \"Successfully updated\"", browser.findElement(FILE_UPLOAD_RESPONSE).isDisplayed());
     }
 
     @Test
     @InSequence(2)
     public void graphicImageTest() throws IOException {
         Graphene.guardHttp(browser.findElement(GRAPHIC_IMAGE_LINK)).click();
-        assertTrue("Page should contain image of Pete Muir", Graphene.element(IMAGE).isPresent().apply(browser));
+        assertTrue("Page should contain image of Pete Muir", browser.findElement(IMAGE).isDisplayed());
     }
 }



More information about the seam-commits mailing list