firewatir 1.2.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/lib/firewatir.rb +50 -0
  2. data/lib/firewatir/MozillaBaseElement.rb +1863 -0
  3. data/lib/firewatir/container.rb +534 -0
  4. data/lib/firewatir/exceptions.rb +10 -0
  5. data/lib/firewatir/firefox.rb +1127 -0
  6. data/lib/firewatir/htmlelements.rb +1911 -0
  7. data/lib/firewatir/version.rb +5 -0
  8. data/{firewatir → lib/firewatir}/winClicker.rb +0 -0
  9. data/{firewatir → lib/firewatir}/x11.rb +0 -0
  10. data/unittests/attach_to_new_window_test.rb +20 -12
  11. data/unittests/bug_fixes_test.rb +79 -69
  12. data/unittests/buttons_xpath_test.rb +45 -44
  13. data/unittests/checkbox_test.rb +86 -85
  14. data/unittests/checkbox_xpath_test.rb +58 -58
  15. data/unittests/div_test.rb +117 -115
  16. data/unittests/filefield_test.rb +12 -12
  17. data/unittests/filefield_xpath_test.rb +11 -11
  18. data/unittests/form_test.rb +134 -133
  19. data/unittests/frame_test.rb +42 -41
  20. data/unittests/hidden_test.rb +40 -40
  21. data/unittests/hidden_xpath_test.rb +32 -32
  22. data/unittests/images_test.rb +85 -84
  23. data/unittests/images_xpath_test.rb +57 -56
  24. data/unittests/iostring_test.rb +1 -1
  25. data/unittests/javascript_test.rb +42 -38
  26. data/unittests/links_test.rb +88 -86
  27. data/unittests/links_xpath_test.rb +38 -38
  28. data/unittests/mozilla_all_tests.rb +2 -14
  29. data/unittests/pre_test.rb +27 -25
  30. data/unittests/radios_test.rb +86 -86
  31. data/unittests/radios_xpath_test.rb +48 -48
  32. data/unittests/redirect_test.rb +20 -19
  33. data/unittests/selectbox_test.rb +72 -71
  34. data/unittests/selectbox_xpath_test.rb +58 -56
  35. data/unittests/setup.rb +22 -27
  36. data/unittests/table_test.rb +89 -88
  37. data/unittests/table_xpath_test.rb +37 -36
  38. data/unittests/textfields_test.rb +105 -102
  39. data/unittests/textfields_xpath_test.rb +53 -52
  40. metadata +37 -18
  41. data/MozillaBaseElement.rb +0 -1780
  42. data/container.rb +0 -900
  43. data/firewatir.rb +0 -1195
  44. data/firewatir/exceptions.rb +0 -44
  45. data/firewatir/testUnitAddons.rb +0 -8
  46. data/htmlelements.rb +0 -2281
  47. data/unittests/buttons_test.rb +0 -215
@@ -1,36 +1,36 @@
1
1
  # feature tests for file Fields
2
2
  # revision: $Revision: 1.0 $
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
5
5
  require 'unittests/setup'
6
6
 
7
7
  class TC_FileField < Test::Unit::TestCase
8
- include FireWatir
8
+
9
9
 
10
10
  def gotoPage()
11
- $ff.goto($htmlRoot + "fileupload.html")
11
+ goto_page("fileupload.html")
12
12
  end
13
13
 
14
14
  def test_fileField_Exists
15
15
  gotoPage()
16
16
  #test for existance of 4 file area
17
- assert($ff.file_field(:name,"file1").exists?)
18
- assert($ff.file_field(:id,"file2").exists?)
17
+ assert(browser.file_field(:name,"file1").exists?)
18
+ assert(browser.file_field(:id,"file2").exists?)
19
19
  #test for missing
20
- assert_false($ff.file_field(:name, "missing").exists?)
21
- assert_false($ff.file_field(:name,"totallybogus").exists?)
20
+ assert_false(browser.file_field(:name, "missing").exists?)
21
+ assert_false(browser.file_field(:name,"totallybogus").exists?)
22
22
  #pop one open and put something in it.
23
- $ff.file_field(:name,"file3").set($htmlRoot + "fileupload.html")
23
+ browser.file_field(:name,"file3").set($htmlRoot + "fileupload.html")
24
24
  #click the upload button
