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,109 +0,0 @@
1
- # feature tests for Tables
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Tables_XPath < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page "table1.html"
11
- end
12
-
13
- def test_Table_Exists
14
- assert_false(browser.table(:xpath , "//table[@id='missingTable']/").exists? )
15
- assert(browser.table(:xpath , "//table[@id='t1']/").exists? )
16
- end
17
-
18
- def test_rows
19
- assert_raises( UnknownObjectException ){ browser.table(:xpath , "//table[@id='missingTable']/").row_count }
20
- assert_equal( 5 , browser.table(:xpath , "//table[@id='t1']/").row_count) # 4 rows and a header
21
- end
22
-
23
- def test_dynamic_tables
24
- t = browser.table(:xpath , "//table[@id='t1']/")
25
- assert_equal( 5, t.row_count)
26
-
27
- browser.button(:xpath,"//input[@value='add row']/").click
28
- assert_equal( 6, t.row_count)
29
- end
30
-
31
- def test_columns
32
- assert_raises( UnknownObjectException ){ browser.table(:xpath , "//table[@id='missingTable']/").column_count }
33
- assert_equal( 1 , browser.table(:xpath , "//table[@id='t1']/").column_count) # row one has 1 cell with a colspan of 2
34
- end
35
-
36
- def test_links_and_images_in_table
37
- table = browser.table(:xpath , "//table[@id='pic_table']/")
38
- image = table[0][1].image(:index,0)
39
- assert_equal("106", image.width)
40
-
41
- link = table[0][3].link(:index,0)
42
- assert_equal("Google", link.innerText)
43
- end
44
-
45
- def test_table_from_element
46
- goto_page "simple_table_buttons.html"
47
-
48
- button = browser.button(:xpath , "//input[@id='b1']/")
49
- table = Watir::Table.create_from_element(browser,button)
50
-
51
- table[1][0].button(:index,0).click
52
- assert(browser.text_field(:name,"confirmtext").verify_contains(/CLICK2/i))
53
- end
54
-
55
- def test_cell_directly
56
-
57
- assert( browser.cell(:xpath , "//td[@id='cell1']/").exists? )
58
- assert_false( browser.cell(:xpath , "//td[@id='no_exist']/").exists? )
59
- assert_equal( "Row 1 Col1", browser.cell(:xpath , "//td[@id='cell1']/").to_s.strip )
60
- end
61
-
62
- def test_row_directly
63
- assert( browser.row(:xpath , "//tr[@id='row1']/").exists? )
64
- assert_false( browser.row(:xpath , "//tr[@id='no_exist']/").exists? )
65
-
66
- assert_equal('Row 2 Col1' , browser.row(:xpath , "//tr[@id='row1']/")[0].to_s.strip )
67
- end
68
-
69
-
70
- def test_table_body
71
- assert_equal( 3, browser.table(:xpath , "//table[@id='body_test']/").bodies.length )
72
-
73
- count = 1
74
- browser.table(:xpath , "//table[@id='body_test']/").bodies.each do |n|
75
-
76
- # do something better here!
77
- # n.flash # this line commented out to speed up the test
78
-
79
- case count
80
- when 1
81
- compare_text = "This text is in the FRST TBODY."
82
- when 2
83
- compare_text = "This text is in the SECOND TBODY."
84
- when 3
85
- compare_text = "This text is in the THIRD TBODY."
86
- end
87
-
88
- assert_equal( compare_text , n[0][0].to_s.strip ) # this is the 1st cell of the first row of this particular body
89
-
90
- count +=1
91
- end
92
- assert_equal( count-1, browser.table(:xpath , "//table[@id='body_test']/").bodies.length )
93
-
94
- assert_equal( "This text is in the THIRD TBODY." ,browser.table(:xpath , "//table[@id='body_test']/").body(:index,2)[0][0].to_s.strip )
95
-
96
- # iterate through all the rows in a table body
97
- count = 1
98
- browser.table(:xpath , "//table[@id='body_test']/").body(:index,1).each do | row |
99
- # row.flash # this line commented out, to speed up the tests
100
- if count == 1
101
- assert_equal('This text is in the SECOND TBODY.' , row[0].text.strip )
102
- elsif count == 1
103
- assert_equal('This text is also in the SECOND TBODY.' , row[0].text.strip )
104
- end
105
- count+=1
106
- end
107
- end
108
-
109
- end
@@ -1,9 +0,0 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
2
-
3
- require 'unittests/setup'
4
- require 'unittests/checkbox_test'
5
-
6
- Watir::UnitTest.filter = proc do |test|
7
- !test.tagged?(:firewatir_bug)
8
- end
9
-
@@ -1,92 +0,0 @@
1
- # tests for textarea elements
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_TextArea < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page 'textarea.html'
11
- end
12
-
13
- def test_elements_exist_or_not
14
- assert(browser.text_field(:name,"txtMultiLine1").exists?)
15
- assert(browser.text_field(:name,"txtMultiLine2").exists?)
16
- assert(browser.text_field(:name,"txtMultiLine3").exists?)
17
- assert(browser.text_field(:name,"txtReadOnly").exists?)
18
-
19
- assert(browser.text_field(:id,"txtMultiLine1").exists?)
20
- assert(browser.text_field(:id,"txtMultiLine2").exists?)
21
- assert(browser.text_field(:id,"txtMultiLine3").exists?)
22
- assert(browser.text_field(:id,"txtReadOnly").exists?)
23
-
24
- assert_false(browser.text_field(:name, "missing").exists?)
25
- assert_false(browser.text_field(:name,"txtMultiLine4").exists?)
26
- end
27
-
28
- def test_to_s_bug
29
- # from a bug reported by Zeljko Filipin
30
- assert_nothing_raised { browser.text_field(:id,"txtMultiLine3").to_s }
31
- end
32
-
33
- def test_maxlength_bug
34
- # from another bug
35
- assert_nothing_raised { browser.text_field(:id,"txtMultiLine3").append('foo')}
36
- end
37
-
38
- def test_readonly_and_enabled
39
- assert_false(browser.text_field(:name, "txtMultiLine1").readonly? )
40
- assert(browser.text_field(:name,"txtReadOnly").readonly?)
41
-
42
- assert_false(browser.text_field(:name, "txtDisabled").enabled? )
43
- assert(browser.text_field(:id, "txtMultiLine1").enabled? )
44
- end
45
-
46
- def test_verify_contains
47
- t1 = browser.text_field(:name, "txtMultiLine1")
48
- assert(t1.verify_contains("Hello World") )
49
- assert(t1.verify_contains(/el/) )
50
- assert(browser.text_field(:name, "txtMultiLine2").verify_contains(/IE/))
51
- end
52
-
53
- def test_no_such_element
54
- assert_raises(UnknownObjectException) do
55
- browser.text_field(:name, "NoName").verify_contains("de nada")
56
- end
57
- assert_raises(UnknownObjectException) do
58
- browser.text_field(:id, "noID").verify_contains("de nada")
59
- end
60
- assert_raises(UnknownObjectException) do
61
- browser.text_field(:name, "txtNone").append("de nada")
62
- end
63
- end
64
- def test_readonly_and_disabled_errors
65
- assert_raises(ObjectReadOnlyException) do
66
- browser.text_field(:id, "txtReadOnly").append("de nada")
67
- end
68
- assert_raises(ObjectDisabledException) do
69
- browser.text_field(:name, "txtDisabled").append("de nada")
70
- end
71
- assert_raises(ObjectReadOnlyException) do
72
- browser.text_field(:id, "txtReadOnly").append("Some Text")
73
- end
74
- assert_raises(ObjectDisabledException) do
75
- browser.text_field(:name, "txtDisabled").append("Some Text")
76
- end
77
- end
78
-
79
- def test_append_set_and_clear
80
- browser.text_field(:name, "txtMultiLine1").append(" Some Text")
81
- assert_equal("Hello World Some Text",
82
- browser.text_field(:name, "txtMultiLine1").value )
83
-
84
- browser.text_field(:name, "txtMultiLine1").set("watir IE Controller")
85
- assert_equal("watir IE Controller",
86
- browser.text_field(:name, "txtMultiLine1").value )
87
-
88
- browser.text_field(:name, "txtMultiLine2").clear
89
- assert_equal("" , browser.text_field(:name, "txtMultiLine2").value )
90
- end
91
-
92
- end
@@ -1,77 +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_TextArea_XPath < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page "textArea.html"
11
- end
12
-
13
- def test_textarea_field_exists
14
- #test for existance of 4 text area
15
- assert(browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").exists?)
16
- assert(browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/").exists?)
17
- assert(browser.text_field(:xpath , "//textarea[@name='txtMultiLine3']/").exists?)
18
- assert(browser.text_field(:xpath , "//textarea[@name='txtReadOnly']/").exists?)
19
-
20
- assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine1']/").exists?)
21
- assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine2']/").exists?)
22
- assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine3']/").exists?)
23
- assert(browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").exists?)
24
- #test for missing
25
- assert_false(browser.text_field(:xpath , "//textarea[@name='missing']/").exists?)
26
- assert_false(browser.text_field(:xpath , "//textarea[@name='txtMultiLine4']/").exists?)
27
- end
28
-
29
- def xtest_textarea_to_s
30
- # bug reported by Zeljko Filipin
31
- # assert_nothing_raised { browser.text_field(:xpath , "//textarea[@id='txtMultiLine3']/").to_s }
32
- # The above assertion fails. No property or method called maxlength
33
- end
34
-
35
- def test_textarea_field
36
- # test for read only method
37
- assert_false(browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").readonly? )
38
- assert(browser.text_field(:xpath , "//textarea[@name='txtReadOnly']/").readonly?)
39
-
40
- # test for enabled? method
41
- assert_false(browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").enabled? )
42
- assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine1']/").enabled? )
43
-
44
-
45
- t1 = browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/")
46
- assert(t1.verify_contains("Hello World") )
47
- assert(t1.verify_contains(/el/) )
48
- t2 = browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/")
49
- assert(t2.verify_contains(/IE/))
50
- assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//textarea[@name='NoName']/").verify_contains("No field to get a value of") }
51
- assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//textarea[@id='noID']/").verify_contains("No field to get a value of") }
52
-
53
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtNone']/").append("Some Text") }
54
-
55
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").append("Some Text") }
56
- assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").append("Some Text") }
57
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='missing_field']/").append("Some Text") }
58
-
59
- browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").append(" Some Text")
60
- assert_equal( "Hello World Some Text" , browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").value)
61
-
62
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").append("Some Text") }
63
- assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").append("Some Text") }
64
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='missing_field']/").append("Some Text") }
65
-
66
- browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").set("watir IE Controller")
67
- assert_equal( "watir IE Controller" , browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").value )
68
-
69
- assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").append("Some Text") }
70
- assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").append("Some Text") }
71
- assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='missing_field']/").append("Some Text") }
72
-
73
- browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/").clear
74
- assert_equal( "" , browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/").value )
75
- end
76
-
77
- end
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Fields_For_Chinese_Char < Test::Unit::TestCase
7
-
8
- def setup()
9
- goto_page "textfields1.html"
10
- end
11
-
12
- def test_chinese_char_should_be_appended_to_text_field
13
- browser.text_field(:name, "text1").append(" ijij")
14
- assert_equal( "Hello World ijij" , browser.text_field(:name, "text1").value )
15
- end
16
-
17
- def test_mixed_char_should_be_appended_to_text_field
18
- browser.text_field(:name, "text1").append(" ijaija")
19
- assert_equal( "Hello World ijaija" , browser.text_field(:name, "text1").value )
20
- end
21
-
22
- def test_chinese_char_should_be_set_to_text_field
23
- browser.text_field(:name, "text1").set("ijij")
24
- assert_equal( "ijij" , browser.text_field(:name, "text1").value )
25
- end
26
-
27
- def test_mixed_char_should_be_set_to_text_field
28
- browser.text_field(:name, "text1").set("ijaija")
29
- assert_equal( "ijaija" , browser.text_field(:name, "text1").value )
30
- end
31
-
32
- end
@@ -1,184 +0,0 @@
1
- # feature tests for Text Fields & Labels
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Fields < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page "textfields1.html"
11
- end
12
-
13
- tag_method :test_text_field_exists, :fails_on_firefox
14
- def test_text_field_exists
15
- assert(browser.text_field(:name, "text1").exists?)
16
- assert_false(browser.text_field(:name, "missing").exists?)
17
-
18
- assert(browser.text_field(:id, "text2").exists?)
19
- assert_false(browser.text_field(:id, "alsomissing").exists?)
20
-
21
- assert(browser.text_field(:value, 'foo').exists?)
22
- end
23
-
24
- tag_method :test_text_field_dragContentsTo, :fails_on_firefox
25
- def test_text_field_dragContentsTo
26
- browser.text_field(:name, "text1").drag_contents_to(:id, "text2")
27
- assert_equal(browser.text_field(:name, "text1").value, "")
28
- assert_equal(browser.text_field(:id, "text2").value, "goodbye allHello World")
29
- end
30
-
31
- def test_text_field_verify_contains
32
- assert(browser.text_field(:name, "text1").verify_contains("Hello World"))
33
- assert(browser.text_field(:name, "text1").verify_contains(/Hello\sW/))
34
- assert_false(browser.text_field(:name, "text1").verify_contains("Ruby"))
35
- assert_false(browser.text_field(:name, "text1").verify_contains(/R/))
36
- assert_raises(UnknownObjectException) { browser.text_field(:name, "NoName").verify_contains("No field to get a value of") }
37
-
38
- assert(browser.text_field(:id, "text2").verify_contains("goodbye all") )
39
- assert_raises(UnknownObjectException) { browser.text_field(:id, "noID").verify_contains("No field to get a value of") }
40
- end
41
-
42
- def test_text_field_enabled
43
- assert_false(browser.text_field(:name, "disabled").enabled? )
44
- assert(browser.text_field(:name, "text1").enabled? )
45
- assert(browser.text_field(:id, "text2").enabled? )
46
- end
47
-
48
- def test_text_field_readonly
49
- assert_false(browser.text_field(:name, "disabled").readonly? )
50
- assert(browser.text_field(:name, "readOnly").readonly? )
51
- assert(browser.text_field(:id, "readOnly2").readonly? )
52
- end
53
-
54
- def test_text_field_get_contents
55
- assert_raises(UnknownObjectException) { browser.text_field(:name, "missing_field").append("Some Text") }
56
- assert_equal("Hello World", browser.text_field(:name, "text1").value)
57
- end
58
-
59
- tag_method :test_text_field_append, :fails_on_firefox
60
- def test_text_field_append
61
- assert_raises(ObjectReadOnlyException) { browser.text_field(:id, "readOnly2").append("Some Text") }
62
- assert_raises(ObjectDisabledException) { browser.text_field(:name, "disabled").append("Some Text") }
63
- assert_raises(UnknownObjectException) { browser.text_field(:name, "missing_field").append("Some Text") }
64
-
65
- browser.text_field(:name, "text1").append(" Some Text")
66
- assert_equal("Hello World Some Text", browser.text_field(:name, "text1").value)
67
- end
68
-
69
- def test_text_field_clear
70
- browser.text_field(:name, "text1").clear
71
- assert_equal("", browser.text_field(:name, "text1").value)
72
- end
73
-
74
- def test_text_field_set
75
- browser.text_field(:name, "text1").set("watir IE Controller")
76
- assert_equal("watir IE Controller", browser.text_field(:name, "text1").value)
77
- # adding for issue: http://jira.openqa.org/browse/WTR-89
78
- browser.text_field(:name, /reGex/i).set("pass")
79
- assert_equal("pass", browser.text_field(:name, /REgEx/i).value)
80
- end
81
-
82
- def test_text_field_properties
83
- assert_raises(UnknownObjectException) { browser.text_field(:index, 199).value }
84
- assert_raises(UnknownObjectException) { browser.text_field(:index, 199).name }
85
- assert_raises(UnknownObjectException) { browser.text_field(:index, 199).id }
86
- assert_raises(UnknownObjectException) { browser.text_field(:index, 199).disabled? }
87
- assert_raises(UnknownObjectException) { browser.text_field(:index, 199).type }
88
-
89
- assert_equal("Hello World" , browser.text_field(:index, 0).value)
90
- assert_equal("text" , browser.text_field(:index, 0).type)
91
- assert_equal("text1" , browser.text_field(:index, 0).name)
92
- assert_equal("" , browser.text_field(:index, 0).id)
93
- assert_equal(false , browser.text_field(:index, 0).disabled?)
94
-
95
- assert_equal("" , browser.text_field(:index, 1).name)
96
- assert_equal("text2" , browser.text_field(:index, 1).id)
97
-
98
- assert(browser.text_field(:index, 3).disabled?)
99
-
100
- assert_equal("This used to test :afterText", browser.text_field(:name, "aftertest").title)
101
- assert_equal("", browser.text_field(:index, 0).title)
102
- # adding for issue: http://jira.openqa.org/browse/WTR-89
103
- assert_equal("RegEx test", browser.text_field(:name, /REgEx/i).value)
104
- end
105
-
106
- def test_text_field_iterators
107
- assert_equal(14, browser.text_fields.length)
108
-
109
- assert_equal("Hello World", browser.text_fields[0].value)
110
- assert_equal("text1", browser.text_fields[0].name)
111
- assert_equal("password", browser.text_fields[browser.text_fields.length - 1].type)
112
-
113
- index = 0
114
- browser.text_fields.each do |t|
115
- assert_equal(browser.text_field(:index, index).value, t.value)
116
- assert_equal(browser.text_field(:index, index).id, t.id)
117
- assert_equal(browser.text_field(:index, index).name, t.name)
118
- index += 1
119
- end
120
- assert_equal(index, browser.text_fields.length)
121
- end
122
-
123
- tag_method :test_JS_Events, :fails_on_firefox
124
- def test_JS_Events
125
- browser.text_field(:name, 'events_tester').requires_typing.set('p')
126
-
127
- # the following line has an extra keypress at the begining, as we mimic the delete key being pressed
128
- assert_equal( "keypresskeydownkeypresskeyup" , browser.text_field(:name, 'events_text').value.gsub(/(\r|\n)/ , "") )
129
- browser.button(:value, "Clear Events Box").click
130
- browser.text_field(:name, 'events_tester').requires_typing.set('ab')
131
-
132
- # the following line has an extra keypress at the begining, as we mimic the delete key being pressed
133
- assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup", browser.text_field(:name , 'events_text').value.gsub(/(\r|\n)/ , "") )
134
- end
135
-
136
- def test_password
137
- browser.text_field(:name, "password1").set("secret")
138
- assert( 'secret' , browser.text_field(:name, "password1").value )
139
-
140
- browser.text_field(:id, "password1").set("top_secret")
141
- assert('top_secret', browser.text_field(:id, "password1").value )
142
- end
143
-
144
- def test_labels_iterator
145
- assert_equal(3, browser.labels.length)
146
- assert_equal('Label For this Field' , browser.labels[0].text.strip )
147
- assert_equal('Password With ID ( the text here is a label for it )' , browser.labels[2].text )
148
-
149
- count=0
150
- browser.labels.each do |l|
151
- count +=1
152
- end
153
- assert_equal(count, browser.labels.length)
154
- end
155
-
156
- def test_label_properties
157
- assert_raises(UnknownObjectException) { browser.label(:index,20).text }
158
- assert_raises(UnknownObjectException) { browser.label(:index,20).for }
159
- assert_raises(UnknownObjectException) { browser.label(:index,20).id }
160
-
161
- assert_false(browser.label(:index,10).exists?)
162
- assert_false(browser.label(:id,'missing').exists?)
163
- assert(browser.label(:index,0).exists?)
164
-
165
- assert_equal("", browser.label(:index,0).id)
166
- assert_false(browser.label(:index,0).disabled?)
167
- assert(browser.label(:index,0).enabled?)
168
-
169
- assert_equal("label2", browser.label(:index,1).id )
170
-
171
- assert_equal("Password With ID ( the text here is a label for it )" , browser.label(:index,2).text)
172
- assert_equal("password1", browser.label(:index,2).for)
173
- end
174
-
175
- def test_max_length_is_not_exceeded
176
- browser.text_field(:name, 'text1').set("abcdefghijklmnopqrstuv")
177
- assert_equal("abcdefghijklmnopqrst", browser.text_field(:name, 'text1').value )
178
- end
179
-
180
- def test_max_length
181
- assert_equal(20, browser.text_field(:name, 'text1').maxlength)
182
- end
183
-
184
- end