watir-classic 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. data/.gitignore +7 -0
  2. data/.gitmodules +3 -0
  3. data/.rspec +1 -0
  4. data/.yardopts +5 -0
  5. data/CHANGES +20 -10
  6. data/CONTRIBUTORS.txt +55 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +78 -0
  9. data/README.rdoc +8 -14
  10. data/Rakefile +32 -0
  11. data/VERSION +1 -1
  12. data/lib/watir-classic.rb +0 -1
  13. data/lib/watir-classic/IEDialog/IEDialog.cpp +225 -0
  14. data/lib/watir-classic/IEDialog/IEDialog.h +15 -0
  15. data/lib/watir-classic/IEDialog/IEDialog.vcproj +159 -0
  16. data/lib/watir-classic/IEDialog/ReadMe.txt +40 -0
  17. data/lib/watir-classic/IEDialog/stdafx.cpp +8 -0
  18. data/lib/watir-classic/IEDialog/stdafx.h +21 -0
  19. data/lib/watir-classic/browser.rb +1 -1
  20. data/lib/watir-classic/container.rb +4 -33
  21. data/lib/watir-classic/core.rb +1 -3
  22. data/lib/watir-classic/dialogs/alert.rb +46 -0
  23. data/lib/watir-classic/dialogs/file_field.rb +1 -0
  24. data/lib/watir-classic/drag_and_drop_helper.rb +18 -6
  25. data/lib/watir-classic/element.rb +0 -2
  26. data/lib/watir-classic/ext/json2.js +487 -0
  27. data/lib/watir-classic/ie-class.rb +10 -164
  28. data/lib/watir-classic/ie.rb +2 -0
  29. data/lib/watir-classic/input_elements.rb +1 -1
  30. data/lib/watir-classic/modal_dialog.rb +1 -7
  31. data/lib/watir-classic/module.rb +1 -10
  32. data/lib/watir-classic/non_control_elements.rb +11 -0
  33. data/lib/watir-classic/page-container.rb +22 -24
  34. data/lib/watir-classic/screenshot.rb +33 -0
  35. data/lib/watir-classic/win32ole/1.8.7/win32ole.patch +56 -0
  36. data/lib/watir-classic/win32ole/1.9.3/win32ole.patch +63 -0
  37. data/lib/watir-classic/win32ole/build_notes.txt +18 -0
  38. data/lib/watir-classic/win32ole/history.txt +88 -0
  39. data/spec/browser_spec.rb +34 -0
  40. data/spec/implementation.rb +18 -0
  41. data/watir-classic.gemspec +40 -0
  42. data/watir.gif +0 -0
  43. metadata +159 -192
  44. data/bin/watir-console +0 -5
  45. data/lib/watir-classic/assertions.rb +0 -44
  46. data/lib/watir-classic/dialogs/javascript.rb +0 -43
  47. data/lib/watir-classic/irb-history.rb +0 -31
  48. data/lib/watir-classic/logger.rb +0 -19
  49. data/lib/watir-classic/screen_capture.rb +0 -115
  50. data/lib/watir-classic/testcase.rb +0 -97
  51. data/lib/watir-classic/waiter.rb +0 -98
  52. data/rakefile.rb +0 -54
  53. data/unittests/all_tests.rb +0 -10
  54. data/unittests/buttons_xpath_test.rb +0 -68
  55. data/unittests/checkbox_test.rb +0 -163
  56. data/unittests/checkbox_xpath_test.rb +0 -106
  57. data/unittests/click_no_wait_test.rb +0 -23
  58. data/unittests/close_all_test.rb +0 -17
  59. data/unittests/core_tests.rb +0 -17
  60. data/unittests/css_selector_test.rb +0 -44
  61. data/unittests/css_test.rb +0 -38
  62. data/unittests/dialog_test.rb +0 -64
  63. data/unittests/div2_xpath_test.rb +0 -21
  64. data/unittests/div_test.rb +0 -170
  65. data/unittests/div_xpath_test.rb +0 -95
  66. data/unittests/document_standards.rb +0 -63
  67. data/unittests/element_collection_indexes_test.rb +0 -57
  68. data/unittests/element_collections_test.rb +0 -100
  69. data/unittests/element_test.rb +0 -47
  70. data/unittests/errorchecker_test.rb +0 -31
  71. data/unittests/filefield_test.rb +0 -43
  72. data/unittests/filefield_xpath_test.rb +0 -35
  73. data/unittests/form_test.rb +0 -282
  74. data/unittests/form_xpath_test.rb +0 -254
  75. data/unittests/frame_test.rb +0 -165
  76. data/unittests/google_form_test.rb +0 -15
  77. data/unittests/html/JavascriptClick.html +0 -39
  78. data/unittests/html/blankpage.html +0 -11
  79. data/unittests/html/buttons1.html +0 -40
  80. data/unittests/html/checkboxes1.html +0 -89
  81. data/unittests/html/click_no_wait.html +0 -14
  82. data/unittests/html/complex_table.html +0 -35
  83. data/unittests/html/cssTest.html +0 -42
  84. data/unittests/html/depot_store.html +0 -59
  85. data/unittests/html/div.html +0 -92
  86. data/unittests/html/div_xml.html +0 -21
  87. data/unittests/html/fileupload.html +0 -44
  88. data/unittests/html/formTest1.html +0 -38
  89. data/unittests/html/forms2.html +0 -44
  90. data/unittests/html/forms3.html +0 -131
  91. data/unittests/html/forms4.html +0 -26
  92. data/unittests/html/frame_buttons.html +0 -4
  93. data/unittests/html/frame_links.html +0 -4
  94. data/unittests/html/frame_multi.html +0 -5
  95. data/unittests/html/google_india.html +0 -119
  96. data/unittests/html/ie7_document_standards.html +0 -9
  97. data/unittests/html/ie8_document_standards.html +0 -9
  98. data/unittests/html/ie9_document_standards.html +0 -9
  99. data/unittests/html/iframe.html +0 -3
  100. data/unittests/html/iframeTest.html +0 -17
  101. data/unittests/html/iframeTest1.html +0 -7
  102. data/unittests/html/iframeTest2.html +0 -5
  103. data/unittests/html/images/1.gif +0 -0
  104. data/unittests/html/images/2.GIF +0 -0
  105. data/unittests/html/images/3.GIF +0 -0
  106. data/unittests/html/images/button.jpg +0 -0
  107. data/unittests/html/images/circle.jpg +0 -0
  108. data/unittests/html/images/map.GIF +0 -0
  109. data/unittests/html/images/map2.gif +0 -0
  110. data/unittests/html/images/minus.GIF +0 -0
  111. data/unittests/html/images/originaltriangle.jpg +0 -0
  112. data/unittests/html/images/plus.gif +0 -0
  113. data/unittests/html/images/square.jpg +0 -0
  114. data/unittests/html/images/triangle.jpg +0 -0
  115. data/unittests/html/images1.html +0 -65
  116. data/unittests/html/javascriptevents.html +0 -33
  117. data/unittests/html/link_pass.html +0 -11
  118. data/unittests/html/links1.html +0 -37
  119. data/unittests/html/links2.html +0 -11
  120. data/unittests/html/links_multi.html +0 -12
  121. data/unittests/html/list_matters.html +0 -720
  122. data/unittests/html/lists.html +0 -18
  123. data/unittests/html/map_test.html +0 -30
  124. data/unittests/html/modal_dialog.html +0 -10
  125. data/unittests/html/modal_dialog_launcher.html +0 -12
  126. data/unittests/html/multiple_specifiers.html +0 -64
  127. data/unittests/html/nestedFrames.html +0 -6
  128. data/unittests/html/new_browser.html +0 -17
  129. data/unittests/html/pass.html +0 -13
  130. data/unittests/html/popups1.html +0 -59
  131. data/unittests/html/pre.html +0 -29
  132. data/unittests/html/quirks_document_standards.html +0 -8
  133. data/unittests/html/radioButtons1.html +0 -71
  134. data/unittests/html/select_tealeaf.html +0 -54
  135. data/unittests/html/selectboxes1.html +0 -52
  136. data/unittests/html/simple_table.html +0 -25
  137. data/unittests/html/simple_table_buttons.html +0 -104
  138. data/unittests/html/simple_table_columns.html +0 -75
  139. data/unittests/html/table1.html +0 -179
  140. data/unittests/html/tableCell_using_xpath.html +0 -19
  141. data/unittests/html/table_and_tablerow_to_a.html +0 -174
  142. data/unittests/html/textarea.html +0 -30
  143. data/unittests/html/textfields1.html +0 -100
  144. data/unittests/html/textsearch.html +0 -44
  145. data/unittests/html/wallofcheckboxes.html +0 -1003
  146. data/unittests/html/xpath_nbsp.html +0 -11
  147. data/unittests/html/zeroindex.html +0 -11
  148. data/unittests/ie_exists_test.rb +0 -16
  149. data/unittests/ie_mock.rb +0 -94
  150. data/unittests/ie_test.rb +0 -54
  151. data/unittests/images_test.rb +0 -156
  152. data/unittests/images_xpath_test.rb +0 -90
  153. data/unittests/index_specifier_test.rb +0 -31
  154. data/unittests/js_events_test.rb +0 -31
  155. data/unittests/links_multi_test.rb +0 -34
  156. data/unittests/links_test.rb +0 -131
  157. data/unittests/links_xpath_test.rb +0 -38
  158. data/unittests/lists_test.rb +0 -23
  159. data/unittests/map_test.rb +0 -98
  160. data/unittests/minmax_test.rb +0 -37
  161. data/unittests/navigate_test.rb +0 -38
  162. data/unittests/nbsp_xpath_test.rb +0 -16
  163. data/unittests/no_wait_test.rb +0 -28
  164. data/unittests/non_core_tests.rb +0 -12
  165. data/unittests/other/all_tests_concurrent.rb +0 -57
  166. data/unittests/other/navigate_exception_test.rb +0 -24
  167. data/unittests/other/rexml_unit_test.rb +0 -27
  168. data/unittests/other/screen_capture_test.rb +0 -53
  169. data/unittests/other/testcase_method_order_test.rb +0 -36
  170. data/unittests/other/testcase_verify_test.rb +0 -25
  171. data/unittests/other/wait_until_test.rb +0 -102
  172. data/unittests/pagecontainstext_test.rb +0 -69
  173. data/unittests/parent_child_test.rb +0 -27
  174. data/unittests/perf_test.rb +0 -20
  175. data/unittests/pre_test.rb +0 -49
  176. data/unittests/radios_test.rb +0 -181
  177. data/unittests/radios_xpath_test.rb +0 -100
  178. data/unittests/security_setting_test.rb +0 -24
  179. data/unittests/selectbox_test.rb +0 -144
  180. data/unittests/selectbox_xpath_test.rb +0 -102
  181. data/unittests/setup.rb +0 -69
  182. data/unittests/speed_settings_test.rb +0 -67
  183. data/unittests/table_cell_using_xpath_test.rb +0 -34
  184. data/unittests/table_test.rb +0 -296
  185. data/unittests/table_xpath_test.rb +0 -109
  186. data/unittests/test_tests.rb +0 -9
  187. data/unittests/textarea_test.rb +0 -92
  188. data/unittests/textarea_xpath_test.rb +0 -77
  189. data/unittests/textfield_for_ch_char_test.rb +0 -32
  190. data/unittests/textfields_test.rb +0 -184
  191. data/unittests/textfields_xpath_test.rb +0 -110
  192. data/unittests/version_test.rb +0 -15
  193. data/unittests/win32ole_so_test.rb +0 -35
  194. data/unittests/window_tests.rb +0 -10
  195. data/unittests/windows/attach_to_existing_window_test.rb +0 -52
  196. data/unittests/windows/attach_to_new_window_test.rb +0 -74
  197. data/unittests/windows/close_window_test.rb +0 -20
  198. data/unittests/windows/frame_links_test.rb +0 -23
  199. data/unittests/windows/ie-each_test.rb +0 -46
  200. data/unittests/windows/modal_dialog_test.rb +0 -95
  201. data/unittests/windows/new_process_test.rb +0 -24
  202. data/unittests/windows/new_test.rb +0 -58
  203. data/unittests/windows/open_close_test.rb +0 -19
  204. data/unittests/windows/send_keys_test.rb +0 -26
  205. data/unittests/xpath_tests.rb +0 -11
  206. data/watir-rdoc.rb +0 -7