25
- $ff.button(:name,"upload").click
25
+ browser.button(:name,"upload").click
26
26
 
27
- assert($ff.text.include?("PASS"))
27
+ assert(browser.text.include?("PASS"))
28
28
  end
29
29
 
30
30
  def test_iterator
31
31
  gotoPage()
32
- assert_equal(6, $ff.file_fields.length)
33
- arrFileFields = $ff.file_fields
32
+ assert_equal(6, browser.file_fields.length)
33
+ arrFileFields = browser.file_fields
34
34
  assert_equal("file1", arrFileFields[1].name)
35
35
  assert_equal("file2", arrFileFields[2].id)
36
36
  assert_equal("disabled", arrFileFields[3].name)
@@ -1,35 +1,35 @@
1
1
  # feature tests for TextArea Fields
2
2
  # revision: $Revision: 1.0 $
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
5
5
  require 'unittests/setup'
6
6
 
7
7
  class TC_FileField_XPath < Test::Unit::TestCase
8
- include FireWatir
8
+
9
9
 
10
10
  def gotoPage
11
- $ff.goto($htmlRoot + "fileupload.html")
11
+ goto_page("fileupload.html")
12
12
  end
13
13
 
14
14
  def test_file_field_Exists
15
15
  gotoPage()
16
16
  #test for existance of 4 file area
17
- assert($ff.file_field(:xpath, "//input[@name='file1']").exists?)
18
- assert($ff.file_field(:xpath, "//input[@id='file2']").exists?)
17
+ assert(browser.file_field(:xpath, "//input[@name='file1']").exists?)
18
+ assert(browser.file_field(:xpath, "//input[@id='file2']").exists?)
19
19
  #test for missing
20
- assert_false($ff.file_field(:xpath, "//input[@name='missing']").exists?)
21
- assert_false($ff.file_field(:xpath, "//input[@name='totallybogus']").exists?)
20
+ assert_false(browser.file_field(:xpath, "//input[@name='missing']").exists?)
21
+ assert_false(browser.file_field(:xpath, "//input[@name='totallybogus']").exists?)
22
22
  #pop one open and put something in it.
23
- $ff.file_field(:xpath, "//input[@name='file3']").set($htmlRoot + "fileupload.html")
23
+ browser.file_field(:xpath, "//input[@name='file3']").set($htmlRoot + "fileupload.html")
24
24
  #click the upload button
25
- $ff.button(:xpath, "//input[@name='upload']").click
25
+ browser.button(:xpath, "//input[@name='upload']").click
26
26
 
27
- assert($ff.text.include?("PASS"))
27
+ assert(browser.text.include?("PASS"))
28
28
  end
29
29
 
30
30
  #def test_iterator
31
31
  # gotoPage()
32
- # assert_equal(6, $ff.file_fields.length)
32
+ # assert_equal(6, browser.file_fields.length)
33
33
  #end
34
34
 
35
35
  end
@@ -1,61 +1,62 @@
1
1
  # feature tests for Forms
2
2
  # revision: $Revision: 1.0 $
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __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 < Test::Unit::TestCase # Note: there is no TC_Forms
8
- include FireWatir
8
+
9
9
 
10
10
  def setup
11
- $ff.goto($htmlRoot + "forms2.html")
11
+ goto_page("forms2.html")
12
12
  end
13
13
 
14
14
  def test_Form_Exists
15
- assert($ff.form(:name, "test2").exists?)
16
- assert(!$ff.form(:name, "missing").exists?)
15
+ assert(browser.form(:name, "test2").exists?)
16
+ assert_false(browser.form(:name, "missing").exists?)
17
17
 
18
- assert($ff.form("test2").exists?)
19
- assert(!$ff.form( "missing").exists?)
18
+ assert(browser.form("test2").exists?)
19
+ assert_false(browser.form( "missing").exists?)
20
20
 
21
- assert($ff.form(:index, 1).exists?)
22
- assert(!$ff.form(:index, 88).exists?)
21
+ assert(browser.form(:index, 1).exists?)
22
+ assert_false(browser.form(:index, 88).exists?)
23
23
 
24
- assert($ff.form(:method, "get").exists?)
25
- assert(!$ff.form(:method, "missing").exists?)
24
+ assert(browser.form(:method, "get").exists?)
25
+ assert_false(browser.form(:method, "missing").exists?)
26
26
 
