1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.jameleon.plugin.jiffie.tags;
21
22 import net.sf.jameleon.plugin.jiffie.IEFunctionTag;
23
24 /***
25 * Validates text or a regular expression can be found in the current HTML document.
26 *
27 * Some examples might be:
28 *
29 * Verify the page has the text 'some text on the page' is on the current page
30 * <pre><source>
31 * <ie-validate-text functionId="Verify that 'some text on the page' exists on the current page."
32 * text="some text on the page" />
33 * </source></pre>
34 * Verify the page has text that looks like a date '12/21/2006' on the current page, but we don't care about the exact value.
35 * <pre><source>
36 * <ie-validate-text functionId="Verify the page has text that looks like a date '12/21/2006' on the current page"
37 * text="[//d]{2}/[//d]{2}/[//d]{4}"
38 * regex="true" />
39 * </source></pre>
40 * @jameleon.function name="ie-validate-text" type="validation"
41 * @jameleon.step Assert that given text or regular expression is present in current document.
42 */
43 public class IEValidateTextTag extends IEFunctionTag {
44
45 /***
46 * The text to validate the existence of.
47 * @jameleon.attribute required="true" contextName="ieValidateTextText"
48 */
49 protected String text;
50
51 /***
52 * Specifies whether the text represents a regular expression.
53 *
54 * @jameleon.attribute required="false" contextName="ieValidateTextRegex"
55 */
56 protected boolean regex;
57
58 public void testBlock() {
59 assertTextPresent(text, regex);
60 }
61 }