watir 1.4.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. data/bin/watir-console +1 -0
  2. data/changes.rb +119 -0
  3. data/license.rb +37 -0
  4. data/readme.rb +55 -120
  5. data/unittests/buttons_test.rb +107 -104
  6. data/unittests/buttons_xpath_test.rb +69 -0
  7. data/unittests/checkbox_test.rb +154 -141
  8. data/unittests/checkbox_xpath_test.rb +107 -0
  9. data/unittests/core_tests.rb +6 -2
  10. data/unittests/css_test.rb +50 -50
  11. data/unittests/defer_test.rb +47 -0
  12. data/unittests/dialog_test.rb +78 -0
  13. data/unittests/div2_xpath_test.rb +22 -0
  14. data/unittests/div_test.rb +159 -159
  15. data/unittests/div_xpath_test.rb +96 -0
  16. data/unittests/errorchecker_test.rb +22 -22
  17. data/unittests/filefield_test.rb +30 -23
  18. data/unittests/filefield_xpath_test.rb +35 -0
  19. data/unittests/form_test.rb +250 -229
  20. data/unittests/form_xpath_test.rb +253 -0
  21. data/unittests/frame_test.rb +123 -108
  22. data/unittests/google_form_test.rb +17 -0
  23. data/unittests/html/JavascriptClick.html +39 -0
  24. data/unittests/html/buttons1.html +3 -2
  25. data/unittests/html/checkboxes1.html +32 -14
  26. data/unittests/html/complex_table.html +1 -1
  27. data/unittests/html/depot_store.html +59 -0
  28. data/unittests/html/div.html +3 -21
  29. data/unittests/html/div_xml.html +21 -0
  30. data/unittests/html/fileupload.html +2 -2
  31. data/unittests/html/forms2.html +3 -3
  32. data/unittests/html/forms3.html +2 -2
  33. data/unittests/html/frame_links.html +2 -2
  34. data/unittests/html/google_india.html +119 -0
  35. data/unittests/html/iframeTest.html +2 -2
  36. data/unittests/html/images/map.GIF +0 -0
  37. data/unittests/html/images/map2.gif +0 -0
  38. data/unittests/html/images1.html +17 -2
  39. data/unittests/html/javascriptevents.html +3 -7
  40. data/unittests/html/links1.html +9 -8
  41. data/unittests/html/links_multi.html +14 -0
  42. data/unittests/html/list_matters.html +720 -0
  43. data/unittests/html/lists.html +18 -0
  44. data/unittests/html/map_test.html +31 -0
  45. data/unittests/html/modal_dialog.html +10 -0
  46. data/unittests/html/modal_dialog_launcher.html +12 -0
  47. data/unittests/html/new_browser.html +17 -0
  48. data/unittests/html/pass.html +3 -0
  49. data/unittests/html/popups1.html +1 -1
  50. data/unittests/html/pre.html +28 -0
  51. data/unittests/html/radioButtons1.html +6 -5
  52. data/unittests/html/selectboxes1.html +12 -11
  53. data/unittests/html/simple_table.html +1 -1
  54. data/unittests/html/simple_table_columns.html +1 -1
  55. data/unittests/html/table1.html +1 -1
  56. data/unittests/html/tableCell_using_xpath.html +19 -0
  57. data/unittests/html/textfields1.html +6 -4
  58. data/unittests/html/xpath_nbsp.html +12 -0
  59. data/unittests/ie_exists_test.rb +32 -0
  60. data/unittests/ie_mock.rb +78 -79
  61. data/unittests/ie_test.rb +39 -39
  62. data/unittests/images_test.rb +132 -155
  63. data/unittests/images_xpath_test.rb +91 -0
  64. data/unittests/links_multi_test.rb +36 -0
  65. data/unittests/links_test.rb +158 -152
  66. data/unittests/links_xpath_test.rb +40 -0
  67. data/unittests/lists_test.rb +29 -0
  68. data/unittests/map_test.rb +99 -0
  69. data/unittests/minmax_test.rb +23 -23
  70. data/unittests/navigate_test.rb +43 -51
  71. data/unittests/nbsp_xpath_test.rb +18 -0
  72. data/unittests/other/WindowLogonExample.rb +28 -0
  73. data/unittests/{WindowLogonExtra.rb → other/WindowLogonExtra.rb} +0 -0
  74. data/unittests/{all_tests_concurrent.rb → other/all_tests_concurrent.rb} +23 -23
  75. data/unittests/other/navigate_exception_test.rb +14 -0
  76. data/unittests/other/rexml_unit_test.rb +24 -0
  77. data/unittests/other/testcase_method_order_test.rb +36 -0
  78. data/unittests/other/testcase_verify_test.rb +25 -0
  79. data/unittests/other/wait_until_test.rb +99 -0
  80. data/unittests/pagecontainstext_test.rb +56 -37
  81. data/unittests/parent_child_test.rb +55 -0
  82. data/unittests/popups_test.rb +37 -37
  83. data/unittests/pre_test.rb +52 -0
  84. data/unittests/radios_test.rb +186 -155
  85. data/unittests/radios_xpath_test.rb +101 -0
  86. data/unittests/screen_capture_test.rb +41 -41
  87. data/unittests/selectbox_test.rb +223 -181
  88. data/unittests/selectbox_xpath_test.rb +113 -0
  89. data/unittests/setup.rb +29 -25
  90. data/unittests/speed_settings_test.rb +22 -0
  91. data/unittests/table_cell_using_xpath_test.rb +40 -0
  92. data/unittests/table_test.rb +315 -284
  93. data/unittests/table_xpath_test.rb +114 -0
  94. data/unittests/textarea_test.rb +81 -0
  95. data/unittests/textarea_xpath_test.rb +82 -0
  96. data/unittests/textfields_test.rb +205 -229
  97. data/unittests/textfields_xpath_test.rb +111 -0
  98. data/unittests/window_tests.rb +7 -0
  99. data/unittests/windows/attach_to_existing_window_test.rb +52 -0
  100. data/unittests/windows/attach_to_new_window_test.rb +82 -0
  101. data/unittests/windows/close_window_test.rb +22 -0
  102. data/unittests/windows/frame_links_test.rb +25 -0
  103. data/unittests/windows/ie-each_test.rb +48 -0
  104. data/unittests/windows/iedialog_test.rb +55 -0
  105. data/unittests/windows/js_events_test.rb +57 -0
  106. data/unittests/windows/jscriptExtraAlert.rb +6 -0
  107. data/unittests/windows/jscriptExtraConfirmCancel.rb +7 -0
  108. data/unittests/windows/jscriptExtraConfirmOk.rb +7 -0
  109. data/unittests/{jscriptPushButton.rb → windows/jscriptPushButton.rb} +1 -1
  110. data/unittests/windows/jscript_test.rb +64 -0
  111. data/unittests/windows/modal_dialog_test.rb +127 -0
  112. data/unittests/windows/new.rb +56 -0
  113. data/unittests/windows/open_close_test.rb +22 -0
  114. data/unittests/windows/send_keys_test.rb +34 -0
  115. data/unittests/xpath_tests.rb +10 -0
  116. data/watir.rb +4344 -3565
  117. data/watir/IEDialog/Release/IEDialog.dll +0 -0
  118. data/watir/WindowHelper.rb +13 -11
  119. data/watir/assertions.rb +36 -0
  120. data/watir/camel_case.rb +14 -5
  121. data/watir/close_all.rb +38 -0
  122. data/watir/contrib/enabled_popup.rb +21 -0
  123. data/watir/contrib/ie-new-process.rb +27 -0
  124. data/watir/contrib/page_checker.rb +29 -0
  125. data/watir/contrib/visible.rb +47 -0
  126. data/watir/cookiemanager.rb +4 -4
  127. data/watir/datahandler.rb +107 -0
  128. data/watir/dialog.rb +46 -0
  129. data/watir/elements.rb +65 -0
  130. data/watir/exceptions.rb +18 -36
  131. data/watir/ie-process.rb +40 -0
  132. data/watir/irb-history.rb +31 -0
  133. data/watir/process.rb +20 -0
  134. data/watir/testUnitAddons.rb +3 -42
  135. data/watir/testcase.rb +58 -0
  136. data/watir/utils.rb +20 -0
  137. data/watir/waiter.rb +88 -0
  138. data/watir/watir_simple.rb +4 -4
  139. data/watir/win32ole.rb +8 -0
  140. data/watir/win32ole/win32ole.so +0 -0
  141. data/watir/winClicker.rb +374 -400
  142. metadata +209 -128
  143. data/unittests/WindowLogonExample.rb +0 -30
  144. data/unittests/attachToExistingWindow_test.rb +0 -40
  145. data/unittests/js_events_test.rb +0 -77
  146. data/unittests/jscriptExtraAlert.rb +0 -6
  147. data/unittests/jscriptExtraConfirmCancel.rb +0 -7
  148. data/unittests/jscriptExtraConfirmOk.rb +0 -7
  149. data/unittests/jscript_test.rb +0 -57
  150. data/unittests/send_keys_test.rb +0 -29
  151. data/unittests/textAreafields_test.rb +0 -81