@@ -1,20 +0,0 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
2
- require 'unittests/setup'
3
-
4
- class TC_Performance < Test::Unit::TestCase
5
- def setup
6
- uses_page 'wallofcheckboxes.html'
7
- end
8
-
9
- # http://jira.openqa.org/browse/WTR-216
10
- # This should take about a quarter of a second. When the bug showed up (because the
11
- # fast_locate method was broken), it took nearly 10 seconds.
12
- def test_access_checkbox
13
- start_time = Time.now
14
- browser.checkbox(:name, 'custom_monetary_value10:config.admin.required999').set
15
- elapsed_time = Time.now - start_time
16
- assert(elapsed_time < 1.5,
17
- "Elapsed time is #{elapsed_time}, should be less than 1.5 seconds.")
18
- end
19
-
20
- end
@@ -1,49 +0,0 @@
1
- # feature tests for Pre
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Pre < Test::Unit::TestCase
7
-
8
- def setup
9
- goto_page "pre.html"
10
- end
11
-
12
- def test_Pre_Count
13
- assert( browser.pres.length == 3 )
14
- end
15
-
16
- def test_Pre_Exists
17
- assert_false( browser.pre( :index, 33 ).exists? )
18
- assert( browser.pre( :index, 2 ).exists? )
19
-
20
- assert( browser.pre( :id, '1' ).exists? )
21
- assert( browser.pre( :id, /[3-9]/ ).exists? )
22
- assert_false( browser.pre( :id, /missing_pre/ ).exists? )
23
- assert_false( browser.pre( :id, 'missingPre' ).exists? )
24
- end
25
-
26
- def test_simple_access
27
- pre = browser.pre( :index, 0 )
28
- assert( pre.text.include?( "simple pre space" ) )
29
- assert_false( pre.text.include?( "A second block" ) )
30
-
31
- pre = browser.pre( :index, 1 )
32
- assert( pre.text.include?( "A second block" ) )
33
- assert_false( pre.text.include?( "this is the last block" ) )
34
- end
35
-
36
- tag_method :test_embedded_spaces, :fails_on_firefox # http://jira.openqa.org/browse/WTR-267
37
- def test_embedded_spaces
38
- pre = browser.pre( :index, 2 )
39
- assert( pre.text.include?( "continue to work" ) )
40
- assert_false( pre.text.include?( "Pre Tag Test" ) )
41
- end
42
-
43
- tag_method :test_html, :fails_on_firefox # http://jira.openqa.org/browse/WTR-260
44
- def test_html
45
- pre = browser.pre(:index, 0)
46
- assert( pre.html.gsub('"','').include?( "id=1 name=1" ) )
47
- end
48
-
49
- end
@@ -1,181 +0,0 @@
1
- # feature tests for Radio Buttons
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Radios < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page "radioButtons1.html"
11
- end
12
-
13
- def test_Radio_Exists
14
- assert(browser.radio(:name, "box1").exists?)
15
- assert(browser.radio(:id, "box5").exists?)
16
-
17
- assert_false(browser.radio(:name, "missingname").exists?)
18
- assert_false(browser.radio(:id, "missingid").exists?)
19
- end
20
-
21
- def test_radio_class
22
- assert_raises(UnknownObjectException) { browser.radio(:name, "noName").class_name }
23
- assert_equal("radio_style", browser.radio(:name, "box1").class_name)
24
- assert_equal("", browser.radio(:id, "box5").class_name)
25
- end
26
-
27
- def test_Radio_Enabled
28
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:name, "noName").enabled? }
29
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:id, "noName").enabled? }
30
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:name => "box4", :value => 6).enabled? }
31
-
32
- assert_false(browser.radio(:name, "box2").enabled?)
33
- assert(browser.radio(:id, "box5").enabled?)
34
- assert(browser.radio(:name, "box1").enabled?)
35
- end
36
-
37
- def test_little
38
- assert_false(browser.button(:value, "foo").enabled?)
39
- end
40
-
41
- def test_onClick
42
-
43
- assert_false(browser.radio(:name, "box5").set?)
44
- assert_false(browser.button(:value , "foo").enabled?)
45
-
46
- # first click the button is enabled and the radio is set
47
- browser.radio(:name => "box5", :value => 1).set
48
- assert(browser.radio(:name => "box5", :value => 1).set?)
49
- assert(browser.radio(:name => "box5", :value => 1).checked?)
50
- assert(browser.button(:value, "foo").enabled?)
51
-
52
- # second click the button is disabled and the radio is still set
53
- browser.radio(:name => "box5", :value => 1).set
54
- assert(browser.radio(:name => "box5", :value => 1).set?)
55
- assert(browser.radio(:name => "box5", :value => 1).checked?)
56
- assert_false(browser.button(:value, "foo").enabled?)
57
-
58
- # third click the button is enabled and the radio is still set
59
- browser.radio(:name => "box5", :value => 1).set
60
- assert(browser.radio(:name => "box5", :value => 1).set?)
61
- assert(browser.radio(:name => "box5", :value => 1).checked?)
62
- assert(browser.button(:value, "foo").enabled?)
63
-
64
- # click the radio with a value of 2 , button is disabled? and the radio is still set
65
- browser.radio(:name => "box5", :value => 2).set
66
- assert_false(browser.radio(:name => "box5", :value => 1).set?)
67
- assert_false(browser.radio(:name => "box5", :value => 1).checked?)
68
- assert(browser.radio(:name => "box5", :value => 2).set?)
69
- assert(browser.radio(:name => "box5", :value => 2).checked?)
70
- assert_false(browser.button(:value, "foo").enabled?)
71
- end
72
-
73
- def test_Radio_isSet
74
- assert_raises(UnknownObjectException) { browser.radio(:name, "noName").set? }
75
-
76
- assert_false(browser.radio(:name, "box1").set?)
77
- assert( browser.radio(:name, "box3").set?)
78
- assert_false(browser.radio(:name, "box2").set?)
79
- assert( browser.radio(:name => "box4", :value => 1).set?)
80
- assert_false(browser.radio(:name => "box4", :value => 2).set?)
81
-
82
- assert_false(browser.radio(:name, "box1").checked?)
83
- assert( browser.radio(:name, "box3").checked?)
84
- assert_false(browser.radio(:name, "box2").checked?)
85
- assert( browser.radio(:name => "box4", :value => 1).checked?)
86
- assert_false(browser.radio(:name => "box4", :value => 2).checked?)
87
- end
88
-
89
- def test_radio_clear
90
- assert_raises(UnknownObjectException) { browser.radio(:name, "noName").clear }
91
-
92
- browser.radio(:name, "box1").clear
93
- assert_false(browser.radio(:name, "box1").set?)
94
-
95
- assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:name, "box2").clear }
96
- assert_false(browser.radio(:name, "box2").set?)
97
-
98
- browser.radio(:name, "box3").clear
99
- assert_false(browser.radio(:name, "box3").set?)
100
-
101
- browser.radio(:name => "box4", :value => 1).clear
102
- assert_false(browser.radio(:name => "box4", :value => 1).set?)
103
- end
104
-
105
- def test_radio_set
106
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:name, "noName").set }
107
- browser.radio(:name, "box1").set
108
- assert(browser.radio(:name, "box1").set?)
109
-
110
- assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:name, "box2").set }
111
-
112
- browser.radio(:name, "box3").set
113
- assert(browser.radio(:name, "box3").set?)
114
-
115
- # radioes that have the same name but different values
116
- browser.radio(:name => "box4", :value => 3).set
117
- assert(browser.radio(:name => "box4", :value => 3).set?)
118
- end
119
-
120
- def test_radio_properties
121
-
122
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).value}
123
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).name }
124
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).id }
125
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).disabled? }
126
- assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.radio(:index, 199).type }
127
-
128
- assert_equal("on" , browser.radio(:index, 0).value)
129
- assert_equal("box1" , browser.radio(:index, 0).name )
130
- assert_equal("" , browser.radio(:index, 0).id )
131
- assert_equal("radio", browser.radio(:index, 0).type )
132
-
133
- assert_equal( false, browser.radio(:index, 0).disabled? )
134
- assert_equal( true, browser.radio(:index, 2).disabled? )
135
-
136
- assert_equal("box5" , browser.radio(:index, 1).id )
137
- assert_equal("" , browser.radio(:index, 1).name )
138
-
139
- assert_equal("box4-value5", browser.radio(:name => "box4", :value => 5).title )
140
- assert_equal("", browser.radio(:name => "box4", :value => 4).title )
141
- end
142
-
143
- def test_radio_iterators
144
- assert_equal(13, browser.radios.length)
145
- assert_equal("box5" , browser.radios[1].id )
146
- assert_equal(true , browser.radios[2].disabled? )
147
- assert_equal(false , browser.radios[0].disabled? )
148
-
149
- index = 0
150
- browser.radios.each do |r|
151
- assert_equal( browser.radio(:index, index).name , r.name )
152
- assert_equal( browser.radio(:index, index).id , r.id )
153
- assert_equal( browser.radio(:index, index).value, r.value)
154
- assert_equal( browser.radio(:index, index).disabled? , r.disabled? )
155
- index+=1
156
- end
157
- assert_equal(index, browser.radios.length)
158
- end
159
-
160
- # test radio buttons that have a string as a value
161
- def test_value_string
162
- tea = browser.radio(:name => 'box6', :value => 'Tea')
163
- milk = browser.radio(:name => 'box6', :value => 'Milk')
164
-
165
- assert(tea.exists?)
166
- assert(milk.exists?)
167
-
168
- milk.set
169
- assert(milk.set?)
170
- assert_false(tea.set?)
171
-
172
- tea.set
173
- assert_false(milk.set?)
174
- assert(tea.set?)
175
-
176
- tea.clear
177
- assert_false(tea.set?)
178
- end
179
-
180
- end
181
-
@@ -1,100 +0,0 @@
1
- # feature tests for Radio Buttons
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_Radios_XPath < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page "radioButtons1.html"
11
- end
12
-
13
- def test_Radio_Exists
14
- assert(browser.radio(:xpath, "//input[@name='box1']/").exists?)
15
- assert(browser.radio(:xpath, "//input[@id='box5']/").exists?)
16
-
17
- assert_false(browser.radio(:xpath, "//input[@name='missingname']/").exists?)
18
- assert_false(browser.radio(:xpath, "//input[@id='missingid']/").exists?)
19
- end
20
-
21
- def test_Radio_Enabled
22
- assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").enabled? }
23
- assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@id='noName']/").enabled? }
24
- assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='box4' and @value='6']/").enabled? }
25
-
26
- assert_false(browser.radio(:xpath, "//input[@name='box2']/").enabled?)
27
- assert(browser.radio(:xpath, "//input[@id='box5']/").enabled?)
28
- assert(browser.radio(:xpath, "//input[@name='box1']/").enabled?)
29
- end
30
-
31
- def test_little
32
- assert_false(browser.button(:xpath,"//input[@name='foo']/").enabled?)
33
- end
34
-
35
- def test_onClick
36
- assert_false(browser.button(:xpath,"//input[@name='foo']/").enabled?)
37
- browser.radio(:xpath, "//input[@name='box5' and @value='1']/").set
38
- assert(browser.button(:xpath,"//input[@name='foo']/").enabled?)
39
-
40
- browser.radio(:xpath, "//input[@name='box5' and @value='2']/").set
41
- assert_false(browser.button(:xpath,"//input[@name='foo']/").enabled?)
42
- end
43
-
44
- def test_Radio_isSet
45
- assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").isSet? }
46
-
47
- puts "radio 1 is set : #{ browser.radio(:xpath, "//input[@name='box1']/").isSet? } "
48
- assert_false(browser.radio(:xpath, "//input[@name='box1']/").isSet?)
49
-
50
- assert(browser.radio(:xpath, "//input[@name='box3']/").isSet?)
51
- assert_false(browser.radio(:xpath, "//input[@name='box2']/").isSet?)
52
-
53
- assert( browser.radio(:xpath, "//input[@name='box4' and @value='1']/").isSet?)
54
- assert_false(browser.radio(:xpath, "//input[@name='box4' and @value='2']/").isSet?)
55
- end
56
-
57
- def test_radio_clear
58
- assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").clear }
59
-
60
- browser.radio(:xpath, "//input[@name='box1']/").clear
61
- assert_false(browser.radio(:xpath, "//input[@name='box1']/").isSet?)
62
-
63
- assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:xpath, "//input[@name='box2']/").clear }
64
- assert_false(browser.radio(:xpath, "//input[@name='box2']/").isSet?)
65
-
66
- browser.radio(:xpath, "//input[@name='box3']/").clear
67
- assert_false(browser.radio(:xpath, "//input[@name='box3']/").isSet?)
68
-
69
- browser.radio(:xpath, "//input[@name='box4' and @value='1']/").clear
70
- assert_false(browser.radio(:xpath, "//input[@name='box4' and @value='1']/").isSet?)
71
- end
72
-
73
- def test_radio_getState
74
- assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").getState }
75
-
76
- assert_equal( false , browser.radio(:xpath, "//input[@name='box1']/").getState )
77
- assert_equal( true , browser.radio(:xpath, "//input[@name='box3']/").getState)
78
-
79
- # radioes that have the same name but different values
80
- assert_equal( false , browser.radio(:xpath, "//input[@name='box4' and @value='2']/").getState )
81
- assert_equal( true , browser.radio(:xpath, "//input[@name='box4' and @value='1']/").getState)
82
- end
83
-
84
- def test_radio_set
85
- assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']/").set }
86
- browser.radio(:xpath, "//input[@name='box1']/").set
87
- assert(browser.radio(:xpath, "//input[@name='box1']/").isSet?)
88
-
89
- assert_raises(ObjectDisabledException, "ObjectDisabledException was supposed to be thrown" ) { browser.radio(:xpath, "//input[@name='box2']/").set }
90
-
91
- browser.radio(:xpath, "//input[@name='box3']/").set
92
- assert(browser.radio(:xpath, "//input[@name='box3']/").isSet?)
93
-
94
- # radioes that have the same name but different values
95
- browser.radio(:xpath, "//input[@name='box4' and @value='3']/").set
96
- assert(browser.radio(:xpath, "//input[@name='box4' and @value='3']/").isSet?)
97
- end
98
-
99
- end
100
-
@@ -1,24 +0,0 @@
1
- # The purpose of this test is to verify that IE has been manually
2
- # configured to allow active content from local files.
3
- # This setting is not really required for normal use of Watir, but
4
- # it is essential for many of our unit tests.
5
-
6
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
7
- require 'unittests/setup'
8
-
9
- class TC_AAA_Security_Settings < Test::Unit::TestCase
10
- def setup
11
- uses_page "div.html"
12
- end
13
-
14
- @@security_instructions = "\
15
- You must change your IE security settings to run these tests.
16
- Tools -> Internet Options -> Advanced -> Security ->
17
- 'Allow active content to run in files on My Computer'"
18
-
19
- def test_active_content
20
- browser.span(:id, "span3").click
21
- value = browser.text_field(:name, "text2").value
22
- fail(@@security_instructions) if value == '0'
23
- end
24
- end
@@ -1,144 +0,0 @@
1
- # feature tests for Select Boxes
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
4
- require 'unittests/setup'
5
-
6
- class TC_SelectList < Test::Unit::TestCase
7
- include Watir::Exception
8
-
9
- def setup
10
- goto_page "selectboxes1.html"
11
- end
12
-
13
- def test_exists
14
- assert(browser.select_list(:name, "sel1").exists?)
15
- assert_false(browser.select_list(:name, "missing").exists?)
16
- assert_false(browser.select_list(:id, "missing").exists?)
17
- end
18
-
19
- def test_enabled
20
- assert(browser.select_list(:name, "sel1").enabled?)
21
- assert_raises(UnknownObjectException) { browser.select_list(:name, "NoName").enabled? }
22
- assert_false(browser.select_list(:id, 'selectbox_4').enabled?)
23
- end
24
-
25
- def test_class_name
26
- assert_raises(UnknownObjectException) { browser.select_list(:name, "missing").class_name }
27
- assert_equal("list_style", browser.select_list(:name, "sel1").class_name)
28
- assert_equal("", browser.select_list(:name, "sel2").class_name)
29
- end
30
-
31
- def test_select_by_text
32
- assert_equal('Option 3', browser.select_list(:name, "sel1").selected_options.first.text)
33
- browser.select_list(:name, "sel1").select('Option 2')
34
- assert_equal('Option 2', browser.select_list(:name, "sel1").selected_options.first.text)
35
- end
36
-
37
- def test_select_by_value
38
- browser.select_list(:name, "sel3").select_value(/2/)
39
- assert(browser.text.include?("PASS"))
40
- end
41
-
42
- # Option
43
-
44
- def test_Option_text_select
45
- assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").select }
46
- assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, /missing/).select }
47
- assert_raises(MissingWayOfFindingObjectException) { browser.select_list(:name, "sel1").option(:missing, "Option 1").select }
48
-
49
- browser.select_list(:name, "sel1").option(:text, "Option 1").select
50
- assert_equal("Option 1", browser.select_list(:name, "sel1").selected_options.first.text)
51
- end
52
-
53
- def test_clear_selection
54
- assert_raises(TypeError) { browser.select_list(:name, "sel1").clear }
55
- assert_nothing_thrown { browser.select_list(:name, "sel2").clear }
56
- end
57
-
58
- def xtest_option_class_name
59
- # the option object doesnt inherit from element, so this doesnt work
60
- assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").class_name }
61
- assert_equal("list_style", browser.select_list(:name, "sel2").option(:value, 'o2').class_name)
62
- assert_equal("", browser.select_list(:name, "sel2").option(:value, 'o1').class_name)
63
- end
64
-
65
- # SelectList#includes?
66
-
67
- tag_method :test_includes, :fails_on_firefox
68
- def test_includes
69
- assert browser.select_list(:name, 'sel1').include?('Option 1')
70
- assert browser.select_list(:name, 'sel1').include?(/option/i)
71
- assert ! browser.select_list(:name, 'sel1').include?('Option 6')
72
- assert ! browser.select_list(:name, 'sel1').include?(/foobar/)
73
- end
74
-
75
- # SelectList#selected?
76
-
77
- tag_method :test_selected, :fails_on_firefox
78
- def test_selected
79
- assert browser.select_list(:name, 'sel1').selected?('Option 3')
80
- assert browser.select_list(:name, 'sel1').selected?(/option/i)
81
- assert ! browser.select_list(:name, 'sel1').selected?('Option 1')
82
- assert ! browser.select_list(:name, 'sel1').selected?(/option 1/i)
83
- end
84
-
85
- tag_method :test_selected_not_found, :fails_on_firefox
86
- def test_selected_not_found
87
- selectbox = browser.select_list(:name, 'sel1')
88
- assert_raises(UnknownObjectException) {selectbox.selected?("option doesn't exist")}
89
- assert_raises(UnknownObjectException) {selectbox.selected?(/option doesn't exist/)}
90
- end
91
-
92
-
93
- def test_properties
94
- assert_raises(UnknownObjectException) { browser.select_list(:index, 199).value }
95
- assert_raises(UnknownObjectException) { browser.select_list(:index, 199).name }
96
- assert_raises(UnknownObjectException) { browser.select_list(:index, 199).id }
97
- assert_raises(UnknownObjectException) { browser.select_list(:index, 199).disabled? }
98
- assert_raises(UnknownObjectException) { browser.select_list(:index, 199).type }
99
-
100
- assert_equal("o3" , browser.select_list(:index, 0).value)
101
- assert_equal("sel1" , browser.select_list(:index, 0).name)
102
- assert_equal("" , browser.select_list(:index, 0).id)
103
- assert_equal("select-one", browser.select_list(:index, 0).type)
104
- assert_equal("select-multiple", browser.select_list(:index, 1).type)
105
-
106
- browser.select_list(:index,0).select(/1/)
107
- assert_equal("o1", browser.select_list(:index, 0).value)
108
-
109
- assert_false( browser.select_list(:index, 0).disabled?)
110
- assert(browser.select_list(:index, 3).disabled?)
111
- assert(browser.select_list(:id, 'selectbox_4').disabled?)
112
- end
113
-
114
- def test_iterator
115
- assert_equal(4, browser.select_lists.length)
116
- assert_equal("o3" , browser.select_lists[0].value)
117
- assert_equal("sel1" , browser.select_lists[0].name )
118
- assert_equal("select-one", browser.select_lists[0].type )
119
- assert_equal("select-multiple" , browser.select_lists[1].type )
120
-
121
- index = 0
122
- browser.select_lists.each do |l|
123
- assert_equal( browser.select_list(:index, index).name, l.name)
124
- assert_equal( browser.select_list(:index, index).id, l.id)
125
- assert_equal( browser.select_list(:index, index).type, l.type)
126
- assert_equal( browser.select_list(:index, index).value, l.value)
127
- index += 1
128
- end
129
- assert_equal(index, browser.select_lists.length)
130
- end
131
- end
132
-
133
- class TC_Select_Options < Test::Unit::TestCase
134
-
135
- def setup
136
- goto_page "select_tealeaf.html"
137
- end
138
-
139
- def test_options_text
140
- browser.select_list(:name, 'op_numhits').option(:text, '>=').select
141
- assert(browser.select_list(:name, 'op_numhits').option(:text, '>=').selected?)
142
- end
143
- end
144
-