27
- assert($ff.form(:id, 'f2').exists?)
28
- assert(!$ff.form(:id, 'missing').exists?)
27
+ assert(browser.form(:id, 'f2').exists?)
28
+ assert_false(browser.form(:id, 'missing').exists?)
29
29
 
30
- assert($ff.form(:action, /pass.html/).exists?)
31
- assert(!$ff.form(:action, "missing").exists?)
30
+ assert(browser.form(:action, /pass.html/).exists?)
31
+ assert_false(browser.form(:action, "missing").exists?)
32
32
  end
33
33
 
34
34
  def test_ButtonInForm
35
- assert($ff.form(:name, "test2").button(:caption , "Submit").exists?)
35
+ assert(browser.form(:name, "test2").button(:caption , "Submit").exists?)
36
36
  end
37
37
 
38
38
  # The following tests from bug 2261
39
+ tag_method :test_form_html, :fails_on_ie
39
40
  def test_form_html
40
41
  assert_equal("\n<BR><INPUT value=\"Submit\" type=\"submit\">\n".downcase(),
41
- $ff.form(:name, 'test2').html.downcase())
42
+ browser.form(:name, 'test2').html.downcase())
42
43
  end
43
44
  def test_form_flash
44
- assert_nothing_raised{ $ff.form(:name, 'test2').flash }
45
+ assert_nothing_raised{ browser.form(:name, 'test2').flash }
45
46
  end
46
47
  def test_form_sub_element
47
- assert_equal('Click Me', $ff.form(:index, 1).button(:name, 'b1').value)
48
+ assert_equal('Click Me', browser.form(:index, 1).button(:name, 'b1').value)
48
49
  end
49
50
  end
50
51
 
51
52
  class TC_Form_Display < Test::Unit::TestCase
52
- include FireWatir
53
+
53
54
  include MockStdoutTestCase
54
55
 
55
56
  def test_showforms
56
- $ff.goto($htmlRoot + "forms2.html")
57
+ goto_page("forms2.html")
57
58
  $stdout = @mockout
58
- $ff.showForms
59
+ browser.showForms
59
60
  assert_equal(<<END_OF_MESSAGE, @mockout)
60
61
  There are 4 forms
61
62
  Form name:
@@ -79,217 +80,217 @@ END_OF_MESSAGE
79
80
  end
80
81
 
81
82
  class TC_Forms3 < Test::Unit::TestCase
82
- include FireWatir
83
+
83
84
  def setup
84
- $ff.goto($htmlRoot + "forms3.html")
85
+ goto_page("forms3.html")
85
86
  end
86
87
 
87
88
  # The following tests from bug 2261
88
89
  def test_p_in_form
89
- $ff.form(:name, 'buttonsubmit').p(:index, 1).text
90
+ browser.form(:name, 'buttonsubmit').p(:index, 1).text
90
91
  end
91
92
 
92
93
  def test_Form_Exists
93
- assert($ff.form(:name, "test2").exists?)
94
- assert(!$ff.form(:name, "missing").exists?)
94
+ assert(browser.form(:name, "test2").exists?)
95
+ assert_false(browser.form(:name, "missing").exists?)
95
96
 
96
- assert($ff.form("test2").exists?)
97
- assert(!$ff.form( "missing").exists?)
97
+ assert(browser.form("test2").exists?)
98
+ assert_false(browser.form( "missing").exists?)
98
99
 
99
- assert($ff.form(:index, 1).exists?)
100
- assert(!$ff.form(:index, 88).exists?)
100
+ assert(browser.form(:index, 1).exists?)
101
+ assert_false(browser.form(:index, 88).exists?)
101
102
 
102
- assert($ff.form(:method, "get").exists?)
103
- assert(!$ff.form(:method, "missing").exists?)
103
+ assert(browser.form(:method, "get").exists?)
104
+ assert_false(browser.form(:method, "missing").exists?)
104
105
 
105
- assert($ff.form(:action, "pass.html").exists?)
106
- assert(!$ff.form(:action, "missing").exists?)
106
+ assert(browser.form(:action, "pass.html").exists?)
107
+ assert_false(browser.form(:action, "missing").exists?)
107
108
  end
108
109
 
109
110
  def test_index_other_element_before_it
