watir 3.0.0.rc3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. data/Rakefile +5 -0
  2. data/lib/watir.rb +1 -0
  3. data/lib/watir/loader.rb +2 -0
  4. data/lib/watir/version.rb +3 -0
  5. data/watir.gemspec +18 -54
  6. metadata +32 -278
  7. data/CHANGES +0 -712
  8. data/LICENSE +0 -34
  9. data/README.rdoc +0 -101
  10. data/VERSION +0 -1
  11. data/bin/watir-console +0 -7
  12. data/lib/watir/IEDialog/Release/IEDialog.dll +0 -0
  13. data/lib/watir/close_all.rb +0 -31
  14. data/lib/watir/container.rb +0 -110
  15. data/lib/watir/contrib/enabled_popup.rb +0 -21
  16. data/lib/watir/contrib/ie-new-process.rb +0 -27
  17. data/lib/watir/contrib/page_checker.rb +0 -29
  18. data/lib/watir/cookies.rb +0 -80
  19. data/lib/watir/core.rb +0 -43
  20. data/lib/watir/dialogs/file_field.rb +0 -34
  21. data/lib/watir/dialogs/javascript.rb +0 -43
  22. data/lib/watir/drag_and_drop_helper.rb +0 -68
  23. data/lib/watir/element.rb +0 -441
  24. data/lib/watir/element_collection.rb +0 -109
  25. data/lib/watir/form.rb +0 -96
  26. data/lib/watir/frame.rb +0 -47
  27. data/lib/watir/ie-class.rb +0 -765
  28. data/lib/watir/ie-process.rb +0 -47
  29. data/lib/watir/ie.rb +0 -20
  30. data/lib/watir/image.rb +0 -111
  31. data/lib/watir/input_elements.rb +0 -480
  32. data/lib/watir/irb-history.rb +0 -31
  33. data/lib/watir/link.rb +0 -46
  34. data/lib/watir/locator.rb +0 -243
  35. data/lib/watir/logger.rb +0 -19
  36. data/lib/watir/modal_dialog.rb +0 -72
  37. data/lib/watir/module.rb +0 -12
  38. data/lib/watir/non_control_elements.rb +0 -114
  39. data/lib/watir/page-container.rb +0 -108
  40. data/lib/watir/process.rb +0 -20
  41. data/lib/watir/screen_capture.rb +0 -115
  42. data/lib/watir/supported_elements.rb +0 -172
  43. data/lib/watir/table.rb +0 -224
  44. data/lib/watir/win32.rb +0 -40
  45. data/lib/watir/win32ole.rb +0 -16
  46. data/lib/watir/win32ole/1.8.7/win32ole.so +0 -0
  47. data/lib/watir/win32ole/1.9.3/win32ole.so +0 -0
  48. data/lib/watir/window.rb +0 -68
  49. data/lib/watir/xpath_locator.rb +0 -52
  50. data/rakefile.rb +0 -54
  51. data/unittests/all_tests.rb +0 -10
  52. data/unittests/buttons_xpath_test.rb +0 -68
  53. data/unittests/checkbox_test.rb +0 -163
  54. data/unittests/checkbox_xpath_test.rb +0 -106
  55. data/unittests/click_no_wait_test.rb +0 -23
  56. data/unittests/close_all_test.rb +0 -17
  57. data/unittests/core_tests.rb +0 -17
  58. data/unittests/css_selector_test.rb +0 -44
  59. data/unittests/css_test.rb +0 -38
  60. data/unittests/dialog_test.rb +0 -64
  61. data/unittests/div2_xpath_test.rb +0 -21
  62. data/unittests/div_test.rb +0 -170
  63. data/unittests/div_xpath_test.rb +0 -95
  64. data/unittests/document_standards.rb +0 -63
  65. data/unittests/element_collection_indexes_test.rb +0 -57
  66. data/unittests/element_collections_test.rb +0 -100
  67. data/unittests/element_test.rb +0 -47
  68. data/unittests/errorchecker_test.rb +0 -31
  69. data/unittests/filefield_test.rb +0 -43
  70. data/unittests/filefield_xpath_test.rb +0 -35
  71. data/unittests/form_test.rb +0 -282
  72. data/unittests/form_xpath_test.rb +0 -254
  73. data/unittests/frame_test.rb +0 -165
  74. data/unittests/google_form_test.rb +0 -15
  75. data/unittests/html/JavascriptClick.html +0 -39
  76. data/unittests/html/blankpage.html +0 -11
  77. data/unittests/html/buttons1.html +0 -40
  78. data/unittests/html/checkboxes1.html +0 -89
  79. data/unittests/html/click_no_wait.html +0 -14
  80. data/unittests/html/complex_table.html +0 -35
  81. data/unittests/html/cssTest.html +0 -42
  82. data/unittests/html/depot_store.html +0 -59
  83. data/unittests/html/div.html +0 -92
  84. data/unittests/html/div_xml.html +0 -21
  85. data/unittests/html/fileupload.html +0 -44
  86. data/unittests/html/formTest1.html +0 -38
  87. data/unittests/html/forms2.html +0 -44
  88. data/unittests/html/forms3.html +0 -131
  89. data/unittests/html/forms4.html +0 -26
  90. data/unittests/html/frame_buttons.html +0 -4
  91. data/unittests/html/frame_links.html +0 -4
  92. data/unittests/html/frame_multi.html +0 -5
  93. data/unittests/html/google_india.html +0 -119
  94. data/unittests/html/ie7_document_standards.html +0 -9
  95. data/unittests/html/ie8_document_standards.html +0 -9
  96. data/unittests/html/ie9_document_standards.html +0 -9
  97. data/unittests/html/iframe.html +0 -3
  98. data/unittests/html/iframeTest.html +0 -17
  99. data/unittests/html/iframeTest1.html +0 -7
  100. data/unittests/html/iframeTest2.html +0 -5
  101. data/unittests/html/images/1.gif +0 -0
  102. data/unittests/html/images/2.GIF +0 -0
  103. data/unittests/html/images/3.GIF +0 -0
  104. data/unittests/html/images/button.jpg +0 -0
  105. data/unittests/html/images/circle.jpg +0 -0
  106. data/unittests/html/images/map.GIF +0 -0
  107. data/unittests/html/images/map2.gif +0 -0
  108. data/unittests/html/images/minus.GIF +0 -0
  109. data/unittests/html/images/originaltriangle.jpg +0 -0
  110. data/unittests/html/images/plus.gif +0 -0
  111. data/unittests/html/images/square.jpg +0 -0
  112. data/unittests/html/images/triangle.jpg +0 -0
  113. data/unittests/html/images1.html +0 -65
  114. data/unittests/html/javascriptevents.html +0 -33
  115. data/unittests/html/link_pass.html +0 -11
  116. data/unittests/html/links1.html +0 -37
  117. data/unittests/html/links2.html +0 -11
  118. data/unittests/html/links_multi.html +0 -12
  119. data/unittests/html/list_matters.html +0 -720
  120. data/unittests/html/lists.html +0 -18
  121. data/unittests/html/map_test.html +0 -30
  122. data/unittests/html/modal_dialog.html +0 -10
  123. data/unittests/html/modal_dialog_launcher.html +0 -12
  124. data/unittests/html/multiple_specifiers.html +0 -64
  125. data/unittests/html/nestedFrames.html +0 -6
  126. data/unittests/html/new_browser.html +0 -17
  127. data/unittests/html/pass.html +0 -13
  128. data/unittests/html/popups1.html +0 -59
  129. data/unittests/html/pre.html +0 -29
  130. data/unittests/html/quirks_document_standards.html +0 -8
  131. data/unittests/html/radioButtons1.html +0 -71
  132. data/unittests/html/select_tealeaf.html +0 -54
  133. data/unittests/html/selectboxes1.html +0 -52
  134. data/unittests/html/simple_table.html +0 -25
  135. data/unittests/html/simple_table_buttons.html +0 -104
  136. data/unittests/html/simple_table_columns.html +0 -75
  137. data/unittests/html/table1.html +0 -179
  138. data/unittests/html/tableCell_using_xpath.html +0 -19
  139. data/unittests/html/table_and_tablerow_to_a.html +0 -174
  140. data/unittests/html/textarea.html +0 -30
  141. data/unittests/html/textfields1.html +0 -100
  142. data/unittests/html/textsearch.html +0 -44
  143. data/unittests/html/wallofcheckboxes.html +0 -1003
  144. data/unittests/html/xpath_nbsp.html +0 -11
  145. data/unittests/html/zeroindex.html +0 -11
  146. data/unittests/ie_exists_test.rb +0 -16
  147. data/unittests/ie_mock.rb +0 -94
  148. data/unittests/ie_test.rb +0 -54
  149. data/unittests/images_test.rb +0 -156
  150. data/unittests/images_xpath_test.rb +0 -90
  151. data/unittests/index_specifier_test.rb +0 -31
  152. data/unittests/js_events_test.rb +0 -31
  153. data/unittests/links_multi_test.rb +0 -34
  154. data/unittests/links_test.rb +0 -131
  155. data/unittests/links_xpath_test.rb +0 -38
  156. data/unittests/lists_test.rb +0 -23
  157. data/unittests/map_test.rb +0 -98
  158. data/unittests/minmax_test.rb +0 -37
  159. data/unittests/navigate_test.rb +0 -38
  160. data/unittests/nbsp_xpath_test.rb +0 -16
  161. data/unittests/no_wait_test.rb +0 -28
  162. data/unittests/non_core_tests.rb +0 -12
  163. data/unittests/other/all_tests_concurrent.rb +0 -57
  164. data/unittests/other/navigate_exception_test.rb +0 -24
  165. data/unittests/other/rexml_unit_test.rb +0 -27
  166. data/unittests/other/screen_capture_test.rb +0 -53
  167. data/unittests/other/testcase_method_order_test.rb +0 -36
  168. data/unittests/other/testcase_verify_test.rb +0 -25
  169. data/unittests/other/wait_until_test.rb +0 -102
  170. data/unittests/pagecontainstext_test.rb +0 -69
  171. data/unittests/parent_child_test.rb +0 -27
  172. data/unittests/perf_test.rb +0 -20
  173. data/unittests/pre_test.rb +0 -49
  174. data/unittests/radios_test.rb +0 -181
  175. data/unittests/radios_xpath_test.rb +0 -100
  176. data/unittests/security_setting_test.rb +0 -24
  177. data/unittests/selectbox_test.rb +0 -144
  178. data/unittests/selectbox_xpath_test.rb +0 -102
  179. data/unittests/setup.rb +0 -70
  180. data/unittests/speed_settings_test.rb +0 -67
  181. data/unittests/table_cell_using_xpath_test.rb +0 -34
  182. data/unittests/table_test.rb +0 -296
  183. data/unittests/table_xpath_test.rb +0 -109
  184. data/unittests/test_tests.rb +0 -9
  185. data/unittests/textarea_test.rb +0 -92
  186. data/unittests/textarea_xpath_test.rb +0 -77
  187. data/unittests/textfield_for_ch_char_test.rb +0 -32
  188. data/unittests/textfields_test.rb +0 -184
  189. data/unittests/textfields_xpath_test.rb +0 -110
  190. data/unittests/version_test.rb +0 -15
  191. data/unittests/win32ole_so_test.rb +0 -35
  192. data/unittests/window_tests.rb +0 -10
  193. data/unittests/windows/attach_to_existing_window_test.rb +0 -52
  194. data/unittests/windows/attach_to_new_window_test.rb +0 -74
  195. data/unittests/windows/close_window_test.rb +0 -20
  196. data/unittests/windows/frame_links_test.rb +0 -23
  197. data/unittests/windows/ie-each_test.rb +0 -46
  198. data/unittests/windows/modal_dialog_test.rb +0 -95
  199. data/unittests/windows/new_process_test.rb +0 -24
  200. data/unittests/windows/new_test.rb +0 -58
  201. data/unittests/windows/open_close_test.rb +0 -19
  202. data/unittests/windows/send_keys_test.rb +0 -26
  203. data/unittests/xpath_tests.rb +0 -11
  204. data/watir-rdoc.rb +0 -7
