watir 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/readme.rb +211 -0
  2. data/unittests/WindowLogonExample.rb +30 -0
  3. data/unittests/WindowLogonExtra.rb +7 -0
  4. data/unittests/all_tests.rb +10 -0
  5. data/unittests/all_tests_concurrent.rb +57 -0
  6. data/unittests/attachToExistingWindow_test.rb +40 -0
  7. data/unittests/buttons_test.rb +131 -0
  8. data/unittests/checkbox_test.rb +149 -0
  9. data/unittests/core_tests.rb +9 -0
  10. data/unittests/css_test.rb +60 -0
  11. data/unittests/div_test.rb +179 -0
  12. data/unittests/errorchecker_test.rb +29 -0
  13. data/unittests/filefield_test.rb +35 -0
  14. data/unittests/form_test.rb +279 -0
  15. data/unittests/frame_test.rb +141 -0
  16. data/unittests/html/blankpage.html +12 -0
  17. data/unittests/html/buttons1.html +40 -0
  18. data/unittests/html/checkboxes1.html +69 -0
  19. data/unittests/html/complex_table.html +36 -0
  20. data/unittests/html/cssTest.html +42 -0
  21. data/unittests/html/div.html +105 -0
  22. data/unittests/html/fileupload.html +45 -0
  23. data/unittests/html/formTest1.html +39 -0
  24. data/unittests/html/forms2.html +45 -0
  25. data/unittests/html/forms3.html +132 -0
  26. data/unittests/html/forms4.html +27 -0
  27. data/unittests/html/frame_buttons.html +4 -0
  28. data/unittests/html/frame_links.html +4 -0
  29. data/unittests/html/frame_multi.html +5 -0
  30. data/unittests/html/iframeTest.html +13 -0
  31. data/unittests/html/iframeTest1.html +7 -0
  32. data/unittests/html/iframeTest2.html +6 -0
  33. data/unittests/html/images/1.gif +0 -0
  34. data/unittests/html/images/2.GIF +0 -0
  35. data/unittests/html/images/3.GIF +0 -0
  36. data/unittests/html/images/button.jpg +0 -0
  37. data/unittests/html/images/circle.jpg +0 -0
  38. data/unittests/html/images/minus.GIF +0 -0
  39. data/unittests/html/images/originaltriangle.jpg +0 -0
  40. data/unittests/html/images/plus.gif +0 -0
  41. data/unittests/html/images/square.jpg +0 -0
  42. data/unittests/html/images/triangle.jpg +0 -0
  43. data/unittests/html/images1.html +52 -0
  44. data/unittests/html/javascriptevents.html +39 -0
  45. data/unittests/html/link_pass.html +11 -0
  46. data/unittests/html/links1.html +37 -0
  47. data/unittests/html/links2.html +11 -0
  48. data/unittests/html/nestedFrames.html +6 -0
  49. data/unittests/html/pass.html +10 -0
  50. data/unittests/html/popups1.html +60 -0
  51. data/unittests/html/radioButtons1.html +71 -0
  52. data/unittests/html/select_tealeaf.html +54 -0
  53. data/unittests/html/selectboxes1.html +55 -0
  54. data/unittests/html/simple_table.html +26 -0
  55. data/unittests/html/simple_table_buttons.html +104 -0
  56. data/unittests/html/simple_table_columns.html +76 -0
  57. data/unittests/html/table1.html +142 -0
  58. data/unittests/html/textarea.html +30 -0
  59. data/unittests/html/textfields1.html +87 -0
  60. data/unittests/html/textsearch.html +44 -0
  61. data/unittests/ie_mock.rb +93 -0
  62. data/unittests/ie_test.rb +50 -0
  63. data/unittests/images_test.rb +179 -0
  64. data/unittests/iostring.rb +30 -0
  65. data/unittests/iostring_test.rb +48 -0
  66. data/unittests/js_events_test.rb +77 -0
  67. data/unittests/jscriptExtraAlert.rb +6 -0
  68. data/unittests/jscriptExtraConfirmCancel.rb +7 -0
  69. data/unittests/jscriptExtraConfirmOk.rb +7 -0
  70. data/unittests/jscriptPushButton.rb +5 -0
  71. data/unittests/jscript_test.rb +57 -0
  72. data/unittests/links_test.rb +169 -0
  73. data/unittests/minmax_test.rb +31 -0
  74. data/unittests/navigate_test.rb +56 -0
  75. data/unittests/non_core_tests.rb +9 -0
  76. data/unittests/pagecontainstext_test.rb +49 -0
  77. data/unittests/popups_test.rb +44 -0
  78. data/unittests/radios_test.rb +164 -0
  79. data/unittests/screen_capture_test.rb +53 -0
  80. data/unittests/selectbox_test.rb +197 -0
  81. data/unittests/send_keys_test.rb +29 -0
  82. data/unittests/setup.rb +47 -0
  83. data/unittests/table_test.rb +306 -0
  84. data/unittests/textAreafields_test.rb +81 -0
  85. data/unittests/textfields_test.rb +239 -0
  86. data/watir.rb +3744 -0
  87. data/watir/AutoItX3.dll +0 -0
  88. data/watir/WindowHelper.rb +47 -0
  89. data/watir/camel_case.rb +37 -0
  90. data/watir/clickJSDialog.rb +19 -0
  91. data/watir/cookiemanager.rb +53 -0
  92. data/watir/exceptions.rb +60 -0
  93. data/watir/screen_capture.rb +115 -0
  94. data/watir/setFileDialog.rb +16 -0
  95. data/watir/testUnitAddons.rb +47 -0
  96. data/watir/watir_simple.rb +475 -0
  97. data/watir/winClicker.rb +505 -0
  98. metadata +152 -0