110
111
  # test for bug reported by Scott Pack, http://rubyforge.org/pipermail/wtr-general/2005-June/002223.html
111
- assert_equal("check1" , $ff.checkbox(:index,1).name )
112
+ assert_equal("check1" , browser.checkbox(:index,1).name )
112
113
  end
113
114
 
114
115
  def test_reset
115
- $ff.text_field(:id, "t1").set("Hello, reset test!")
116
- assert_equal($ff.text_field(:id, 't1').getContents, 'Hello, reset test!')
116
+ browser.text_field(:id, "t1").set("Hello, reset test!")
117
+ assert_equal(browser.text_field(:id, 't1').value, 'Hello, reset test!')
117
118
 
118
- $ff.button(:id, "reset_button").click
119
- assert_equal("" , $ff.text_field(:id, 't1').getContents )
119
+ browser.button(:id, "reset_button").click
120
+ assert_equal("" , browser.text_field(:id, 't1').value )
120
121
 
121
122
  # also verify it works under a form
122
- $ff.text_field(:id, "t1").set("reset test - using a form")
123
- assert_equal($ff.text_field(:id, 't1').getContents, 'reset test - using a form')
123
+ browser.text_field(:id, "t1").set("reset test - using a form")
124
+ assert_equal(browser.text_field(:id, 't1').value, 'reset test - using a form')
124
125
 
125
- $ff.form(:index,2).button(:index,2).click
126
- assert_equal("" , $ff.text_field(:id, 't1').getContents )
126
+ browser.form(:index,2).button(:index,2).click
127
+ assert_equal("" , browser.text_field(:id, 't1').value )
127
128
 
128
129
  # also verify it works under a form, this time using the :id attribute
129
- $ff.text_field(:id, "t1").set("reset test - using a form")
130
- assert_equal($ff.text_field(:id, 't1').getContents, 'reset test - using a form')
130
+ browser.text_field(:id, "t1").set("reset test - using a form")
131
+ assert_equal(browser.text_field(:id, 't1').value, 'reset test - using a form')
131
132
 
132
- $ff.form(:index,2).button(:id,'reset_button').click
133
- assert_equal("" , $ff.text_field(:id, 't1').getContents )
133
+ browser.form(:index,2).button(:id,'reset_button').click
134
+ assert_equal("" , browser.text_field(:id, 't1').value )
134
135
  end
135
136
 
136
137
  ## def test_flash1
137
- ## $ff.form(:name ,"test2").button(:caption , "Submit").flash
138
+ ## browser.form(:name ,"test2").button(:caption , "Submit").flash
138
139
  ## end
139
140
  #
140
141
  def test_objects_with_same_name
141
- assert_equal('textfield' ,$ff.text_field( :name , 'g1').value )
142
- assert_equal('button' ,$ff.button( :name , 'g1').value )
143
- assert_equal('1' ,$ff.checkbox( :name , 'g1').value )
144
- assert_equal('2' ,$ff.radio( :name , 'g1').value )
142
+ assert_equal('textfield' ,browser.text_field( :name , 'g1').value )
143
+ assert_equal('button' ,browser.button( :name , 'g1').value )
144
+ assert_equal('1' ,browser.checkbox( :name , 'g1').value )
145
+ assert_equal('2' ,browser.radio( :name , 'g1').value )
145
146
 
146
- assert_equal('textfield' ,$ff.text_field( :name , /g1/).value )
147
- assert_equal('button' ,$ff.button( :name , /g1/).value )
148
- assert_equal('1' ,$ff.checkbox( :name , /g1/).value )
149
- assert_equal('2' ,$ff.radio( :name , /g1/).value )
147
+ assert_equal('textfield' ,browser.text_field( :name , /g1/).value )
148
+ assert_equal('button' ,browser.button( :name , /g1/).value )
149
+ assert_equal('1' ,browser.checkbox( :name , /g1/).value )
150
+ assert_equal('2' ,browser.radio( :name , /g1/).value )
150
151
 