@@ -1,95 +0,0 @@
1
- # feature tests for Divs, Spans and P's
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Divs_XPath < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page "div.html"
11
- end
12
-
13
- def test_divs
14
- assert_raises(UnknownObjectException) {browser.div(:xpath , "//div[@id='div77']/").click }
15
- assert_raises(UnknownObjectException) {browser.div(:xpath , "//div[@title='div77']/").click }
16
-
17
- assert(browser.text_field(:xpath, "//input[@name='text1']/").verify_contains("0") )
18
- browser.div(:xpath , "//div[@id='div3']/").click
19
- assert(browser.text_field(:xpath, "//input[@name='text1']/").verify_contains("1") )
20
- browser.div(:xpath , "//div[@id='div4']/").click
21
- assert(browser.text_field(:xpath, "//input[@name='text1']/").verify_contains("0") )
22
- end
23
-
24
- def test_div_properties
25
- assert_raises(UnknownObjectException) {browser.div(:xpath , "//div[@id='div77']/").text }
26
- assert_raises(UnknownObjectException) {browser.div(:xpath , "//div[@title='div77']/").text }
27
-
28
- assert_equal("This div has an onClick that increments text1",
29
- browser.div(:xpath , "//div[@id='div3']/").text.strip )
30
- assert_equal("This text is in a div with an id of div1 and title of test1",
31
- browser.div(:xpath , "//div[@title='Test1']/").text.strip )
32
-
33
- assert_raises(UnknownObjectException) {browser.div(:xpath , "//div[@id='div77']/").class_name }
34
- assert_equal("blueText" , browser.div(:xpath , "//div[@id='div2']/").class_name )
35
- assert_equal("" , browser.div(:xpath , "//div[@id='div1']/").class_name )
36
- end
37
-
38
- def test_objects_in_div
39
- assert(browser.div(:xpath , "//div[@id='buttons1']/").button(:index,0).exists? )
40
- assert_false(browser.div(:xpath , "//div[@id='buttons1']/").button(:index,2).exists? )
41
- assert(browser.div(:xpath , "//div[@id='buttons1']/").button(:name,'b1').exists? )
42
-
43
- assert(browser.div(:xpath , "//div[@id='buttons2']/").button(:index,0).exists? )
44
- assert(browser.div(:xpath , "//div[@id='buttons2']/").button(:index,1).exists? )
45
- assert_false(browser.div(:xpath , "//div[@id='buttons1']/").button(:index,2).exists? )
46
-
47
- browser.div(:xpath , "//div[@id='buttons1']/").button(:index,0).click
48
-
49
- assert_equal( 'button1' , browser.div(:xpath , "//div[@id='text_fields1']/").text_field(:index,0).value)
50
-
51
- assert_equal( 3 , browser.div(:xpath , "//div[@id='text_fields1']/").text_fields.length )
52
- end
53
-
54
- def test_span_properties
55
- assert_raises(UnknownObjectException) {browser.span(:xpath , "//span[@id='span77']/").text }
56
- assert_raises(UnknownObjectException) {browser.span(:xpath , "//span[@title='span77']/").text }
57
-
58
- assert_equal("This span has an onClick that increments text2" , browser.span(:xpath , "//span[@id='span3']/").text.strip )
59
- assert_equal("This text is in a span with an id of span1 and title of test2" , browser.span(:xpath , "//span[@title='Test2']/").text.strip )
60
-
61
- assert_raises(UnknownObjectException) {browser.span(:xpath , "//span[@id='span77']/").class_name }
62
- assert_equal("blueText" , browser.span(:xpath , "//span[@id='span2']/").class_name )
63
- assert_equal("" , browser.span(:xpath , "//span[@id='span1']/").class_name )
64
- end
65
-
66
- def test_objects_in_span
67
- assert(browser.span(:xpath , "//span[@id='buttons1']/").button(:index,0).exists? )
68
- assert_false(browser.span(:xpath , "//span[@id='buttons1']/").button(:index,2).exists? )
69
- assert(browser.span(:xpath , "//span[@id='buttons1']/").button(:name,'b1').exists? )
70
-
71
- assert(browser.span(:xpath , "//span[@id='buttons2']/").button(:index,0).exists? )
72
- assert(browser.span(:xpath , "//span[@id='buttons2']/").button(:index,1).exists? )
73
- assert_false(browser.span(:xpath , "//span[@id='buttons1']/").button(:index,2).exists? )
74
-
75
- browser.span(:xpath , "//span[@id='buttons1']/").button(:index,0).click
76
-
77
- assert_equal( 'button1' , browser.span(:xpath , "//span[@id='text_fields1']/").text_field(:index,0).value)
78
-
79
- assert_equal( 3 , browser.span(:xpath , "//span[@id='text_fields1']/").text_fields.length )
80
- end
81
-
82
- def test_p
83
- assert(browser.p(:xpath , "//p[@id='number1']/").exists?)
84
- assert(browser.p(:xpath , "//p[@title='test_3']/").exists?)
85
-
86
- assert_false(browser.p(:xpath , "//p[@id='missing']/").exists?)
87
- assert_false(browser.p(:xpath , "//p[@title='test_55']/").exists?)
88
-
89
- assert_raises( UnknownObjectException) {browser.p(:xpath , "//p[@id='missing']/").class_name }
90
- assert_raises( UnknownObjectException) {browser.p(:xpath , "//p[@id='missing']/").text }
91
- assert_raises( UnknownObjectException) {browser.p(:xpath , "//p[@id='missing']/").title }
92
- assert_raises( UnknownObjectException) {browser.p(:xpath , "//p[@id='missing']/").to_s }
93
- assert_raises( UnknownObjectException) {browser.p(:xpath , "//p[@id='missing']/").disabled }
94
- end
95
- end
@@ -1,63 +0,0 @@
1
-
2
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
3
- require 'unittests/setup'
4
-
5
- class TC_DocumentStandards_Quirks < Test::Unit::TestCase
6
- include Watir::Exception
7
-
8
- def setup
9
- goto_page 'quirks_document_standards.html'
10
- end
11
-
12
- def test_elements_exist_or_not
13
- assert(browser.text_field(:name,"quirks_text").exists?)
14
- browser.text_field(:name,"quirks_text").set "test"
15
- browser.text_field(:name,"quirks_text").fire_event "onClick"
16
- assert(browser.text_field(:name,"quirks_text").value == 'test')
17
- end
18
- end
19
-
20
- class TC_DocumentStandards_IE7 < Test::Unit::TestCase
21
- include Watir::Exception
22
-
23
- def setup
24
- goto_page 'ie7_document_standards.html'
25
- end
26
-
27
- def test_elements_exist_or_not
28
- assert(browser.text_field(:name,"ie7_text").exists?)
29
- browser.text_field(:name,"ie7_text").set "test"
30
- browser.text_field(:name,"ie7_text").fire_event "onClick"
31
- assert(browser.text_field(:name,"ie7_text").value == 'test')
32
- end
33
- end
34
-
35
- class TC_DocumentStandards_IE8 < Test::Unit::TestCase
36
- include Watir::Exception
37
-
38
- def setup
39
- goto_page 'ie8_document_standards.html'
40
- end
41
-
42
- def test_elements_exist_or_not
43
- assert(browser.text_field(:name,"ie8_text").exists?)
44
- browser.text_field(:name,"ie8_text").set "test"
45
- browser.text_field(:name,"ie8_text").fire_event "onClick"
46
- assert(browser.text_field(:name,"ie8_text").value == 'test')
47
- end
48
- end
49
-
50
- class TC_DocumentStandards_IE9 < Test::Unit::TestCase
51
- include Watir::Exception
52
-
53
- def setup
54
- goto_page 'ie9_document_standards.html'
55
- end
56
-
57
- def test_elements_exist_or_not
58
- assert(browser.text_field(:name,"ie9_text").exists?)
59
- browser.text_field(:name,"ie9_text").set "test"
60
- browser.text_field(:name,"ie9_text").fire_event "onClick"
61
- assert(browser.text_field(:name,"ie9_text").value == 'test')
62
- end
63
- end
@@ -1,57 +0,0 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
2
- require 'unittests/setup'
3
-
4
-
5
- class TC_TestElementCollectionIndexingForOneBasedIndexes < Test::Unit::TestCase
6
-
7
- def setup
8
- close_browser
9
- Watir.options[:zero_based_indexing] = false
10
- goto_page "zeroindex.html"
11
- end
12
-
13
- def teardown
14
- Watir.options[:zero_based_indexing] = true
15
- close_browser
16
- end
17
-
18
- def test_one_based_index
19
- assert browser.table(:id, 'a_table').rows.length == 6
20
-
21
- #row 1
22
- r = browser.table(:id, 'a_table').rows[1]
23
- assert r.id == 'first'
24
-
25
- #something in the middle
26
- r = browser.table(:id, 'a_table').rows[2]
27
- assert r.id == 'second'
28
-
29
- #the last row
30
- r = browser.table(:id, 'a_table').rows[6]
31
- assert r.id == 'sixth'
32
- end
33
- end
34
-
35
- class TC_TestElementCollectionIndexingForZeroBasedIndexes < Test::Unit::TestCase
36
-
37
- def setup
38
- #currently the watir default is zero based index
39
- goto_page "zeroindex.html"
40
- end
41
-
42
- def test_zero_based_index
43
- assert browser.table(:id, 'a_table').rows.length == 6
44
-
45
- #row 1
46
- r = browser.table(:id, 'a_table').rows[0]
47
- assert r.id == 'first'
48
-
49
- #something in the middle
50
- r = browser.table(:id, 'a_table').rows[2]
51
- assert r.id == 'third'
52
-
53
- #last row
54
- r = browser.table(:id, 'a_table').rows[5]
55
- assert r.id == 'sixth'
56
- end
57
- end
@@ -1,100 +0,0 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
2
- require 'unittests/setup'
3
-
4
- class TC_ElementCollections < Test::Unit::TestCase
5
- include Watir::Exception
6
-
7
- def setup
8
- goto_page "multiple_specifiers.html"
9
- end
10
-
11
- def test_input_element_specifiers
12
- buttons = browser.buttons(:class, "two")
13
- assert 1, buttons.length
14
- assert "testbutton", buttons[0].name
15
- assert "two", buttons[0].class_name
16
-
17
- buttons = browser.buttons(:name, "testbutton")
18
- assert 2, buttons.length
19
- buttons.each do |btn|
20
- assert Watir::Button, btn.class
21
- end
22
- assert "testbutton", buttons[0].name
23
- assert "one", buttons[0].class_name
24
- assert "testbutton", buttons[1].name
25
- assert "two", buttons[1].class_name
26
- end
27
-
28
- def test_brackets
29
- assert browser.buttons[0], browser.buttons(:class => "one")
30
- assert browser.buttons[1].exists?
31
- assert browser.buttons[2].exists? == false
32
- assert_raise(Watir::Exception::UnknownObjectException) {browser.buttons[2].click}
33
- end
34
-
35
- def test_first
36
- assert browser.buttons.first, browser.buttons(:class, "one")
37
- end
38
-
39
- def test_last
40
- assert browser.buttons.last, browser.buttons(:class => "two")
41
- end
42
-
43
- def test_frames_specifiers
44
- frames = browser.frames(:name => "testframe")
45
- assert 2, frames.length
46
- frames.each do |frame|
47
- assert Watir::Frame, frame.class
48
- end
49
- end
50
-
51
- def test_forms_specifiers
52
- forms = browser.forms(:name => "testform")
53
- assert 2, forms.size
54
- forms.each do |form|
55
- assert Watir::Form, form.class
56
- end
57
- end
58
-
59
- def test_elements_specifiers
60
- elements = browser.elements(:name => "testdivs")
61
- assert 2, elements.size
62
- elements.each do |element|
63
- assert Watir::Div, element.class
64
- end
65
-
66
- elements = browser.elements(:css => "div")
67
- assert 2, elements.size
68
- elements.each do |element|
69
- assert Watir::Div, element.class
70
- end
71
- end
72
-
73
- def test_multiple_specifiers
74
- links = browser.links(:name => /test/, :class => /one|two/)
75
- assert 2, links.size
76
-
77
- links.each do |link|
78
- assert Watir::Link, link.class
79
- end
80
- assert "one", links[0].class_name
81
- assert "testlink", links[0].name
82
- assert "two", links[1].class_name
83
- assert "testlink", links[1].name
84
- end
85
-
86
- def test_unallowed_index_specifier
87
- assert_raises(Watir::Exception::MissingWayOfFindingObjectException) {browser.divs(:index, 1)}
88
- end
89
-
90
- def test_table_rows
91
- rows = browser.table.rows
92
- assert 2, rows.size
93
- rows.each_with_index do |row, i|
94
- assert Watir::TableRow, row.class
95
- assert i == 0 ? "one" : "two", row.class_name
96
- end
97
- end
98
-
99
- end
100
-
@@ -1,47 +0,0 @@
1
- # feature tests for element and the elements collection
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Elements < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- uses_page "div.html"
11
- end
12
-
13
- def test_element
14
- assert_raises(UnknownObjectException) { browser.element(:id, "div77").click }
15
- assert_raises(UnknownObjectException) { browser.element(:title, "div77").click }
16
- assert_equal 'div2', browser.element(:class, 'blueText').id
17
- assert_equal 'blueText', browser.element(:id, /div2/).class_name
18
- assert_equal Watir::HTMLElement, browser.element(:id, 'div2').class
19
- end
20
-
21
- def test_element_iterator
22
- assert_equal 3, browser.elements(:class, 'blueText').length
23
- assert_equal 3, browser.elements(:class, 'blueText').size
24
- assert_equal("number3", browser.elements(:class, 'blueText')[2].id)
25
-
26
- index = 0
27
- browser.elements(:id, /div/).each do |s|
28
- assert_equal(browser.div(:index,index).name, s.name)
29
- assert_equal(browser.div(:index,index).id, s.id)
30
- assert_equal(browser.div(:index,index).class_name , s.class_name)
31
- index += 1
32
- end
33
- assert_equal(index, browser.elements(:id, /div/).length)
34
- end
35
-
36
- def test_element_enumerable
37
- match = browser.elements(:class, 'blueText').detect {|d| d.html =~ /SPAN/}
38
- assert_equal('span2', match.id)
39
- end
40
-
41
- def test_objects_in_element
42
- assert browser.element(:id, 'buttons1').button(:index,0).exists?
43
- assert !browser.element(:id, 'buttons1').button(:index,2).exists?
44
- assert browser.element(:id, 'buttons1').button(:name,'b1').exists?
45
- end
46
-
47
- end
@@ -1,31 +0,0 @@
1
- # feature tests for Goto
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_error_checker < Test::Unit::TestCase
7
-
8
- def test_simple_checker
9
- button_checker = Proc.new do |ie|
10
- raise RuntimeError, "text 'buttons' is missing" if ! ie.contains_text(/buttons/)
11
- end
12
-
13
- browser.add_checker button_checker
14
- assert_raises( RuntimeError ) { goto_page('forms3.html') }
15
- assert_nothing_raised { goto_page('buttons1.html') }
16
- ensure
17
- browser.disable_checker button_checker
18
- assert_nothing_raised { goto_page('forms3.html') }
19
- end
20
-
21
- def test_browser_close_with_failing_checker
22
- failing_checker = lambda {|ie| raise "Browser should be closed without throwing this exception!"}
23
- ie = Watir::IE.new
24
- ie.add_checker failing_checker
25
- assert_nothing_raised {ie.close}
26
- ensure
27
- ie.disable_checker failing_checker
28
- ie.close if ie.exists?
29
- end
30
-
31
- end
@@ -1,43 +0,0 @@
1
- # feature tests for file Fields
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
- require 'uri'
6
-
7
- class TC_FileField < Test::Unit::TestCase
8
- tags :must_be_visible, :creates_windows
9
- include Watir
10
-
11
- def setup
12
- goto_page "fileupload.html"
13
- end
14
-
15
- def test_file_field_Exists
16
- # test for existance of 4 file area
17
- assert(browser.file_field(:name,"file1").exists?)
18
- assert(browser.file_field(:id,"file2").exists?)
19
-
20
- # test for missing
21
- assert_false(browser.file_field(:name, "missing").exists?)
22
- assert_false(browser.file_field(:name,"totallybogus").exists?)
23
-
24
- # pop one open and put something in it.
25
- file = $htmlRoot + "fileupload.html"
26
- file.gsub! 'file:///', ''
27
- file.gsub! '/', '\\'
28
- browser.file_field(:name,"file3").set(file)
29
- Watir::Wait.until {browser.file_field(:name,"file3").value!= ''}
30
- assert_equal file, browser.file_field(:name,"file3").value
31
-
32
- # click the upload button
33
- browser.button(:name,"upload").click
34
- assert(browser.text.include?("PASS"))
35
- uri = URI.parse(browser.url)
36
- assert uri.query =~ /fileupload.html&upload=upload/
37
- end
38
-
39
- def test_iterator
40
- assert_equal(6, browser.file_fields.length)
41
- end
42
-
43
- end
@@ -1,35 +0,0 @@
1
- # feature tests for TextArea Fields
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_FileField_XPath < Test::Unit::TestCase
7
- include Watir
8
-
9
- def setup
10
- goto_page "fileupload.html"
11
- end
12
-
13
- def test_file_field_Exists
14
- #test for existance of 4 file area
15
- assert(browser.file_field(:xpath, "//input[@name='file1']/").exists?)
16
- assert(browser.file_field(:xpath, "//input[@id='file2']/").exists?)
17
- #test for missing
18
- assert_false(browser.file_field(:xpath, "//input[@name='missing']/").exists?)
19
- assert_false(browser.file_field(:xpath, "//input[@name='totallybogus']/").exists?)
20
- #pop one open and put something in it.
21
- file = $htmlRoot + "fileupload.html"
22
- file.gsub! 'file:///', ''
23
- file.gsub! '/', '\\'
24
- browser.file_field(:xpath, "//input[@name='file1']/").set(file)
25
- #click the upload button
26
- browser.button(:xpath, "//input[@name='upload']/").click
27
-
28
- assert(browser.text.include?("PASS"))
29
- end
30
-
31
- def test_iterator
32
- assert_equal(6, browser.file_fields.length)
33
- end
34
-
35
- end