@@ -0,0 +1,77 @@
1
+ # feature tests for JavaScript events
2
+ # revision: $Revision: 1.13 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+
7
+ class TC_JSEvents < Test::Unit::TestCase
8
+ include Watir
9
+
10
+
11
+ def gotoJavaScriptEventsPage()
12
+ $ie.goto($htmlRoot + "javascriptevents.html")
13
+ end
14
+
15
+
16
+ def test_Button_disabled
17
+ gotoJavaScriptEventsPage()
18
+ assert_false($ie.button(:caption, "Button 1").enabled?)
19
+ end
20
+
21
+ def test_Button_Enabled
22
+ gotoJavaScriptEventsPage()
23
+
24
+ $ie.text_field(:name, "entertext").fire_event("onkeyup")
25
+ assert($ie.button(:caption, "Button 1").enabled?)
26
+
27
+ end
28
+
29
+ def test_Button_click
30
+
31
+ gotoJavaScriptEventsPage()
32
+
33
+ puts "Firing event to make button enabled"
34
+ $ie.text_field(:name, "entertext").fire_event("onKeyUp")
35
+ puts "Clicking the button"
36
+
37
+ $ie.button(:caption, "Button 1").click
38
+ assert($ie.contains_text("PASS") )
39
+ end
40
+
41
+ #onMouseOver tests
42
+ #window status
43
+
44
+ def test_no_status_bar_exception
45
+ gotoJavaScriptEventsPage()
46
+ $ie.link(:text, "New Window No Status Bar").click
47
+ status_bar_test_win = nil
48
+ assert_nothing_raised { status_bar_test_win = Watir::IE.attach(:title, "Pass Page") }
49
+ assert_raises( Watir::NoStatusBarException ) { status_bar_test_win.status }
50
+ status_bar_test_win.close
51
+ status_bar_test_win = nil
52
+
53
+ end
54
+
55
+
56
+ def test_page_nostatus
57
+ gotoJavaScriptEventsPage()
58
+ assert_false($ie.status == "Here is your status")
59
+ end
60
+
61
+ def test_page_status
62
+ gotoJavaScriptEventsPage()
63
+ $ie.link(:text, "Check the Status").fire_event("onMouseOver")
64
+ assert($ie.status, "It worked")
65
+ end
66
+
67
+ def test_page_status
68
+ gotoJavaScriptEventsPage()
69
+ $ie.link(:text, "Clear the Status").fire_event("onMouseOver")
70
+ assert($ie.status, "")
71
+ end
72
+ #end of window status
73
+
74
+ #end of onMouseOver tests
75
+
76
+ end
77
+
@@ -0,0 +1,6 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
2
+
3
+ require 'watir/WindowHelper'
4
+
5
+ helper = WindowHelper.new
6
+ helper.push_alert_button()
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
2
+
3
+ require 'watir/WindowHelper'
4
+
5
+
6
+ helper = WindowHelper.new
7
+ helper.push_confirm_button_cancel()
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
2
+
3
+ require 'watir/WindowHelper'
4
+
5
+
6
+ helper = WindowHelper.new
7
+ helper.push_confirm_button_ok()
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
2
+ require 'watir'
3
+
4
+ ie = Watir::IE.attach(:title, 'Alert Test')
5
+ ie.button(:id, 'btnAlert').click
@@ -0,0 +1,57 @@
1
+ # feature tests for AutoIt wrapper
2
+ # revision: $Revision: 1.8 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+ require 'watir/WindowHelper'
7
+
8
+ $mydir = File.expand_path(File.dirname(__FILE__)).gsub('/', '\\')
9
+
10
+ class TC_JavaScript_Test < Test::Unit::TestCase
11
+ include Watir
12
+ @@attach = true
13
+ @@javascript_page_title = 'Alert Test'
14
+ @@javascript_page = $htmlRoot + 'JavascriptClick.htm'
15
+
16
+ def setup
17
+ begin
18
+ WindowHelper.check_autoit_installed
19
+ rescue Watir::Exception::WatirException
20
+ puts "Problem with Autoit - is it installed?."
21
+ exit
22
+ rescue
23
+ puts "There is a Problem with Autoit - is it installed?."
24
+ exit
25
+ end
26
+ end
27
+
28
+ def goto_javascript_page()
29
+ $ie.goto(@@javascript_page)
30
+ end
31
+
32
+ def check_dialog(extra_file, expected_result, &block)
33
+ goto_javascript_page()
34
+ Thread.new { system("rubyw \"#{$mydir}\\#{extra_file}.rb\"") }
35
+
36
+ block.call
37
+ testResult = $ie.text_field(:id, "testResult").value
38
+ assert_match( expected_result, testResult )
39
+ end
40
+
41
+ def test_alert_button()
42
+ check_dialog('jscriptExtraAlert', /Alert OK/){ $ie.button(:id, 'btnAlert').click }
43
+ end
44
+ def test_alert_button2()
45
+ check_dialog('jscriptPushButton', /Alert OK/){ sleep 0.1; WindowHelper.new.push_alert_button }
46
+ end
47
+ def test_confirm_button_ok()
48
+ check_dialog('jscriptExtraConfirmOk', /Confirm OK/){ push_confirm_button }
49
+ end
50
+ def test_confirm_button_Cancel()
51
+ check_dialog('jscriptExtraConfirmCancel', /Confirm Cancel/){push_confirm_button}
52
+ end
53
+
54
+ def push_confirm_button
55
+ $ie.button(:id, 'btnInformation').click
56
+ end
57
+ end
@@ -0,0 +1,169 @@
1
+ # feature tests for Links
2
+ # revision: $Revision: 1.33 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+
7
+ class TC_Links < Test::Unit::TestCase
8
+ include Watir
9
+
10
+ def gotoLinksPage()
11
+ $ie.goto($htmlRoot + "links1.html")
12
+ end
13
+
14
+ def gotoFrameLinksPage()
15
+ $ie.goto($htmlRoot + "frame_links.html")
16
+ end
17
+
18
+ def setup()
19
+ gotoLinksPage()
20
+ end
21
+
22
+ def xtest_new_link_exists
23
+ assert(exists?{$ie.link(:text, "test1")})
24
+ assert(exists?{$ie.link(:text, /TEST/i)})
25
+ assert_false(exists?{$ie.link(:text, "missing")})
26
+ assert_false(exists?{$ie.link(:text, /miss/)})
27
+
28
+ gotoFrameLinksPage()
29
+ assert(exists?{$ie.frame("buttonFrame").link(:text, "test1")})
30
+ assert_false(exists?{$ie.frame("buttonFrame").link(:text, "missing")})
31
+
32
+ assert_false(exists?{ie.frame("missing").link(:text, "test1")})
33
+ end
34
+
35
+ def test_links_in_frames
36
+ gotoFrameLinksPage()
37
+
38
+ assert($ie.frame("buttonFrame").link(:text, "test1").exists?)
39
+ assert_false($ie.frame("buttonFrame").link(:text, "missing").exists?)
40
+
41
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.frame("buttonFrame").link(:index, 199).href }
42
+ assert_match( /links2/ ,$ie.frame("buttonFrame").link(:index, 1).href )
43
+
44
+ count =0
45
+ $ie.frame("buttonFrame").links.each do |l|
46
+ count+=1
47
+ end
48
+
49
+ assert_equal( 9 , count)
50
+ end
51
+
52
+ def test_Link_Exists
53
+ assert($ie.link(:text, "test1").exists?)
54
+ assert($ie.link(:text, /TEST/i).exists?)
55
+ assert_false($ie.link(:text, "missing").exists?)
56
+ assert_false($ie.link(:text, /miss/).exists?)
57
+
58
+ # this assert we have to build up the path
59
+ # this is what it looks like if you do a to_s on the link file:///C:/watir_bonus/unitTests/html/links1.HTML
60
+ # but what we get back from $htmlRoot is a mixed case, so its almost impossible for use to test this correctly
61
+ # assert($ie.link(:url,'file:///C:/watir_bonus/unitTests/html/links1.HTML' ).exists?)
62
+
63
+ assert($ie.link(:url, /link_pass.html/).exists?)
64
+ assert_false($ie.link(:url, "alsomissing.html").exists?)
65
+
66
+ assert($ie.link(:id, "link_id").exists?)
67
+ assert_false($ie.link(:id, "alsomissing").exists?)
68
+
69
+ assert($ie.link(:id, /_id/).exists?)
70
+ assert_false($ie.link(:id, /alsomissing/).exists?)
71
+
72
+ assert($ie.link(:name, "link_name").exists?)
73
+ assert_false($ie.link(:name, "alsomissing").exists?)
74
+
75
+ assert($ie.link(:name, /_n/).exists?)
76
+ assert_false($ie.link(:name, /missing/).exists?)
77
+
78
+ assert($ie.link(:title, /ti/).exists?)
79
+ assert($ie.link(:title, "link_title").exists?)
80
+
81
+ assert_false($ie.link(:title, /missing/).exists?)
82
+
83
+ assert($ie.link(:url, /_pass/).exists?)
84
+ assert_false($ie.link(:url, /dont_exist/).exists?)
85
+ end
86
+
87
+ def test_Link_click
88
+ $ie.link(:text, "test1").click
89
+ assert( $ie.contains_text("Links2-Pass") )
90
+
91
+ gotoLinksPage()
92
+ $ie.link(:url, /link_pass.html/).click
93
+ assert( $ie.contains_text("Links3-Pass") )
94
+
95
+ gotoLinksPage()
96
+
97
+ $ie.link(:index, 1).click
98
+ assert( $ie.contains_text("Links2-Pass") )
99
+
100
+ gotoLinksPage()
101
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).click }
102
+ end
103
+
104
+ def test_link_properties
105
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).href }
106
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).value}
107
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).innerText }
108
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).name }
109
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).id }
110
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).disabled }
111
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.link(:index, 199).type }
112
+
113
+ assert_match( /links2/ ,$ie.link(:index, 1).href )
114
+ assert_equal( "" , $ie.link(:index, 1).value)
115
+ assert_equal( "test1" , $ie.link(:index, 1).innerText )
116
+ assert_equal( "" , $ie.link(:index, 1).name )
117
+ assert_equal( "" , $ie.link(:index, 1).id )
118
+ assert_equal( false , $ie.link(:index, 1).disabled )
119
+ assert_equal( "link" , $ie.link(:index, 1).type )
120
+
121
+ assert_equal( "link_id" , $ie.link(:index, 6).id )
122
+ assert_equal( "link_name" , $ie.link(:index, 7).name )
123
+
124
+ assert_equal( "" , $ie.link(:index, 7).title)
125
+
126
+ assert_equal( "link_title" , $ie.link(:index, 8).title)
127
+ end
128
+
129
+ def test_link_iterator
130
+ assert_equal(9, $ie.links.length )
131
+ assert_equal("Link Using a name" , $ie.links[7].innerText)
132
+
133
+ index = 1
134
+ $ie.links.each do |link|
135
+ assert_equal( $ie.link(:index, index).href , link.href )
136
+ assert_equal( $ie.link(:index, index).id , link.id )
137
+ assert_equal( $ie.link(:index, index).name , link.name )
138
+ assert_equal( $ie.link(:index, index).innerText , link.innerText )
139
+ index+=1
140
+ end
141
+ end
142
+ end
143
+
144
+ require 'unittests/iostring'
145
+ class TC_showlinks < Test::Unit::TestCase
146
+ include MockStdoutTestCase
147
+
148
+ def test_showLinks
149
+ $ie.goto($htmlRoot + "links1.html")
150
+ $stdout = @mockout
151
+ $ie.showLinks
152
+ expected = [/^index name +id +href + text\/src$/,
153
+ get_path_regex(1, "links2.html","test1"),
154
+ get_path_regex(2, "link_pass.html","test1"),
155
+ get_path_regex(3, "pass3.html", " / file:///#{$myDir.downcase}/html/images/button.jpg"),
156
+ get_path_regex(4, "textarea.html", "new window"),
157
+ get_path_regex(5, "textarea.html", "new window"),
158
+ get_path_regex(6, "links1.html", "link using an id", "link_id"),
159
+ get_path_regex(7, "links1.html", "link using a name", "link_name"),
160
+ get_path_regex(8, "links1.html", "link using a title"),
161
+ get_path_regex(9, "pass.html", "image and a text link / file:///#{$myDir.downcase}/html/images/triangle.jpg")]
162
+ items = @mockout.split(/\n/).collect {|s|s.downcase.strip}
163
+ expected.each_with_index{|regex, x| assert_match(regex, items[x])}
164
+ end
165
+
166
+ def get_path_regex(idx, name, inner, nameid="")
167
+ Regexp.new("^#{idx} +#{nameid} +file:///#{$myDir.downcase}/html/#{name} *#{inner}$")
168
+ end
169
+ end
@@ -0,0 +1,31 @@
1
+ # feature tests for minimizing and maximizing IE windows
2
+ # revision: $Revision: 1.1.2.1 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+
7
+ class TC_MinMax< Test::Unit::TestCase
8
+ include Watir
9
+ def setup
10
+ $ie.goto($htmlRoot + 'pass.html')
11
+ end
12
+ def teardown
13
+ $ie.restore
14
+ end
15
+ def test_minimimum
16
+ $ie.minimize
17
+ end
18
+ def test_maximum
19
+ $ie.maximize
20
+ end
21
+ def test_front
22
+ assert $ie.front?
23
+ ie2 = IE.start($htmlRoot + 'blankpage.html')
24
+ assert ie2.front?
25
+ assert_false $ie.front?
26
+ $ie.bring_to_front
27
+ assert $ie.front?
28
+ ie2.close
29
+ end
30
+ end
31
+
@@ -0,0 +1,56 @@
1
+ # feature tests for navigation
2
+ # revision: $Revision: 1.12 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+
7
+ class TC_Navigate< Test::Unit::TestCase
8
+ include Watir
9
+
10
+ def gotoPage( a )
11
+ $ie.goto($htmlRoot + a)
12
+ end
13
+
14
+ def test_navigation
15
+
16
+ $ie.clear_url_list
17
+ gotoPage( 'buttons1.html')
18
+ url = $ie.url.downcase.gsub('///' , '//') # no idea why this happens - we get 3 / after file:
19
+ assert_equal(url.downcase , ( $htmlRoot + 'buttons1.html' ).downcase ) # the downcase is that sometimes we get capital drivee letters
20
+
21
+ assert_equal( 1, $ie.url_list.length )
22
+ assert_equal( url , $ie.url_list[0].gsub('\\', '/').downcase )
23
+
24
+ gotoPage( 'checkboxes1.html')
25
+ url = $ie.url.downcase.gsub('///' , '//') # no idea why this happens - we get 3 / after file:
26
+
27
+ assert_equal($ie.title , "Test page for Check Boxes")
28
+ assert_equal( 2, $ie.url_list.length )
29
+ assert_equal( url , $ie.url_list[1].gsub('\\', '/').downcase )
30
+
31
+ $ie.clear_url_list
32
+ assert_equal( 0, $ie.url_list.length )
33
+
34
+ $ie.back
35
+ assert_equal($ie.title , "Test page for buttons")
36
+
37
+ $ie.forward
38
+ assert_equal($ie.title , "Test page for Check Boxes")
39
+
40
+ $ie.checkBox(:name , "box1").set
41
+ assert($ie.checkBox(:name, "box1").isSet?)
42
+
43
+ $ie.refresh
44
+ # Not sure how we test this. Text fields and checkboxes dont get reset if you click the browser refresh button
45
+ end
46
+
47
+ def test_http_errors
48
+ # this is commented out as it depends on too many things.....
49
+
50
+ assert_raises(NavigationException) { $ie.goto('http://localhost:3001') } # Cannot find server or DNS Error
51
+ assert_raises(NavigationException) { $ie.goto('http://www.fxruby.org/dfdf' ) } # HTTP 404 - File not found
52
+
53
+ end
54
+
55
+ end
56
+
@@ -0,0 +1,9 @@
1
+ TOPDIR = File.join(File.dirname(__FILE__), '..')
2
+ $LOAD_PATH.unshift TOPDIR
3
+
4
+ require 'unittests/setup.rb'
5
+
6
+ Dir.chdir TOPDIR
7
+ $non_core_tests.each {|x| require x}
8
+
9
+
@@ -0,0 +1,49 @@
1
+ # feature tests for IE::contains_text
2
+ # revision: $Revision: 1.3 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+
7
+ class TC_contains_text < Test::Unit::TestCase
8
+ include Watir
9
+
10
+ def setup
11
+ $ie.goto($htmlRoot + "textsearch.html")
12
+ end
13
+
14
+ def test_text_found
15
+ assert($ie.contains_text('slings and arrows of outrageous fortune'))
16
+ end
17
+
18
+ def test_text_not_found
19
+ assert_false($ie.contains_text('So are they all, all honourable men'))
20
+ end
21
+
22
+ def test_regexp_found
23
+ assert($ie.contains_text(/bodkin.*fardels/))
24
+ end
25
+
26
+ def test_regexp_not_found
27
+ assert_false($ie.contains_text(/winding.*watch.*wit/))
28
+ end
29
+
30
+ def test_match_regexp_found
31
+ $~ = $ie.contains_text(/Messages ([0-9]+)/)
32
+ assert_equal('42', $1)
33
+ end
34
+
35
+ def test_bad_search_argument
36
+ assert_raises(ArgumentError) do
37
+ $ie.contains_text()
38
+ end
39
+ assert_raises(MissingWayOfFindingObjectException) do
40
+ $ie.contains_text(nil)
41
+ end
42
+ assert_raises(MissingWayOfFindingObjectException) do
43
+ $ie.contains_text(42)
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+