Add a easy way to verify that alert text is present

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

Branch: refs/heads/5.4-js-rewrite
Commit: 3c4ee267898033b6c0b250d980512545ac5615c7
Parents: 7cdb639
Author: Howard M. Lewis Ship <hls...@apache.org>
Authored: Mon Nov 26 10:52:00 2012 -0800
Committer: Howard M. Lewis Ship <hls...@apache.org>
Committed: Mon Nov 26 10:52:00 2012 -0800

----------------------------------------------------------------------
 .../integration/TapestryCoreTestCase.java          |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3c4ee267/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
index 8907ba6..51a5673 100644
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
+++ 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
@@ -51,4 +51,18 @@ public abstract class TapestryCoreTestCase extends 
SeleniumTestCase
             assertFieldValue(id, values[i]);
         }
     }
+
+    /**
+     * Asserts that the text of the first alert matches the given value. Waits 
for the alerts container
+     * and the alert itself to appear.
+     *
+     * @param text
+     */
+    protected final void assertFirstAlert(String text)
+    {
+        waitForCSSSelectedElementToAppear("[data-container-type=alerts] 
.alert");
+
+        // Add the special "x" for the close button to the text.
+        assertText("[data-container-type=alerts] .alert", "\u00d7" + text);
+    }
 }

Reply via email to