@@ -1,6 +0,0 @@
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()
@@ -1,7 +0,0 @@
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()
@@ -1,7 +0,0 @@
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()
@@ -1,57 +0,0 @@
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
@@ -1,29 +0,0 @@
1
- # feature tests for IE#send_keys
2
- # revision: $Revision: 1.2 $
3
-
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
- require 'unittests/setup'
6
-
7
- class TC_Fields < Test::Unit::TestCase
8
- include Watir
9
-
10
- def setup()
11
- $ie.goto($htmlRoot + "textfields1.html")
12
- end
13
-
14
- def test_tabbing
15
- $ie.text_field(:name, 'text1').focus
16
- $ie.send_keys('{tab}')
17
- $ie.send_keys('Scooby')
18
- assert('Scooby', $ie.text_field(:name, 'beforetest').value)
19
- end
20
-
21
- def test_enter
22
- $ie.text_field(:name, 'text1').focus
23
- $ie.send_keys('{tab}{tab}{tab}{tab}')
24
- $ie.send_keys('Dooby{enter}')
25
- assert($ie.contains_text('PASS'))
26
- end
27
-
28
- end
29
-
@@ -1,81 +0,0 @@
1
- # feature tests for TextArea Fields
2
- # revision: $Revision: 1.10 $
3
-
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
- require 'unittests/setup'
6
-
7
- class TC_TextArea < Test::Unit::TestCase
8
- include Watir
9
-
10
- def gotoPage()
11
- $ie.goto($htmlRoot + "textArea.html")
12
- end
13
-
14
- def test_textarea_field_exists
15
- gotoPage()
16
- #test for existance of 4 text area
17
- assert($ie.text_field(:name,"txtMultiLine1").exists?)
18
- assert($ie.text_field(:name,"txtMultiLine2").exists?)
19
- assert($ie.text_field(:name,"txtMultiLine3").exists?)
20
- assert($ie.text_field(:name,"txtReadOnly").exists?)
21
-
22
- assert($ie.text_field(:id,"txtMultiLine1").exists?)
23
- assert($ie.text_field(:id,"txtMultiLine2").exists?)
24
- assert($ie.text_field(:id,"txtMultiLine3").exists?)
25
- assert($ie.text_field(:id,"txtReadOnly").exists?)
26
- #test for missing
27
- assert_false($ie.text_field(:name, "missing").exists?)
28
- assert_false($ie.text_field(:name,"txtMultiLine4").exists?)
29
- end
30
-
31
- def test_textarea_to_s
32
- # bug reported by Zeljko Filipin
33
- assert_nothing_raised() { $ie.text_field(:id,"txtMultiLine3").to_s }
34
- end
35
-
36
- def test_textarea_field
37
- gotoPage()
38
-
39
- # test for read only method
40
- assert_false($ie.text_field(:name, "txtMultiLine1").readonly? )
41
- assert($ie.text_field(:name,"txtReadOnly").readonly?)
42
-
43
- # test for enabled? method
44
- assert_false($ie.text_field(:name, "txtDisabled").enabled? )
45
- assert($ie.text_field(:id, "txtMultiLine1").enabled? )
46
-
47
-
48
- t1 = $ie.text_field(:name, "txtMultiLine1")
49
- assert(t1.verify_contains("Hello World") )
50
- assert(t1.verify_contains(/el/) )
51
- t2 = $ie.text_field(:name, "txtMultiLine2")
52
- assert(t2.verify_contains(/IE/))
53
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:name, "NoName").verify_contains("No field to get a value of") }
54
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:id, "noID").verify_contains("No field to get a value of") }
55
-
56
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "txtNone").append("Some Text") }
57
-
58
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "txtReadOnly").append("Some Text") }
59
- assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { $ie.text_field(:name, "txtDisabled").append("Some Text") }
60
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
61
-
62
- $ie.text_field(:name, "txtMultiLine1").append(" Some Text")
63
- assert_equal( "Hello World Some Text" , $ie.text_field(:name, "txtMultiLine1").getContents )
64
-
65
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "txtReadOnly").append("Some Text") }
66
- assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "txtDisabled").append("Some Text") }
67
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
68
-
69
- $ie.text_field(:name, "txtMultiLine1").set("watir IE Controller")
70
- assert_equal( "watir IE Controller" , $ie.text_field(:name, "txtMultiLine1").getContents )
71
-
72
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "txtReadOnly").append("Some Text") }
73
- assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "txtDisabled").append("Some Text") }
74
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
75
-
76
- $ie.text_field(:name, "txtMultiLine2").clear()
77
- assert_equal( "" , $ie.text_field(:name, "txtMultiLine2").getContents )
78
-
79
- end
80
-
81
- end