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.
- data/.gitignore +7 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/.yardopts +5 -0
- data/CHANGES +20 -10
- data/CONTRIBUTORS.txt +55 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +78 -0
- data/README.rdoc +8 -14
- data/Rakefile +32 -0
- data/VERSION +1 -1
- data/lib/watir-classic.rb +0 -1
- data/lib/watir-classic/IEDialog/IEDialog.cpp +225 -0
- data/lib/watir-classic/IEDialog/IEDialog.h +15 -0
- data/lib/watir-classic/IEDialog/IEDialog.vcproj +159 -0
- data/lib/watir-classic/IEDialog/ReadMe.txt +40 -0
- data/lib/watir-classic/IEDialog/stdafx.cpp +8 -0
- data/lib/watir-classic/IEDialog/stdafx.h +21 -0
- data/lib/watir-classic/browser.rb +1 -1
- data/lib/watir-classic/container.rb +4 -33
- data/lib/watir-classic/core.rb +1 -3
- data/lib/watir-classic/dialogs/alert.rb +46 -0
- data/lib/watir-classic/dialogs/file_field.rb +1 -0
- data/lib/watir-classic/drag_and_drop_helper.rb +18 -6
- data/lib/watir-classic/element.rb +0 -2
- data/lib/watir-classic/ext/json2.js +487 -0
- data/lib/watir-classic/ie-class.rb +10 -164
- data/lib/watir-classic/ie.rb +2 -0
- data/lib/watir-classic/input_elements.rb +1 -1
- data/lib/watir-classic/modal_dialog.rb +1 -7
- data/lib/watir-classic/module.rb +1 -10
- data/lib/watir-classic/non_control_elements.rb +11 -0
- data/lib/watir-classic/page-container.rb +22 -24
- data/lib/watir-classic/screenshot.rb +33 -0
- data/lib/watir-classic/win32ole/1.8.7/win32ole.patch +56 -0
- data/lib/watir-classic/win32ole/1.9.3/win32ole.patch +63 -0
- data/lib/watir-classic/win32ole/build_notes.txt +18 -0
- data/lib/watir-classic/win32ole/history.txt +88 -0
- data/spec/browser_spec.rb +34 -0
- data/spec/implementation.rb +18 -0
- data/watir-classic.gemspec +40 -0
- data/watir.gif +0 -0
- metadata +159 -192
- data/bin/watir-console +0 -5
- data/lib/watir-classic/assertions.rb +0 -44
- data/lib/watir-classic/dialogs/javascript.rb +0 -43
- data/lib/watir-classic/irb-history.rb +0 -31
- data/lib/watir-classic/logger.rb +0 -19
- data/lib/watir-classic/screen_capture.rb +0 -115
- data/lib/watir-classic/testcase.rb +0 -97
- data/lib/watir-classic/waiter.rb +0 -98
- data/rakefile.rb +0 -54
- data/unittests/all_tests.rb +0 -10
- data/unittests/buttons_xpath_test.rb +0 -68
- data/unittests/checkbox_test.rb +0 -163
- data/unittests/checkbox_xpath_test.rb +0 -106
- data/unittests/click_no_wait_test.rb +0 -23
- data/unittests/close_all_test.rb +0 -17
- data/unittests/core_tests.rb +0 -17
- data/unittests/css_selector_test.rb +0 -44
- data/unittests/css_test.rb +0 -38
- data/unittests/dialog_test.rb +0 -64
- data/unittests/div2_xpath_test.rb +0 -21
- data/unittests/div_test.rb +0 -170
- data/unittests/div_xpath_test.rb +0 -95
- data/unittests/document_standards.rb +0 -63
- data/unittests/element_collection_indexes_test.rb +0 -57
- data/unittests/element_collections_test.rb +0 -100
- data/unittests/element_test.rb +0 -47
- data/unittests/errorchecker_test.rb +0 -31
- data/unittests/filefield_test.rb +0 -43
- data/unittests/filefield_xpath_test.rb +0 -35
- data/unittests/form_test.rb +0 -282
- data/unittests/form_xpath_test.rb +0 -254
- data/unittests/frame_test.rb +0 -165
- data/unittests/google_form_test.rb +0 -15
- data/unittests/html/JavascriptClick.html +0 -39
- data/unittests/html/blankpage.html +0 -11
- data/unittests/html/buttons1.html +0 -40
- data/unittests/html/checkboxes1.html +0 -89
- data/unittests/html/click_no_wait.html +0 -14
- data/unittests/html/complex_table.html +0 -35
- data/unittests/html/cssTest.html +0 -42
- data/unittests/html/depot_store.html +0 -59
- data/unittests/html/div.html +0 -92
- data/unittests/html/div_xml.html +0 -21
- data/unittests/html/fileupload.html +0 -44
- data/unittests/html/formTest1.html +0 -38
- data/unittests/html/forms2.html +0 -44
- data/unittests/html/forms3.html +0 -131
- data/unittests/html/forms4.html +0 -26
- data/unittests/html/frame_buttons.html +0 -4
- data/unittests/html/frame_links.html +0 -4
- data/unittests/html/frame_multi.html +0 -5
- data/unittests/html/google_india.html +0 -119
- data/unittests/html/ie7_document_standards.html +0 -9
- data/unittests/html/ie8_document_standards.html +0 -9
- data/unittests/html/ie9_document_standards.html +0 -9
- data/unittests/html/iframe.html +0 -3
- data/unittests/html/iframeTest.html +0 -17
- data/unittests/html/iframeTest1.html +0 -7
- data/unittests/html/iframeTest2.html +0 -5
- data/unittests/html/images/1.gif +0 -0
- data/unittests/html/images/2.GIF +0 -0
- data/unittests/html/images/3.GIF +0 -0
- data/unittests/html/images/button.jpg +0 -0
- data/unittests/html/images/circle.jpg +0 -0
- data/unittests/html/images/map.GIF +0 -0
- data/unittests/html/images/map2.gif +0 -0
- data/unittests/html/images/minus.GIF +0 -0
- data/unittests/html/images/originaltriangle.jpg +0 -0
- data/unittests/html/images/plus.gif +0 -0
- data/unittests/html/images/square.jpg +0 -0
- data/unittests/html/images/triangle.jpg +0 -0
- data/unittests/html/images1.html +0 -65
- data/unittests/html/javascriptevents.html +0 -33
- data/unittests/html/link_pass.html +0 -11
- data/unittests/html/links1.html +0 -37
- data/unittests/html/links2.html +0 -11
- data/unittests/html/links_multi.html +0 -12
- data/unittests/html/list_matters.html +0 -720
- data/unittests/html/lists.html +0 -18
- data/unittests/html/map_test.html +0 -30
- data/unittests/html/modal_dialog.html +0 -10
- data/unittests/html/modal_dialog_launcher.html +0 -12
- data/unittests/html/multiple_specifiers.html +0 -64
- data/unittests/html/nestedFrames.html +0 -6
- data/unittests/html/new_browser.html +0 -17
- data/unittests/html/pass.html +0 -13
- data/unittests/html/popups1.html +0 -59
- data/unittests/html/pre.html +0 -29
- data/unittests/html/quirks_document_standards.html +0 -8
- data/unittests/html/radioButtons1.html +0 -71
- data/unittests/html/select_tealeaf.html +0 -54
- data/unittests/html/selectboxes1.html +0 -52
- data/unittests/html/simple_table.html +0 -25
- data/unittests/html/simple_table_buttons.html +0 -104
- data/unittests/html/simple_table_columns.html +0 -75
- data/unittests/html/table1.html +0 -179
- data/unittests/html/tableCell_using_xpath.html +0 -19
- data/unittests/html/table_and_tablerow_to_a.html +0 -174
- data/unittests/html/textarea.html +0 -30
- data/unittests/html/textfields1.html +0 -100
- data/unittests/html/textsearch.html +0 -44
- data/unittests/html/wallofcheckboxes.html +0 -1003
- data/unittests/html/xpath_nbsp.html +0 -11
- data/unittests/html/zeroindex.html +0 -11
- data/unittests/ie_exists_test.rb +0 -16
- data/unittests/ie_mock.rb +0 -94
- data/unittests/ie_test.rb +0 -54
- data/unittests/images_test.rb +0 -156
- data/unittests/images_xpath_test.rb +0 -90
- data/unittests/index_specifier_test.rb +0 -31
- data/unittests/js_events_test.rb +0 -31
- data/unittests/links_multi_test.rb +0 -34
- data/unittests/links_test.rb +0 -131
- data/unittests/links_xpath_test.rb +0 -38
- data/unittests/lists_test.rb +0 -23
- data/unittests/map_test.rb +0 -98
- data/unittests/minmax_test.rb +0 -37
- data/unittests/navigate_test.rb +0 -38
- data/unittests/nbsp_xpath_test.rb +0 -16
- data/unittests/no_wait_test.rb +0 -28
- data/unittests/non_core_tests.rb +0 -12
- data/unittests/other/all_tests_concurrent.rb +0 -57
- data/unittests/other/navigate_exception_test.rb +0 -24
- data/unittests/other/rexml_unit_test.rb +0 -27
- data/unittests/other/screen_capture_test.rb +0 -53
- data/unittests/other/testcase_method_order_test.rb +0 -36
- data/unittests/other/testcase_verify_test.rb +0 -25
- data/unittests/other/wait_until_test.rb +0 -102
- data/unittests/pagecontainstext_test.rb +0 -69
- data/unittests/parent_child_test.rb +0 -27
- data/unittests/perf_test.rb +0 -20
- data/unittests/pre_test.rb +0 -49
- data/unittests/radios_test.rb +0 -181
- data/unittests/radios_xpath_test.rb +0 -100
- data/unittests/security_setting_test.rb +0 -24
- data/unittests/selectbox_test.rb +0 -144
- data/unittests/selectbox_xpath_test.rb +0 -102
- data/unittests/setup.rb +0 -69
- data/unittests/speed_settings_test.rb +0 -67
- data/unittests/table_cell_using_xpath_test.rb +0 -34
- data/unittests/table_test.rb +0 -296
- data/unittests/table_xpath_test.rb +0 -109
- data/unittests/test_tests.rb +0 -9
- data/unittests/textarea_test.rb +0 -92
- data/unittests/textarea_xpath_test.rb +0 -77
- data/unittests/textfield_for_ch_char_test.rb +0 -32
- data/unittests/textfields_test.rb +0 -184
- data/unittests/textfields_xpath_test.rb +0 -110
- data/unittests/version_test.rb +0 -15
- data/unittests/win32ole_so_test.rb +0 -35
- data/unittests/window_tests.rb +0 -10
- data/unittests/windows/attach_to_existing_window_test.rb +0 -52
- data/unittests/windows/attach_to_new_window_test.rb +0 -74
- data/unittests/windows/close_window_test.rb +0 -20
- data/unittests/windows/frame_links_test.rb +0 -23
- data/unittests/windows/ie-each_test.rb +0 -46
- data/unittests/windows/modal_dialog_test.rb +0 -95
- data/unittests/windows/new_process_test.rb +0 -24
- data/unittests/windows/new_test.rb +0 -58
- data/unittests/windows/open_close_test.rb +0 -19
- data/unittests/windows/send_keys_test.rb +0 -26
- data/unittests/xpath_tests.rb +0 -11
- data/watir-rdoc.rb +0 -7
@@ -1,254 +0,0 @@
|
|
1
|
-
# feature tests for Forms
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_Forms2_XPath < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
goto_page "forms2.html"
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_Form_Exists
|
12
|
-
assert(browser.form(:xpath , "//form[@name='test2']/").exists?)
|
13
|
-
assert_false(browser.form(:xpath , "//form[@name='missing']/").exists?)
|
14
|
-
|
15
|
-
assert(browser.form(:xpath , "//form[@method='get']/").exists?)
|
16
|
-
assert_false(browser.form(:xpath , "//form[@method='missing']/").exists?)
|
17
|
-
|
18
|
-
assert(browser.form(:xpath , "//form[@action='pass.html']/").exists?)
|
19
|
-
assert_false(browser.form(:xpath , "//form[@action='missing']/").exists?)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_ButtonInForm
|
23
|
-
assert(browser.form(:xpath , "//form[@name='test2']/").button(:caption , "Submit").exists?)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class TC_Form_Display_XPath < Test::Unit::TestCase
|
28
|
-
include CaptureIOHelper
|
29
|
-
def test_showforms
|
30
|
-
goto_page "forms2.html"
|
31
|
-
|
32
|
-
actual = capture_stdout { browser.show_forms }
|
33
|
-
expected = <<END_OF_MESSAGE
|
34
|
-
There are 4 forms
|
35
|
-
Form name:
|
36
|
-
id:
|
37
|
-
method: get
|
38
|
-
action: pass.html
|
39
|
-
Form name: test2
|
40
|
-
id: f2
|
41
|
-
method: get
|
42
|
-
action: pass2.html
|
43
|
-
Form name: test3
|
44
|
-
id:
|
45
|
-
method: get
|
46
|
-
action: pass2.html
|
47
|
-
Form name: test2
|
48
|
-
id:
|
49
|
-
method: get
|
50
|
-
action: pass2.html
|
51
|
-
END_OF_MESSAGE
|
52
|
-
actual.gsub!(/(action: )file:.*\/(.*)$/,'\\1\\2') if actual =~ /file:/
|
53
|
-
actual.gsub!(/\s+\n/,"\n")
|
54
|
-
assert_equal(expected, actual)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class TC_Forms3_XPath < Test::Unit::TestCase
|
59
|
-
def setup
|
60
|
-
goto_page "forms3.html"
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_Form_Exists
|
64
|
-
assert(browser.form(:xpath , "//form[@name='test2']/").exists?)
|
65
|
-
assert_false(browser.form(:xpath , "//form[@name='missing']/").exists?)
|
66
|
-
|
67
|
-
assert(browser.form(:xpath , "//form[@method='get']/").exists?)
|
68
|
-
assert_false(browser.form(:xpath , "//form[@method='missing']/").exists?)
|
69
|
-
|
70
|
-
assert(browser.form(:xpath , "//form[@action='pass.html']/").exists?)
|
71
|
-
assert_false(browser.form(:xpath , "//form[@action='missing']/").exists?)
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_getObject_when_non_watir_object_before_it
|
75
|
-
# test for bug reported by Scott Pack, http://rubyforge.org/pipermail/wtr-general/2005-June/002223.html
|
76
|
-
assert_equal("check1" , browser.checkbox(:index,0).name )
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_showforms # add verification of output!
|
80
|
-
browser.show_forms
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_reset
|
84
|
-
|
85
|
-
browser.text_field(:id, "t1").set("Hello, reset test!")
|
86
|
-
assert_equal(browser.text_field(:id, 't1').value, 'Hello, reset test!')
|
87
|
-
|
88
|
-
browser.button(:caption, "Reset").click
|
89
|
-
assert_equal("" , browser.text_field(:id, 't1').value )
|
90
|
-
|
91
|
-
# also verify it works under a form
|
92
|
-
browser.text_field(:id, "t1").set("reset test - using a form")
|
93
|
-
assert_equal(browser.text_field(:id, 't1').value, 'reset test - using a form')
|
94
|
-
|
95
|
-
# also verify it works under a form, this time using the :id attribute
|
96
|
-
browser.text_field(:id, "t1").set("reset test - using a form")
|
97
|
-
assert_equal(browser.text_field(:id, 't1').value, 'reset test - using a form')
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_flash1
|
101
|
-
browser.form(:xpath , "//form[@name='test2']/").button(:caption , "Submit").flash
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_objects_with_same_name
|
105
|
-
assert_equal('textfield' ,browser.text_field( :name , 'g1').value )
|
106
|
-
assert_equal('button' ,browser.button( :name , 'g1').value )
|
107
|
-
assert_equal('1' ,browser.checkbox( :name , 'g1').value )
|
108
|
-
assert_equal('2' ,browser.radio( :name , 'g1').value )
|
109
|
-
|
110
|
-
assert_equal('textfield_id' ,browser.text_field( :id , 'g1').value )
|
111
|
-
assert_equal('button_id' ,browser.button( :id , 'g1').value )
|
112
|
-
assert_equal('1_id' ,browser.checkbox( :id , 'g1').value )
|
113
|
-
assert_equal('2_id' ,browser.radio( :id , 'g1').value )
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_flash2
|
117
|
-
browser.button(:value, 'Click Me').flash
|
118
|
-
assert_raises( Watir::UnknownObjectException ) { browser.text_field( :name , 'g177').flash }
|
119
|
-
end
|
120
|
-
|
121
|
-
def test_showElements # add verification!
|
122
|
-
browser.show_all_objects
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_showText
|
126
|
-
puts browser.text
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_showHTML
|
130
|
-
puts browser.html
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_submitWithImage
|
134
|
-
assert( browser.button(:alt , "submit").exists? )
|
135
|
-
assert( browser.button(:alt , /sub/).exists? )
|
136
|
-
|
137
|
-
assert_false( browser.button(:alt , "missing").exists? )
|
138
|
-
assert_false( browser.button(:alt , /missing/).exists? )
|
139
|
-
|
140
|
-
#assert( browser.button(:src , "file:///#{$myDir}/html/images/button.jpg").exists? ) # this doesnt work for everybody
|
141
|
-
assert( browser.button(:src , /button/).exists? )
|
142
|
-
|
143
|
-
assert_false( browser.button(:src , "missing").exists? )
|
144
|
-
assert_false( browser.button(:src , /missing/).exists? )
|
145
|
-
assert_nothing_raised("raised an exception when it shouldnt have") { browser.button(:src , /button/).click }
|
146
|
-
|
147
|
-
assert( browser.contains_text("PASS") )
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
class TC_Forms4_XPath < Test::Unit::TestCase
|
152
|
-
def setup
|
153
|
-
goto_page "forms4.html"
|
154
|
-
end
|
155
|
-
|
156
|
-
def test_find_text_field_ignoring_form
|
157
|
-
assert_equal(browser.text_field(:name, 'name').value, 'apple') # should it raise a not-unique error instead?
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_correct_form_field_is_found_using_form_name
|
161
|
-
assert_equal(browser.form(:xpath , "//form[@name='apple_form']/").text_field(:name, 'name').value, 'apple')
|
162
|
-
assert_equal(browser.form(:xpath , "//form[@name='banana_form']/").text_field(:name, 'name').value, 'banana')
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_using_text_on_form
|
166
|
-
browser.form(:xpath , "//form[@name='apple_form']/").text_field(:name, 'name').set('strudel')
|
167
|
-
assert_equal(browser.form(:index, 0).text_field(:name, 'name').value, 'strudel')
|
168
|
-
end
|
169
|
-
|
170
|
-
def test_submit
|
171
|
-
browser.form(:xpath , "//form[@name='apple_form']/").submit
|
172
|
-
assert( browser.contains_text("PASS") )
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
class TC_Hidden_Fields_XPath < Test::Unit::TestCase
|
177
|
-
def setup
|
178
|
-
goto_page "forms3.html"
|
179
|
-
end
|
180
|
-
|
181
|
-
def test_hidden
|
182
|
-
|
183
|
-
# test using index
|
184
|
-
assert( browser.hidden(:index,0).exists? )
|
185
|
-
assert( browser.hidden(:index,1).exists? )
|
186
|
-
assert_false( browser.hidden(:index,2).exists? )
|
187
|
-
|
188
|
-
browser.hidden(:index,0).value = 44
|
189
|
-
browser.hidden(:index,1).value = 55
|
190
|
-
|
191
|
-
browser.button(:value , "Show Hidden").click
|
192
|
-
|
193
|
-
assert_equal("44" , browser.text_field(:name , "vis1").value )
|
194
|
-
assert_equal("55" , browser.text_field(:name , "vis2").value )
|
195
|
-
|
196
|
-
# test using name and ID
|
197
|
-
assert( browser.hidden(:name ,"hid1").exists? )
|
198
|
-
assert( browser.hidden(:id,"hidden_1").exists? )
|
199
|
-
assert_false( browser.hidden(:name,"hidden_44").exists? )
|
200
|
-
assert_false( browser.hidden(:id,"hidden_55").exists? )
|
201
|
-
|
202
|
-
browser.hidden(:name ,"hid1").value = 444
|
203
|
-
browser.hidden(:id,"hidden_1").value = 555
|
204
|
-
|
205
|
-
browser.button(:value , "Show Hidden").click
|
206
|
-
|
207
|
-
assert_equal("444" , browser.text_field(:name , "vis1").value )
|
208
|
-
assert_equal("555" , browser.text_field(:name ,"vis2").value )
|
209
|
-
|
210
|
-
# test the over-ridden append method
|
211
|
-
browser.hidden(:name ,"hid1").append("a")
|
212
|
-
browser.button(:value , "Show Hidden").click
|
213
|
-
assert_equal("444a" , browser.text_field(:name , "vis1").value )
|
214
|
-
assert_equal("555" , browser.text_field(:name ,"vis2").value )
|
215
|
-
|
216
|
-
# test the over-ridden clear method
|
217
|
-
browser.hidden(:name ,"hid1").clear
|
218
|
-
browser.button(:value , "Show Hidden").click
|
219
|
-
assert_equal("" , browser.text_field(:name , "vis1").value )
|
220
|
-
assert_equal("555" , browser.text_field(:name ,"vis2").value )
|
221
|
-
|
222
|
-
# test using a form
|
223
|
-
assert( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:name ,"hid1").exists? )
|
224
|
-
assert( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:id,"hidden_1").exists? )
|
225
|
-
assert_false( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:name,"hidden_44").exists? )
|
226
|
-
assert_false( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:id,"hidden_55").exists? )
|
227
|
-
|
228
|
-
browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:name ,"hid1").value = 222
|
229
|
-
browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:id,"hidden_1").value = 333
|
230
|
-
|
231
|
-
browser.button(:value , "Show Hidden").click
|
232
|
-
|
233
|
-
assert_equal("222" , browser.text_field(:name , "vis1").value )
|
234
|
-
assert_equal("333" , browser.text_field(:name ,"vis2").value )
|
235
|
-
|
236
|
-
# iterators
|
237
|
-
assert_equal(2, browser.hiddens.length)
|
238
|
-
count =1
|
239
|
-
browser.hiddens.each do |h|
|
240
|
-
case count
|
241
|
-
when 1
|
242
|
-
assert_equal( "", h.id)
|
243
|
-
assert_equal( "hid1", h.name)
|
244
|
-
when 2
|
245
|
-
assert_equal( "", h.name)
|
246
|
-
assert_equal( "hidden_1", h.id)
|
247
|
-
end
|
248
|
-
count+=1
|
249
|
-
end
|
250
|
-
|
251
|
-
assert_equal("hid1" , browser.hiddens[0].name )
|
252
|
-
assert_equal("hidden_1" , browser.hiddens[1].id )
|
253
|
-
end
|
254
|
-
end
|
data/unittests/frame_test.rb
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
# feature tests for Frames
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_Frames < Test::Unit::TestCase
|
7
|
-
include Watir::Exception
|
8
|
-
|
9
|
-
def setup
|
10
|
-
goto_page "frame_buttons.html"
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_frame_no_what
|
14
|
-
assert_raises(UnknownFrameException) { browser.frame(:name => "missingFrame").html }
|
15
|
-
assert_raises(UnknownObjectException) { browser.frame(:name => "buttonFrame2").button(:id, "b2").enabled? }
|
16
|
-
assert(browser.frame(:name => "buttonFrame").button(:id, "b2").enabled?)
|
17
|
-
assert_false(browser.frame(:name => "buttonFrame").button(:caption, "Disabled Button").enabled?)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_frame_using_name
|
21
|
-
assert_raises(UnknownFrameException) { browser.frame(:name, "missingFrame").html }
|
22
|
-
assert_raises(UnknownObjectException) { browser.frame(:name, "buttonFrame2").button(:id, "b2").enabled? }
|
23
|
-
assert(browser.frame(:name, "buttonFrame").button(:id, "b2").enabled?)
|
24
|
-
assert_false(browser.frame(:name, "buttonFrame").button(:caption, "Disabled Button").enabled?)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_frame_using_name_and_regexp
|
28
|
-
assert_raises(UnknownFrameException) { browser.frame(:name, /missingFrame/).button(:id, "b2").enabled? }
|
29
|
-
assert(browser.frame(:name, /button/).button(:id, "b2").enabled?)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_frame_using_index
|
33
|
-
assert_raises(UnknownFrameException) { browser.frame(:index, 7).button(:id, "b2").enabled? }
|
34
|
-
assert_raises(UnknownObjectException) { browser.frame(:index, 1).button(:id, "b2").enabled? }
|
35
|
-
assert(browser.frame(:index, 0 ).button(:id, "b2").enabled?)
|
36
|
-
assert_false(browser.frame(:index, 0).button(:caption, "Disabled Button").enabled?)
|
37
|
-
assert_equal('blankpage.html', browser.frame(:index, 1).src)
|
38
|
-
end
|
39
|
-
|
40
|
-
tag_method :test_frame_with_invalid_attribute, :fails_on_firefox
|
41
|
-
|
42
|
-
def test_frame_with_invalid_attribute
|
43
|
-
assert_raises(MissingWayOfFindingObjectException) { browser.frame(:blah, 'no_such_thing').button(:id, "b2").enabled? }
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_preset_frame
|
47
|
-
assert browser.frame(:name => "buttonFrame").button(:id, "b2").enabled?
|
48
|
-
assert !browser.frame(:name => "buttonFrame").button(:caption, "Disabled Button").enabled?
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
class TC_Frames2 < Test::Unit::TestCase
|
54
|
-
include Watir::Exception
|
55
|
-
|
56
|
-
def setup
|
57
|
-
goto_page "frame_multi.html"
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_frame_with_no_name
|
61
|
-
assert_raises(UnknownFrameException) { browser.frame(:name, "missingFrame").button(:id, "b2").enabled? }
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_frame_by_id
|
65
|
-
assert_raises(UnknownFrameException) { browser.frame(:id, "missingFrame").button(:id, "b2").enabled? }
|
66
|
-
assert(browser.frame(:id, 'first_frame').button(:id, "b2").enabled?)
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_frame_by_src
|
70
|
-
assert(browser.frame(:src, /pass/).button(:value, 'Close Window').exists?)
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
class TC_NestedFrames < Test::Unit::TestCase
|
76
|
-
tags :fails_on_firefox
|
77
|
-
|
78
|
-
def setup
|
79
|
-
goto_page "nestedFrames.html"
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_frame
|
83
|
-
assert_raises(UnknownFrameException) { browser.frame(:name => "missingFrame").button(:id, "b2").enabled? }
|
84
|
-
assert_raises(UnknownFrameException) { browser.frame(:name => "nestedFrame").frame(:name => "subFrame").button(:id, "b2").enabled? }
|
85
|
-
assert(browser.frame(:name => "nestedFrame").frame(:name => "senderFrame").button(:name, "sendIt").enabled?)
|
86
|
-
browser.frame(:name => "nestedFrame").frame(:name => "senderFrame").text_field(:index, "0").set("Hello")
|
87
|
-
browser.frame(:name => "nestedFrame").frame(:name => "senderFrame").button(:name, "sendIt").click
|
88
|
-
assert(browser.frame(:name => "nestedFrame").frame(:name => "receiverFrame").text_field(:name, "receiverText").verify_contains("Hello"))
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
class TC_IFrames < Test::Unit::TestCase
|
94
|
-
tags :fails_on_firefox
|
95
|
-
|
96
|
-
def setup
|
97
|
-
goto_page "iframeTest.html"
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_Iframe
|
101
|
-
browser.frame(:name => "senderFrame").text_field(:name, "textToSend").set( "Hello World")
|
102
|
-
browser.frame(:name => "senderFrame").button(:index, 0).click
|
103
|
-
assert( browser.frame(:name => "receiverFrame").text_field(:name, "receiverText").verify_contains("Hello World") )
|
104
|
-
assert_equal(browser.frame(:src, /iframeTest2/).text_field(:name, 'receiverText').value, "Hello World")
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_iframes_id
|
108
|
-
browser.frame(:id, "sf").text_field(:name, "textToSend").set( "Hello World")
|
109
|
-
browser.frame(:id, "sf").button(:name, 'sendIt').click
|
110
|
-
assert( browser.frame(:name => "receiverFrame").text_field(:name, "receiverText").verify_contains("Hello World") )
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
class TC_Frames_click_no_wait < Test::Unit::TestCase
|
116
|
-
def setup
|
117
|
-
goto_page "frame_buttons.html"
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_frame_click_no_wait
|
121
|
-
frame = browser.frame(:name => "buttonFrame")
|
122
|
-
assert !frame.text.include?("PASS")
|
123
|
-
frame.button(:id => "b2").click_no_wait
|
124
|
-
assert_nothing_raised {
|
125
|
-
Watir::Wait.until {frame.text.include?("PASS")}
|
126
|
-
}
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
class TC_Frame_multiple_attributes < Test::Unit::TestCase
|
131
|
-
def setup
|
132
|
-
goto_page "frame_multi.html"
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_get_frame_by_name_and_src
|
136
|
-
assert_equal('blankpage.html', browser.frame(:src => 'blankpage.html', :name => 'buttonFrame2').src)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
class TC_frames_method_for_container < Test::Unit::TestCase
|
141
|
-
def setup
|
142
|
-
goto_page "frame_multi.html"
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_frames_collection
|
146
|
-
frames = browser.frames
|
147
|
-
assert_equal(3, frames.length)
|
148
|
-
assert_equal('first_frame', frames[0].id)
|
149
|
-
assert_equal('pass.html', frames[2].src)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
class TC_iframe_access < Test::Unit::TestCase
|
154
|
-
def setup
|
155
|
-
goto_page "iframe.html"
|
156
|
-
end
|
157
|
-
|
158
|
-
def test_frame_without_access_should_still_show_properties
|
159
|
-
frame = browser.frame(:name, 'iframe')
|
160
|
-
assert_nothing_raised {frame.src}
|
161
|
-
assert_equal('http://www.google.com', frame.src)
|
162
|
-
assert_raises(FrameAccessDeniedException) {frame.button(:index, 0).click}
|
163
|
-
end
|
164
|
-
|
165
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# defect report from users of Watir Recorder
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_GoogleForm < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def setup
|
9
|
-
goto_page "google_india.html"
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_it
|
13
|
-
browser.form(:name, "f").text_field(:name, "q").set("ruby")
|
14
|
-
end
|
15
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<head>
|
3
|
-
<title>Alert Test</title>
|
4
|
-
<script type="text/javascript">
|
5
|
-
function disp_confirm()
|
6
|
-
{
|
7
|
-
testResult = document.getElementById('testResult');
|
8
|
-
if (confirm("Press a button."))
|
9
|
-
testResult.value = "You pressed the Confirm and OK button!";
|
10
|
-
else
|
11
|
-
testResult.value = "You pressed the Confirm and Cancel button!";
|
12
|
-
}
|
13
|
-
function disp_alert()
|
14
|
-
{
|
15
|
-
testResult = document.getElementById('testResult');
|
16
|
-
alert("Press OK")
|
17
|
-
testResult.value = "You pressed the Alert button!"
|
18
|
-
}
|
19
|
-
</script>
|
20
|
-
|
21
|
-
</head>
|
22
|
-
<body>
|
23
|
-
<form action="get">
|
24
|
-
<p>There are two basic methods for bringing up dialogs using javascript.</p>
|
25
|
-
<ul>
|
26
|
-
<li>
|
27
|
-
alert(message) -- Display message and OK button.<br/>
|
28
|
-
<input type="button" id="btnAlert" value="alert" OnClick="disp_alert();" />
|
29
|
-
</li>
|
30
|
-
<li>
|
31
|
-
confirm(message) -- Display message and OK and Cancel buttons.<br/>
|
32
|
-
<input type="button" id="btnConfirm" value="confirm" OnClick="disp_confirm();" /> </li>
|
33
|
-
</ul>
|
34
|
-
<p>Results of dialogs:</p>
|
35
|
-
<input type="text" style="width:248px;" id="testResult" value="Test Result" />
|
36
|
-
</form>
|
37
|
-
</body>
|
38
|
-
|
39
|
-
</html>
|