You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2018/11/23 14:17:38 UTC

tapestry-5 git commit: Attempt to fix TapestryBeanValidationIntegrationTests.client_validation

Repository: tapestry-5
Updated Branches:
  refs/heads/master 1c2444a6c -> 3f099a5b2


Attempt to fix TapestryBeanValidationIntegrationTests.client_validation

in Jeknins

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3f099a5b
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3f099a5b
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3f099a5b

Branch: refs/heads/master
Commit: 3f099a5b204ff5cdb3156a49196af8f65bf88786
Parents: 1c2444a
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
Authored: Fri Nov 23 12:14:36 2018 -0200
Committer: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
Committed: Fri Nov 23 12:14:36 2018 -0200

----------------------------------------------------------------------
 .../TapestryBeanValidationIntegrationTests.java      | 11 ++++++++++-
 .../org/apache/tapestry5/test/SeleniumTestCase.java  | 15 +++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3f099a5b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
----------------------------------------------------------------------
diff --git a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
index bfd9999..539b823 100644
--- a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
+++ b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
@@ -117,6 +117,7 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase
         //@NotNull
         click(SUBMIT);
 
+        waitForCssSelectorToAppear("p[data-error-block-for='notNullValue']");
         assertTextPresent("Not Null Value may not be null");
 
         type("notNullValue", "igor");
@@ -126,6 +127,7 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase
 
         click(SUBMIT);
 
+        waitForCssSelectorToAppear("p[data-error-block-for='minValue']");
         assertTextPresent("Min Value must be greater than or equal to 6");
 
         //@Max
@@ -145,6 +147,7 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase
 
         click(SUBMIT);
 
+        waitForCssSelectorToAppear("p[data-error-block-for='stringSizeValue']");
         assertTextPresent("String Size Value size must be between 3 and 6");
         
         //@Size(min) TAP5-2158
@@ -154,12 +157,14 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase
 
         final String stringMinLengthErrorMessage = "String Min Length size must be between 3 and " + Integer.MAX_VALUE;
         
+        waitForCssSelectorToAppear("p[data-error-block-for='stringMinLength']");
 		assertTextPresent(stringMinLengthErrorMessage);
         
         type("stringMinLength", "aaaaaa");
 
         click(SUBMIT);
-        
+
+        waitForInvisible("p[data-error-block-for='stringMinLength']");
         assertFalse(isTextPresent(stringMinLengthErrorMessage));
         
         //@Size(max) TAP5-2158
@@ -169,12 +174,14 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase
 
         final String stringMaxLengthErrorMessage = "String Max Length size must be between 0 and 6";
         
+        waitForCssSelectorToAppear("p[data-error-block-for='stringMaxLength']");
 		assertTextPresent(stringMaxLengthErrorMessage);
 
         type("stringMaxLength", "aaaaa");
 
         click(SUBMIT);
 
+        waitForInvisible("p[data-error-block-for='stringMaxLength']");
         assertFalse(isTextPresent(stringMaxLengthErrorMessage));
 
         click(SUBMIT);
@@ -190,8 +197,10 @@ public class TapestryBeanValidationIntegrationTests extends SeleniumTestCase
 
         click(SUBMIT);
 
+        waitForCssSelectorToAppear("p[data-error-block-for='languages']");
         assertTextPresent("Languages size must be between 2 and 3");
 
+        waitForCssSelectorToAppear("p[data-error-block-for='nullValue']");
         assertTextPresent("Null Value must be null");
     }
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3f099a5b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
index 34806f8..ab3c0b3 100644
--- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
+++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
@@ -1687,6 +1687,21 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
 
         waitForCondition(condition, PAGE_LOAD_TIMEOUT);
     }
+    
+    /**
+     * Waits for an element with a given CSS selector to appear.
+     *
+     * @param selector
+     *         the CSS selector to wait.
+     * @since 5.5
+     */
+    protected final void waitForCssSelectorToAppear(String selector)
+    {
+
+        String condition = String.format("selenium.browserbot.getCurrentWindow().document.querySelector(\"%s\")", selector);
+
+        waitForCondition(condition, PAGE_LOAD_TIMEOUT);
+    }
 
     /**
      * Waits for the element to be removed from the DOM.