watir 1.5.6 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{changes.rb → CHANGES} +12 -3
- data/bin/watir-console +7 -1
- data/lib/changes.rb +3 -0
- data/{license.rb → lib/license.rb} +2 -1
- data/{readme.rb → lib/readme.rb} +4 -6
- data/{watir → lib/watir}/AutoItX3.dll +0 -0
- data/{watir → lib/watir}/IEDialog/Release/IEDialog.dll +0 -0
- data/{watir → lib/watir}/WindowHelper.rb +1 -1
- data/{watir → lib/watir}/camel_case.rb +0 -0
- data/{watir → lib/watir}/clickJSDialog.rb +0 -0
- data/{watir → lib/watir}/close_all.rb +1 -1
- data/{watir → lib/watir}/collections.rb +1 -1
- data/{watir → lib/watir}/container.rb +17 -8
- data/{watir → lib/watir}/contrib/enabled_popup.rb +0 -0
- data/{watir → lib/watir}/contrib/ie-new-process.rb +0 -0
- data/{watir → lib/watir}/contrib/page_checker.rb +0 -0
- data/{watir → lib/watir}/contrib/visible.rb +2 -2
- data/{watir → lib/watir}/cookiemanager.rb +0 -0
- data/{watir → lib/watir}/datahandler.rb +0 -0
- data/{watir → lib/watir}/dialog.rb +1 -1
- data/{watir → lib/watir}/element.rb +3 -7
- data/{watir → lib/watir}/element_collections.rb +0 -0
- data/{watir → lib/watir}/form.rb +31 -11
- data/{watir → lib/watir}/frame.rb +0 -0
- data/{watir/ie.rb → lib/watir/ie-class.rb} +22 -22
- data/{watir → lib/watir}/ie-process.rb +0 -0
- data/{watir.rb → lib/watir/ie.rb} +11 -27
- data/{watir → lib/watir}/image.rb +0 -0
- data/{watir → lib/watir}/input_elements.rb +33 -44
- data/{watir → lib/watir}/irb-history.rb +0 -0
- data/{watir → lib/watir}/link.rb +0 -0
- data/{watir → lib/watir}/locator.rb +56 -43
- data/{watir → lib/watir}/logger.rb +0 -0
- data/{watir → lib/watir}/modal_dialog.rb +0 -0
- data/{watir → lib/watir}/non_control_elements.rb +0 -0
- data/{watir → lib/watir}/page-container.rb +2 -2
- data/{watir → lib/watir}/popup.rb +0 -0
- data/{watir → lib/watir}/process.rb +0 -0
- data/{watir → lib/watir}/screen_capture.rb +0 -0
- data/{watir → lib/watir}/setFileDialog.rb +0 -0
- data/{watir → lib/watir}/table.rb +7 -2
- data/{watir → lib/watir}/utils.rb +0 -0
- data/lib/watir/version.rb +5 -0
- data/{watir → lib/watir}/watir_simple.rb +3 -3
- data/{watir → lib/watir}/win32.rb +0 -0
- data/lib/watir/win32ole.rb +6 -0
- data/lib/watir/win32ole/win32ole.so +0 -0
- data/{watir → lib/watir}/winClicker.rb +0 -0
- data/unittests/buttons_xpath_test.rb +32 -32
- data/unittests/checkbox_test.rb +113 -99
- data/unittests/checkbox_xpath_test.rb +57 -57
- data/unittests/core_tests.rb +10 -7
- data/unittests/css_test.rb +12 -32
- data/unittests/defer_test.rb +22 -22
- data/unittests/dialog_test.rb +13 -13
- data/unittests/div2_xpath_test.rb +3 -3
- data/unittests/div_test.rb +23 -19
- data/unittests/div_xpath_test.rb +50 -50
- data/unittests/errorchecker_test.rb +7 -9
- data/unittests/filefield_test.rb +12 -11
- data/unittests/filefield_xpath_test.rb +10 -10
- data/unittests/form_test.rb +144 -151
- data/unittests/form_xpath_test.rb +99 -99
- data/unittests/frame_test.rb +46 -44
- data/unittests/google_form_test.rb +2 -2
- data/unittests/html/checkboxes1.html +19 -16
- data/unittests/html/forms3.html +2 -2
- data/unittests/html/wallofcheckboxes.html +1003 -0
- data/unittests/ie_exists_test.rb +5 -3
- data/unittests/ie_test.rb +2 -2
- data/unittests/images_test.rb +83 -82
- data/unittests/images_xpath_test.rb +40 -40
- data/unittests/iostring_test.rb +1 -1
- data/unittests/links_multi_test.rb +7 -8
- data/unittests/links_test.rb +73 -71
- data/unittests/links_xpath_test.rb +15 -15
- data/unittests/lists_test.rb +10 -10
- data/unittests/map_test.rb +65 -65
- data/unittests/minmax_test.rb +10 -9
- data/unittests/navigate_test.rb +19 -23
- data/unittests/nbsp_xpath_test.rb +2 -2
- data/unittests/non_core_tests.rb +5 -2
- data/unittests/other/WindowLogonExample.rb +2 -2
- data/unittests/other/WindowLogonExtra.rb +1 -1
- data/unittests/other/navigate_exception_test.rb +14 -3
- data/unittests/other/screen_capture_test.rb +3 -2
- data/unittests/other/testcase_method_order_test.rb +1 -1
- data/unittests/pagecontainstext_test.rb +17 -14
- data/unittests/parent_child_test.rb +11 -7
- data/unittests/perf_test.rb +20 -0
- data/unittests/popups_test.rb +13 -14
- data/unittests/pre_test.rb +30 -28
- data/unittests/radios_test.rb +128 -107
- data/unittests/radios_xpath_test.rb +47 -47
- data/unittests/security_setting_test.rb +24 -0
- data/unittests/selectbox_test.rb +65 -157
- data/unittests/selectbox_xpath_test.rb +51 -51
- data/unittests/setup.rb +52 -48
- data/unittests/speed_settings_test.rb +31 -20
- data/unittests/table_cell_using_xpath_test.rb +12 -12
- data/unittests/table_test.rb +30 -16
- data/unittests/table_xpath_test.rb +25 -25
- data/unittests/test_tests.rb +9 -0
- data/unittests/textarea_test.rb +33 -33
- data/unittests/textarea_xpath_test.rb +37 -37
- data/unittests/textfield_for_ch_char_test.rb +9 -9
- data/unittests/textfields_test.rb +103 -98
- data/unittests/textfields_xpath_test.rb +50 -50
- data/unittests/windows/attach_to_existing_window_test.rb +2 -2
- data/unittests/windows/attach_to_new_window_test.rb +10 -10
- data/unittests/windows/close_window_test.rb +2 -2
- data/unittests/windows/frame_links_test.rb +6 -6
- data/unittests/windows/ie-each_test.rb +1 -1
- data/unittests/windows/iedialog_test.rb +4 -5
- data/unittests/windows/js_events_test.rb +14 -14
- data/unittests/windows/jscriptExtraAlert.rb +2 -1
- data/unittests/windows/jscriptExtraConfirmCancel.rb +1 -1
- data/unittests/windows/jscriptExtraConfirmOk.rb +1 -1
- data/unittests/windows/jscriptPushButton.rb +2 -1
- data/unittests/windows/jscript_test.rb +7 -7
- data/unittests/windows/modal_dialog_test.rb +28 -29
- data/unittests/windows/{new.rb → new_test.rb} +1 -1
- data/unittests/windows/open_close_test.rb +4 -7
- data/unittests/windows/send_keys_test.rb +11 -11
- data/unittests/xpath_tests.rb +4 -3
- metadata +82 -58
- data/unittests/buttons_test.rb +0 -107
- data/watir/assertions.rb +0 -44
- data/watir/exceptions.rb +0 -42
- data/watir/testcase.rb +0 -58
- data/watir/waiter.rb +0 -88
- data/watir/win32ole.rb +0 -8
- data/watir/win32ole/win32ole.so +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Forms
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1544 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Forms2_XPath < Test::Unit::TestCase
|
@@ -10,28 +10,28 @@ class TC_Forms2_XPath < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_Form_Exists
|
13
|
-
assert(
|
14
|
-
|
13
|
+
assert(browser.form(:xpath , "//form[@name='test2']/").exists?)
|
14
|
+
assert_false(browser.form(:xpath , "//form[@name='missing']/").exists?)
|
15
15
|
|
16
|
-
assert(
|
17
|
-
|
16
|
+
assert(browser.form(:xpath , "//form[@method='get']/").exists?)
|
17
|
+
assert_false(browser.form(:xpath , "//form[@method='missing']/").exists?)
|
18
18
|
|
19
|
-
assert(
|
20
|
-
|
19
|
+
assert(browser.form(:xpath , "//form[@action='pass.html']/").exists?)
|
20
|
+
assert_false(browser.form(:xpath , "//form[@action='missing']/").exists?)
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_ButtonInForm
|
24
|
-
assert(
|
24
|
+
assert(browser.form(:xpath , "//form[@name='test2']/").button(:caption , "Submit").exists?)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
require 'unittests/iostring'
|
29
|
-
class
|
29
|
+
class TC_Form_Display_XPath < Test::Unit::TestCase
|
30
30
|
include MockStdoutTestCase
|
31
31
|
def test_showforms
|
32
32
|
goto_page "forms2.html"
|
33
33
|
$stdout = @mockout
|
34
|
-
|
34
|
+
browser.show_forms
|
35
35
|
assert_equal(<<END_OF_MESSAGE, @mockout)
|
36
36
|
There are 4 forms
|
37
37
|
Form name:
|
@@ -54,125 +54,125 @@ END_OF_MESSAGE
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
class
|
57
|
+
class TC_Forms3_XPath < Test::Unit::TestCase
|
58
58
|
def setup
|
59
59
|
goto_page "forms3.html"
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_Form_Exists
|
63
|
-
assert(
|
64
|
-
|
63
|
+
assert(browser.form(:xpath , "//form[@name='test2']/").exists?)
|
64
|
+
assert_false(browser.form(:xpath , "//form[@name='missing']/").exists?)
|
65
65
|
|
66
|
-
assert(
|
67
|
-
|
66
|
+
assert(browser.form(:xpath , "//form[@method='get']/").exists?)
|
67
|
+
assert_false(browser.form(:xpath , "//form[@method='missing']/").exists?)
|
68
68
|
|
69
|
-
assert(
|
70
|
-
|
69
|
+
assert(browser.form(:xpath , "//form[@action='pass.html']/").exists?)
|
70
|
+
assert_false(browser.form(:xpath , "//form[@action='missing']/").exists?)
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_getObject_when_non_watir_object_before_it
|
74
74
|
# test for bug reported by Scott Pack, http://rubyforge.org/pipermail/wtr-general/2005-June/002223.html
|
75
|
-
assert_equal("check1" ,
|
75
|
+
assert_equal("check1" , browser.checkbox(:index,1).name )
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_showforms # add verification of output!
|
79
|
-
|
79
|
+
browser.show_forms
|
80
80
|
end
|
81
81
|
|
82
82
|
def test_reset
|
83
83
|
|
84
|
-
|
85
|
-
assert_equal(
|
84
|
+
browser.text_field(:id, "t1").set("Hello, reset test!")
|
85
|
+
assert_equal(browser.text_field(:id, 't1').value, 'Hello, reset test!')
|
86
86
|
|
87
|
-
|
88
|
-
assert_equal("" ,
|
87
|
+
browser.button(:caption, "Reset").click
|
88
|
+
assert_equal("" , browser.text_field(:id, 't1').value )
|
89
89
|
|
90
90
|
# also verify it works under a form
|
91
|
-
|
92
|
-
assert_equal(
|
91
|
+
browser.text_field(:id, "t1").set("reset test - using a form")
|
92
|
+
assert_equal(browser.text_field(:id, 't1').value, 'reset test - using a form')
|
93
93
|
|
94
94
|
# also verify it works under a form, this time using the :id attribute
|
95
|
-
|
96
|
-
assert_equal(
|
95
|
+
browser.text_field(:id, "t1").set("reset test - using a form")
|
96
|
+
assert_equal(browser.text_field(:id, 't1').value, 'reset test - using a form')
|
97
97
|
end
|
98
98
|
|
99
99
|
def test_flash1
|
100
|
-
|
100
|
+
browser.form(:xpath , "//form[@name='test2']/").button(:caption , "Submit").flash
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_objects_with_same_name
|
104
|
-
assert_equal('textfield'
|
105
|
-
assert_equal('button'
|
106
|
-
assert_equal('1'
|
107
|
-
assert_equal('2'
|
104
|
+
assert_equal('textfield' ,browser.text_field( :name , 'g1').value )
|
105
|
+
assert_equal('button' ,browser.button( :name , 'g1').value )
|
106
|
+
assert_equal('1' ,browser.checkbox( :name , 'g1').value )
|
107
|
+
assert_equal('2' ,browser.radio( :name , 'g1').value )
|
108
108
|
|
109
|
-
assert_equal('textfield_id'
|
110
|
-
assert_equal('button_id'
|
111
|
-
assert_equal('1_id'
|
112
|
-
assert_equal('2_id'
|
109
|
+
assert_equal('textfield_id' ,browser.text_field( :id , 'g1').value )
|
110
|
+
assert_equal('button_id' ,browser.button( :id , 'g1').value )
|
111
|
+
assert_equal('1_id' ,browser.checkbox( :id , 'g1').value )
|
112
|
+
assert_equal('2_id' ,browser.radio( :id , 'g1').value )
|
113
113
|
end
|
114
114
|
|
115
115
|
def test_flash2
|
116
|
-
|
117
|
-
assert_raises( Watir::UnknownObjectException ) {
|
116
|
+
browser.button(:value, 'Click Me').flash
|
117
|
+
assert_raises( Watir::UnknownObjectException ) { browser.text_field( :name , 'g177').flash }
|
118
118
|
end
|
119
119
|
|
120
120
|
def test_showElements # add verification!
|
121
|
-
|
121
|
+
browser.show_all_objects
|
122
122
|
end
|
123
123
|
|
124
124
|
def test_showText
|
125
|
-
puts
|
125
|
+
puts browser.text
|
126
126
|
end
|
127
127
|
|
128
128
|
def test_showHTML
|
129
|
-
puts
|
129
|
+
puts browser.html
|
130
130
|
end
|
131
131
|
|
132
132
|
def test_submitWithImage
|
133
|
-
assert(
|
134
|
-
assert(
|
133
|
+
assert( browser.button(:alt , "submit").exists? )
|
134
|
+
assert( browser.button(:alt , /sub/).exists? )
|
135
135
|
|
136
|
-
|
137
|
-
|
136
|
+
assert_false( browser.button(:alt , "missing").exists? )
|
137
|
+
assert_false( browser.button(:alt , /missing/).exists? )
|
138
138
|
|
139
|
-
#assert(
|
140
|
-
assert(
|
139
|
+
#assert( browser.button(:src , "file:///#{$myDir}/html/images/button.jpg").exists? ) # this doesnt work for everybody
|
140
|
+
assert( browser.button(:src , /button/).exists? )
|
141
141
|
|
142
|
-
|
143
|
-
|
144
|
-
assert_nothing_raised("raised an exception when it shouldnt have") {
|
142
|
+
assert_false( browser.button(:src , "missing").exists? )
|
143
|
+
assert_false( browser.button(:src , /missing/).exists? )
|
144
|
+
assert_nothing_raised("raised an exception when it shouldnt have") { browser.button(:src , /button/).click }
|
145
145
|
|
146
|
-
assert(
|
146
|
+
assert( browser.contains_text("PASS") )
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
class
|
150
|
+
class TC_Forms4_XPath < Test::Unit::TestCase
|
151
151
|
def setup
|
152
152
|
goto_page "forms4.html"
|
153
153
|
end
|
154
154
|
|
155
155
|
def test_find_text_field_ignoring_form
|
156
|
-
assert_equal(
|
156
|
+
assert_equal(browser.text_field(:name, 'name').value, 'apple') # should it raise a not-unique error instead?
|
157
157
|
end
|
158
158
|
|
159
159
|
def test_correct_form_field_is_found_using_form_name
|
160
|
-
assert_equal(
|
161
|
-
assert_equal(
|
160
|
+
assert_equal(browser.form(:xpath , "//form[@name='apple_form']/").text_field(:name, 'name').value, 'apple')
|
161
|
+
assert_equal(browser.form(:xpath , "//form[@name='banana_form']/").text_field(:name, 'name').value, 'banana')
|
162
162
|
end
|
163
163
|
|
164
164
|
def test_using_text_on_form
|
165
|
-
|
166
|
-
assert_equal(
|
165
|
+
browser.form(:xpath , "//form[@name='apple_form']/").text_field(:name, 'name').set('strudel')
|
166
|
+
assert_equal(browser.form(:index, 1).text_field(:name, 'name').value, 'strudel')
|
167
167
|
end
|
168
168
|
|
169
169
|
def test_submit
|
170
|
-
|
171
|
-
assert(
|
170
|
+
browser.form(:xpath , "//form[@name='apple_form']/").submit
|
171
|
+
assert( browser.contains_text("PASS") )
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
-
class
|
175
|
+
class TC_Hidden_Fields_XPath < Test::Unit::TestCase
|
176
176
|
def setup
|
177
177
|
goto_page "forms3.html"
|
178
178
|
end
|
@@ -180,62 +180,62 @@ class TC_Hidden_Fields < Test::Unit::TestCase
|
|
180
180
|
def test_hidden
|
181
181
|
|
182
182
|
# test using index
|
183
|
-
assert(
|
184
|
-
assert(
|
185
|
-
|
183
|
+
assert( browser.hidden(:index,1).exists? )
|
184
|
+
assert( browser.hidden(:index,2).exists? )
|
185
|
+
assert_false( browser.hidden(:index,3).exists? )
|
186
186
|
|
187
|
-
|
188
|
-
|
187
|
+
browser.hidden(:index,1).value = 44
|
188
|
+
browser.hidden(:index,2).value = 55
|
189
189
|
|
190
|
-
|
190
|
+
browser.button(:value , "Show Hidden").click
|
191
191
|
|
192
|
-
assert_equal("44" ,
|
193
|
-
assert_equal("55" ,
|
192
|
+
assert_equal("44" , browser.text_field(:name , "vis1").value )
|
193
|
+
assert_equal("55" , browser.text_field(:name , "vis2").value )
|
194
194
|
|
195
195
|
# test using name and ID
|
196
|
-
assert(
|
197
|
-
assert(
|
198
|
-
|
199
|
-
|
196
|
+
assert( browser.hidden(:name ,"hid1").exists? )
|
197
|
+
assert( browser.hidden(:id,"hidden_1").exists? )
|
198
|
+
assert_false( browser.hidden(:name,"hidden_44").exists? )
|
199
|
+
assert_false( browser.hidden(:id,"hidden_55").exists? )
|
200
200
|
|
201
|
-
|
202
|
-
|
201
|
+
browser.hidden(:name ,"hid1").value = 444
|
202
|
+
browser.hidden(:id,"hidden_1").value = 555
|
203
203
|
|
204
|
-
|
204
|
+
browser.button(:value , "Show Hidden").click
|
205
205
|
|
206
|
-
assert_equal("444" ,
|
207
|
-
assert_equal("555" ,
|
206
|
+
assert_equal("444" , browser.text_field(:name , "vis1").value )
|
207
|
+
assert_equal("555" , browser.text_field(:name ,"vis2").value )
|
208
208
|
|
209
209
|
# test the over-ridden append method
|
210
|
-
|
211
|
-
|
212
|
-
assert_equal("444a" ,
|
213
|
-
assert_equal("555" ,
|
210
|
+
browser.hidden(:name ,"hid1").append("a")
|
211
|
+
browser.button(:value , "Show Hidden").click
|
212
|
+
assert_equal("444a" , browser.text_field(:name , "vis1").value )
|
213
|
+
assert_equal("555" , browser.text_field(:name ,"vis2").value )
|
214
214
|
|
215
215
|
# test the over-ridden clear method
|
216
|
-
|
217
|
-
|
218
|
-
assert_equal("" ,
|
219
|
-
assert_equal("555" ,
|
216
|
+
browser.hidden(:name ,"hid1").clear
|
217
|
+
browser.button(:value , "Show Hidden").click
|
218
|
+
assert_equal("" , browser.text_field(:name , "vis1").value )
|
219
|
+
assert_equal("555" , browser.text_field(:name ,"vis2").value )
|
220
220
|
|
221
221
|
# test using a form
|
222
|
-
assert(
|
223
|
-
assert(
|
224
|
-
|
225
|
-
|
222
|
+
assert( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:name ,"hid1").exists? )
|
223
|
+
assert( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:id,"hidden_1").exists? )
|
224
|
+
assert_false( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:name,"hidden_44").exists? )
|
225
|
+
assert_false( browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:id,"hidden_55").exists? )
|
226
226
|
|
227
|
-
|
228
|
-
|
227
|
+
browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:name ,"hid1").value = 222
|
228
|
+
browser.form(:xpath , "//form[@name='has_a_hidden']/").hidden(:id,"hidden_1").value = 333
|
229
229
|
|
230
|
-
|
230
|
+
browser.button(:value , "Show Hidden").click
|
231
231
|
|
232
|
-
assert_equal("222" ,
|
233
|
-
assert_equal("333" ,
|
232
|
+
assert_equal("222" , browser.text_field(:name , "vis1").value )
|
233
|
+
assert_equal("333" , browser.text_field(:name ,"vis2").value )
|
234
234
|
|
235
235
|
# iterators
|
236
|
-
assert_equal(2,
|
236
|
+
assert_equal(2, browser.hiddens.length)
|
237
237
|
count =1
|
238
|
-
|
238
|
+
browser.hiddens.each do |h|
|
239
239
|
case count
|
240
240
|
when 1
|
241
241
|
assert_equal( "", h.id)
|
@@ -247,7 +247,7 @@ class TC_Hidden_Fields < Test::Unit::TestCase
|
|
247
247
|
count+=1
|
248
248
|
end
|
249
249
|
|
250
|
-
assert_equal("hid1" ,
|
251
|
-
assert_equal("hidden_1" ,
|
250
|
+
assert_equal("hid1" , browser.hiddens[1].name )
|
251
|
+
assert_equal("hidden_1" , browser.hiddens[2].id )
|
252
252
|
end
|
253
253
|
end
|
data/unittests/frame_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Frames
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1505 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Frames < Test::Unit::TestCase
|
@@ -12,46 +12,47 @@ class TC_Frames < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_frame_no_what
|
15
|
-
assert_raises(UnknownFrameException) {
|
16
|
-
assert_raises(UnknownObjectException) {
|
17
|
-
assert(
|
18
|
-
|
15
|
+
assert_raises(UnknownFrameException) { browser.frame("missingFrame").button(:id, "b2").enabled? }
|
16
|
+
assert_raises(UnknownObjectException) { browser.frame("buttonFrame2").button(:id, "b2").enabled? }
|
17
|
+
assert(browser.frame("buttonFrame").button(:id, "b2").enabled?)
|
18
|
+
assert_false(browser.frame("buttonFrame").button(:caption, "Disabled Button").enabled?)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_frame_using_name
|
22
|
-
assert_raises(UnknownFrameException) {
|
23
|
-
assert_raises(UnknownObjectException) {
|
24
|
-
assert(
|
25
|
-
|
22
|
+
assert_raises(UnknownFrameException) { browser.frame(:name , "missingFrame").button(:id, "b2").enabled? }
|
23
|
+
assert_raises(UnknownObjectException) { browser.frame(:name, "buttonFrame2").button(:id, "b2").enabled? }
|
24
|
+
assert(browser.frame(:name, "buttonFrame").button(:id, "b2").enabled?)
|
25
|
+
assert_false(browser.frame(:name , "buttonFrame").button(:caption, "Disabled Button").enabled?)
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_frame_using_name_and_regexp
|
29
|
-
assert_raises(UnknownFrameException) {
|
30
|
-
assert(
|
29
|
+
assert_raises(UnknownFrameException) { browser.frame(:name , /missingFrame/).button(:id, "b2").enabled? }
|
30
|
+
assert(browser.frame(:name, /button/).button(:id, "b2").enabled?)
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_frame_using_index
|
34
|
-
assert_raises(UnknownFrameException) {
|
35
|
-
assert_raises(UnknownObjectException) {
|
36
|
-
assert(
|
37
|
-
|
34
|
+
assert_raises(UnknownFrameException) { browser.frame(:index, 8).button(:id, "b2").enabled? }
|
35
|
+
assert_raises(UnknownObjectException) { browser.frame(:index, 2).button(:id, "b2").enabled? }
|
36
|
+
assert(browser.frame(:index, 1 ).button(:id, "b2").enabled?)
|
37
|
+
assert_false(browser.frame(:index, 1).button(:caption, "Disabled Button").enabled?)
|
38
38
|
end
|
39
39
|
|
40
|
+
tag_method :test_frame_with_invalid_attribute, :fails_on_firefox
|
40
41
|
def test_frame_with_invalid_attribute
|
41
|
-
assert_raises(ArgumentError) {
|
42
|
+
assert_raises(ArgumentError) { browser.frame(:blah, 'no_such_thing').button(:id, "b2").enabled? }
|
42
43
|
end
|
43
44
|
|
44
45
|
def test_preset_frame
|
45
46
|
# with ruby's instance_eval, we are able to use the same frame for several actions
|
46
|
-
results =
|
47
|
+
results = browser.frame("buttonFrame").instance_eval do [
|
47
48
|
button(:id, "b2").enabled?,
|
48
49
|
button(:caption, "Disabled Button").enabled?
|
49
50
|
]
|
50
51
|
end
|
51
52
|
assert_equal([true, false], results)
|
52
53
|
end
|
53
|
-
|
54
54
|
end
|
55
|
+
|
55
56
|
|
56
57
|
class TC_Frames2 < Test::Unit::TestCase
|
57
58
|
include Watir::Exception
|
@@ -61,57 +62,55 @@ class TC_Frames2 < Test::Unit::TestCase
|
|
61
62
|
end
|
62
63
|
|
63
64
|
def test_frame_with_no_name
|
64
|
-
assert_raises(UnknownFrameException) {
|
65
|
+
assert_raises(UnknownFrameException) { browser.frame(:name , "missingFrame").button(:id, "b2").enabled? }
|
65
66
|
end
|
66
67
|
|
67
68
|
def test_frame_by_id
|
68
|
-
assert_raises(UnknownFrameException) {
|
69
|
-
assert(
|
69
|
+
assert_raises(UnknownFrameException) { browser.frame(:id , "missingFrame").button(:id, "b2").enabled? }
|
70
|
+
assert(browser.frame(:id, 'first_frame').button(:id, "b2").enabled?)
|
70
71
|
end
|
71
72
|
|
72
73
|
def test_frame_by_src
|
73
|
-
assert(
|
74
|
+
assert(browser.frame(:src, /pass/).button(:value, 'Close Window').exists?)
|
74
75
|
end
|
75
76
|
|
76
77
|
end
|
77
78
|
|
78
79
|
class TC_NestedFrames < Test::Unit::TestCase
|
79
|
-
|
80
|
-
|
80
|
+
tags :fails_on_firefox
|
81
81
|
def setup
|
82
82
|
goto_page "nestedFrames.html"
|
83
83
|
end
|
84
84
|
|
85
85
|
def test_frame
|
86
|
-
assert_raises(UnknownFrameException) {
|
87
|
-
assert_raises(UnknownFrameException) {
|
88
|
-
assert(
|
89
|
-
|
90
|
-
|
91
|
-
assert(
|
92
|
-
|
86
|
+
assert_raises(UnknownFrameException) { browser.frame("missingFrame").button(:id, "b2").enabled? }
|
87
|
+
assert_raises(UnknownFrameException) { browser.frame("nestedFrame").frame("subFrame").button(:id, "b2").enabled? }
|
88
|
+
assert(browser.frame("nestedFrame").frame("senderFrame").button(:name, "sendIt").enabled?)
|
89
|
+
browser.frame("nestedFrame").frame("senderFrame").text_field(:index, "1").set("Hello")
|
90
|
+
browser.frame("nestedFrame").frame("senderFrame").button(:name, "sendIt").click
|
91
|
+
assert(browser.frame("nestedFrame").frame("receiverFrame").text_field(:name, "receiverText").verify_contains("Hello"))
|
93
92
|
end
|
94
93
|
|
95
94
|
end
|
96
95
|
|
97
96
|
class TC_IFrames < Test::Unit::TestCase
|
98
|
-
|
97
|
+
tags :fails_on_firefox
|
98
|
+
|
99
99
|
def setup
|
100
100
|
goto_page "iframeTest.html"
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_Iframe
|
104
|
-
|
105
|
-
|
106
|
-
assert(
|
107
|
-
assert_equal(
|
104
|
+
browser.frame("senderFrame").text_field(:name , "textToSend").set( "Hello World")
|
105
|
+
browser.frame("senderFrame").button(:index, 1).click
|
106
|
+
assert( browser.frame("receiverFrame").text_field(:name , "receiverText").verify_contains("Hello World") )
|
107
|
+
assert_equal(browser.frame(:src, /iframeTest2/).text_field(:name, 'receiverText').value, "Hello World")
|
108
108
|
end
|
109
109
|
|
110
|
-
#VALIDATE THAT WE CAN GET THERE VIA id
|
111
110
|
def test_iframes_id
|
112
|
-
|
113
|
-
|
114
|
-
assert(
|
111
|
+
browser.frame(:id, "sf").text_field(:name , "textToSend").set( "Hello World")
|
112
|
+
browser.frame(:id, "sf").button(:name,'sendIt').click
|
113
|
+
assert( browser.frame("receiverFrame").text_field(:name , "receiverText").verify_contains("Hello World") )
|
115
114
|
end
|
116
115
|
|
117
116
|
end
|
@@ -121,12 +120,13 @@ class TC_show_frames < Test::Unit::TestCase
|
|
121
120
|
include MockStdoutTestCase
|
122
121
|
|
123
122
|
def capture_and_compare(page, expected)
|
124
|
-
|
123
|
+
goto_page page
|
125
124
|
$stdout = @mockout
|
126
|
-
|
125
|
+
browser.showFrames
|
127
126
|
assert_equal(expected, @mockout)
|
128
127
|
end
|
129
|
-
|
128
|
+
|
129
|
+
tag_method :test_show_nested_frames, :fails_on_firefox
|
130
130
|
def test_show_nested_frames
|
131
131
|
capture_and_compare("nestedFrames.html", <<END_OF_MESSAGE)
|
132
132
|
there are 2 frames
|
@@ -135,6 +135,7 @@ frame index: 2 name: nestedFrame2
|
|
135
135
|
END_OF_MESSAGE
|
136
136
|
end
|
137
137
|
|
138
|
+
tag_method :test_button_frames, :fails_on_firefox
|
138
139
|
def test_button_frames
|
139
140
|
capture_and_compare("frame_buttons.html", <<END_OF_MESSAGE)
|
140
141
|
there are 2 frames
|
@@ -143,6 +144,7 @@ frame index: 2 name: buttonFrame2
|
|
143
144
|
END_OF_MESSAGE
|
144
145
|
end
|
145
146
|
|
147
|
+
tag_method :test_iframes, :fails_on_firefox
|
146
148
|
def test_iframes
|
147
149
|
capture_and_compare("iframeTest.html", <<END_OF_MESSAGE)
|
148
150
|
there are 2 frames
|