151
- assert_equal('textfield_id' ,$ff.text_field( :id , 'g1').value )
152
- assert_equal('button_id' ,$ff.button( :id , 'g1').value )
153
- assert_equal('1_id' ,$ff.checkbox( :id , 'g1').value )
154
- assert_equal('2_id' ,$ff.radio( :id , 'g1').value )
152
+ assert_equal('textfield_id' ,browser.text_field( :id , 'g1').value )
153
+ assert_equal('button_id' ,browser.button( :id , 'g1').value )
154
+ assert_equal('1_id' ,browser.checkbox( :id , 'g1').value )
155
+ assert_equal('2_id' ,browser.radio( :id , 'g1').value )
155
156
 
156
- assert_equal('textfield_id' ,$ff.text_field( :id , /g1/).value )
157
- assert_equal('button_id' ,$ff.button( :id , /g1/).value )
158
- assert_equal('1_id' ,$ff.checkbox( :id , /g1/).value )
159
- assert_equal('2_id' ,$ff.radio( :id , /g1/).value )
157
+ assert_equal('textfield_id' ,browser.text_field( :id , /g1/).value )
158
+ assert_equal('button_id' ,browser.button( :id , /g1/).value )
159
+ assert_equal('1_id' ,browser.checkbox( :id , /g1/).value )
160
+ assert_equal('2_id' ,browser.radio( :id , /g1/).value )
160
161
  end
161
162
 
162
163
  # def test_flash2
163
- # $ff.button(:value, 'Click Me').flash
164
- # assert_raises( Watir::UnknownObjectException ) { $ff.text_field( :name , 'g177').flash }
164
+ # browser.button(:value, 'Click Me').flash
165
+ # assert_raises( Watir::UnknownObjectException ) { browser.text_field( :name , 'g177').flash }
165
166
  # end
166
167
 
167
168
  def test_submitWithImage
168
- assert( $ff.button(:alt , "submit").exists? )
169
- assert( $ff.button(:alt , /sub/).exists? )
169
+ assert( browser.button(:alt , "submit").exists? )
170
+ assert( browser.button(:alt , /sub/).exists? )
170
171
 
171
- assert(! $ff.button(:alt , "missing").exists? )
172
- assert(! $ff.button(:alt , /missing/).exists? )
172
+ assert_false( browser.button(:alt , "missing").exists? )
173
+ assert_false( browser.button(:alt , /missing/).exists? )
173
174
 
174
- #assert( $ff.button(:src , "file:///#{$myDir}/html/images/button.jpg").exists? ) # this doesnt work for everybody
175
- assert( $ff.button(:src , /button/).exists? )
175
+ #assert( browser.button(:src , "file:///#{$myDir}/html/images/button.jpg").exists? ) # this doesnt work for everybody
176
+ assert( browser.button(:src , /button/).exists? )
176
177
 
177
- assert(! $ff.button(:src , "missing").exists? )
178
- assert(! $ff.button(:src , /missing/).exists? )
179
- assert_nothing_raised("raised an exception when it shouldnt have") { $ff.button(:src , /button/).click }
178
+ assert_false( browser.button(:src , "missing").exists? )
179
+ assert_false( browser.button(:src , /missing/).exists? )
180
+ assert_nothing_raised("raised an exception when it shouldnt have") { browser.button(:src , /button/).click }
180
181
 
181
- assert( $ff.text.include?("PASS") )
182
+ assert( browser.text.include?("PASS") )
182
183
  end
183
184
  end
184
185
 
185
186
  #class TC_Forms3_Display < Test::Unit::TestCase
186
- # include FireWatir
187
+ #
187
188
  # include MockStdoutTestCase # BUG in test: output not verified!
188
189
  # def test_show_stuff
189
- # $ff.goto($htmlRoot + "forms3.html")
190
+ # goto_page("forms3.html")
190
191
  # $stdout = @mockout
191
- # $ff.showAllObjects
192
- # puts $ff.getText
193
- # puts $ff.getHTML
192
+ # browser.showAllObjects
193
+ # puts browser.getText
194
+ # puts browser.getHTML
194
195
  # end
195
196
  #end
196
197
 
197
198
  class TC_Forms4 < Test::Unit::TestCase
198
- include FireWatir
199
+
199
200
  def setup
200
- $ff.goto($htmlRoot + "forms4.html")
201
+ goto_page("forms4.html")
201
202
  end
202
203
 
203
204
  def test_find_text_field_ignoring_form
204
- assert_equal($ff.text_field(:name, 'name').getContents, 'apple') # should it raise a not-unique error instead?
205
+ assert_equal(browser.text_field(:name, 'name').value, 'apple') # should it raise a not-unique error instead?
205
206
  end
