01: package watij;
02:
03: public class PageContainsTextTest extends WatijTestCase {
04:
05: protected void setUp() throws Exception {
06: super .setUp();
07: ie.goTo(HTML_ROOT + "textsearch.html");
08: }
09:
10: public void testTextFound() throws Exception {
11: assertTrue(ie
12: .containsText("slings and arrows of outrageous fortune"));
13: }
14:
15: public void testTextNotFound() throws Exception {
16: assertFalse(ie
17: .containsText("So are they all, all honourable men"));
18: }
19:
20: public void testRegexFound() throws Exception {
21: assertTrue(ie.containsText("/bodkin.*fardels/"));
22: }
23:
24: public void testRegexNotFound() throws Exception {
25: assertFalse(ie.containsText("/winding.*watch.*wit/"));
26: }
27:
28: public void testMatchRegexFound() throws Exception {
29: if (ie.containsText("/Messages ([0-9]+)/")) {
30:
31: }
32: }
33:
34: //containsText returns a boolean.
35: //
36: // def test_match_regexp_found
37: // $~ = $ie.contains_text(/Messages ([0-9]+)/)
38: // assert_equal('42', $1)
39: // end
40: //
41: //java cant test bad arguments...it just wont compile for this scenario
42: // def test_bad_search_argument
43: // assert_raises(ArgumentError) do
44: // $ie.contains_text()
45: // end
46: // assert_raises(MissingWayOfFindingObjectException) do
47: // $ie.contains_text(nil)
48: // end
49: // assert_raises(MissingWayOfFindingObjectException) do
50: // $ie.contains_text(42)
51: // end
52: // end
53: //
54: // end
55: }
|