206
207
 
207
208
  def test_correct_form_field_is_found_using_form_name
208
- assert_equal($ff.form(:name, 'apple_form').text_field(:name, 'name').getContents, 'apple')
209
- assert_equal($ff.form(:name, 'banana_form').text_field(:name, 'name').getContents, 'banana')
209
+ assert_equal(browser.form(:name, 'apple_form').text_field(:name, 'name').value, 'apple')
210
+ assert_equal(browser.form(:name, 'banana_form').text_field(:name, 'name').value, 'banana')
210
211
  end
211
212
 
212
213
  def test_correct_form_field_is_found_using_form_index
213
- assert_equal($ff.form(:index, 1).text_field(:name, 'name').getContents, 'apple')
214
- assert_equal($ff.form(:index, 2).text_field(:name, 'name').getContents, 'banana')
214
+ assert_equal(browser.form(:index, 1).text_field(:name, 'name').value, 'apple')
215
+ assert_equal(browser.form(:index, 2).text_field(:name, 'name').value, 'banana')
215
216
  end
216
217
 
217
218
  def test_using_text_on_form
218
- $ff.form(:name, 'apple_form').text_field(:name, 'name').set('strudel')
219
- assert_equal($ff.form(:index, 1).text_field(:name, 'name').getContents, 'strudel')
219
+ browser.form(:name, 'apple_form').text_field(:name, 'name').set('strudel')
220
+ assert_equal(browser.form(:index, 1).text_field(:name, 'name').value, 'strudel')
220
221
  end
221
222
 
222
223
  def test_submit
223
- $ff.form(:name, 'apple_form').submit
224
- assert( $ff.text.include?("PASS") )
224
+ browser.form(:name, 'apple_form').submit
225
+ assert( browser.text.include?("PASS") )
225
226
  end
226
227
  end
227
228
 
228
229
  class TC_Hidden_Fields2 < Test::Unit::TestCase
229
- include FireWatir
230
+
230
231
  def setup
231
- $ff.goto($htmlRoot + "forms3.html")
232
+ goto_page("forms3.html")
232
233
  end
233
234
 
234
235
  def test_hidden
235
236
 
236
237
  # test using index
237
- assert( $ff.hidden(:index,1).exists? )
238
- assert( $ff.hidden(:index,2).exists? )
239
- assert(! $ff.hidden(:index,3).exists? )
238
+ assert( browser.hidden(:index,1).exists? )
239
+ assert( browser.hidden(:index,2).exists? )
240
+ assert_false( browser.hidden(:index,3).exists? )
240
241
 
241
- $ff.hidden(:index,1).value = 44
242
- $ff.hidden(:index,2).value = 55
242
+ browser.hidden(:index,1).value = 44
243
+ browser.hidden(:index,2).value = 55
243
244
 
244
- $ff.button(:value , "Show Hidden").click
245
+ browser.button(:value , "Show Hidden").click
245
246
 
246
- assert_equal("44" , $ff.text_field(:name , "vis1").value )
247
- assert_equal("55" , $ff.text_field(:name , "vis2").value )
247
+ assert_equal("44" , browser.text_field(:name , "vis1").value )
248
+ assert_equal("55" , browser.text_field(:name , "vis2").value )
248
249
 
249
250
  # test using name and ID
250
- assert( $ff.hidden(:name ,"hid1").exists? )
251
- assert( $ff.hidden(:id,"hidden_1").exists? )
252
- assert(! $ff.hidden(:name,"hidden_44").exists? )
253
- assert(! $ff.hidden(:id,"hidden_55").exists? )
251
+ assert( browser.hidden(:name ,"hid1").exists? )
252
+ assert( browser.hidden(:id,"hidden_1").exists? )
253
+ assert_false( browser.hidden(:name,"hidden_44").exists? )
254
+ assert_false( browser.hidden(:id,"hidden_55").exists? )
254
255
 
255
- $ff.hidden(:name ,"hid1").value = 444
256
- $ff.hidden(:id,"hidden_1").value = 555
256
+ browser.hidden(:name ,"hid1").value = 444
257
+ browser.hidden(:id,"hidden_1").value = 555
257
258
 
258
- $ff.button(:value , "Show Hidden").click
259
+ browser.button(:value , "Show Hidden").click
259
260
 
260
- assert_equal("444" , $ff.text_field(:name , "vis1").value )
261
- assert_equal("555" , $ff.text_field(:name ,"vis2").value )
261
+ assert_equal("444" , browser.text_field(:name , "vis1").value )
262
+ assert_equal("555" , browser.text_field(:name ,"vis2").value )
262
263
 
263
264
  # test the over-ridden append method
264
- $ff.hidden(:name ,"hid1").append("a")
265
- $ff.button(:value , "Show Hidden").click
266
- assert_equal("444a" , $ff.text_field(:name , "vis1").value )
267
- assert_equal("555" , $ff.text_field(:name ,"vis2").value )
265
+ browser.hidden(:name ,"hid1").append("a")
266
+ browser.button(:value , "Show Hidden").click
267
+ assert_equal("444a" , browser.text_field(:name , "vis1").value )
268
+ assert_equal("555" , browser.text_field(:name ,"vis2").value )
268
269
 
269
270
  # test the over-ridden clear method
270
- $ff.hidden(:name ,"hid1").clear
271
- $ff.button(:value , "Show Hidden").click
272
- assert_equal("" , $ff.text_field(:name , "vis1").value )
273
- assert_equal("555" , $ff.text_field(:name ,"vis2").value )
271
+ browser.hidden(:name ,"hid1").clear
272
+ browser.button(:value , "Show Hidden").click
273
+ assert_equal("" , browser.text_field(:name , "vis1").value )
274
+ assert_equal("555" , browser.text_field(:name ,"vis2").value )
274
275
 
275
276
  # test using a form
276
- assert( $ff.form(:name , "has_a_hidden").hidden(:name ,"hid1").exists? )
277
- assert( $ff.form(:name , "has_a_hidden").hidden(:id,"hidden_1").exists? )
278
- assert(! $ff.form(:name , "has_a_hidden").hidden(:name,"hidden_44").exists? )
279
- assert(! $ff.form(:name , "has_a_hidden").hidden(:id,"hidden_55").exists? )
277
+ assert( browser.form(:name , "has_a_hidden").hidden(:name ,"hid1").exists? )
278
+ assert( browser.form(:name , "has_a_hidden").hidden(:id,"hidden_1").exists? )
279
+ assert_false( browser.form(:name , "has_a_hidden").hidden(:name,"hidden_44").exists? )
280
+ assert_false( browser.form(:name , "has_a_hidden").hidden(:id,"hidden_55").exists? )
280
281
 
281
- $ff.form(:name , "has_a_hidden").hidden(:name ,"hid1").value = 222
282
- $ff.form(:name , "has_a_hidden").hidden(:id,"hidden_1").value = 333
282
+ browser.form(:name , "has_a_hidden").hidden(:name ,"hid1").value = 222
283
+ browser.form(:name , "has_a_hidden").hidden(:id,"hidden_1").value = 333
283
284
 
284
- $ff.button(:value , "Show Hidden").click
285
+ browser.button(:value , "Show Hidden").click
285
286
 
286
- assert_equal("222" , $ff.text_field(:name , "vis1").value )
287
- assert_equal("333" , $ff.text_field(:name ,"vis2").value )
287
+ assert_equal("222" , browser.text_field(:name , "vis1").value )
288
+ assert_equal("333" , browser.text_field(:name ,"vis2").value )
288
289
 
289
290
  # iterators
290
- ## assert_equal(2, $ff.hiddens.length)
291
+ ## assert_equal(2, browser.hiddens.length)
291
292
  ## count =1
292
- ## $ff.hiddens.each do |h|
293
+ ## browser.hiddens.each do |h|
293
294
  ## case count
294
295
  ## when 1
295
296
  ## assert_equal( "", h.id)
@@ -301,7 +302,7 @@ class TC_Hidden_Fields2 < Test::Unit::TestCase
301
302
  ## count+=1
302
303
  ## end
303
304
  #
304
- ## assert_equal("hid1" , $ff.hiddens[1].name )
305
- ## assert_equal("hidden_1" , $ff.hiddens[2].id )
305
+ ## assert_equal("hid1" , browser.hiddens[1].name )
306
+ ## assert_equal("hidden_1" , browser.hiddens[2].id )
306
307
  end
307
308
  end