watir 3.0.0.rc2 → 3.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/CHANGES +19 -0
  2. data/VERSION +1 -1
  3. data/lib/watir/close_all.rb +2 -2
  4. data/lib/watir/container.rb +6 -4
  5. data/lib/watir/cookies.rb +80 -0
  6. data/lib/watir/core.rb +7 -3
  7. data/lib/watir/dialogs/file_field.rb +0 -4
  8. data/lib/watir/drag_and_drop_helper.rb +68 -0
  9. data/lib/watir/element.rb +58 -156
  10. data/lib/watir/element_collection.rb +109 -0
  11. data/lib/watir/form.rb +7 -14
  12. data/lib/watir/frame.rb +11 -26
  13. data/lib/watir/ie-class.rb +17 -307
  14. data/lib/watir/ie.rb +0 -9
  15. data/lib/watir/image.rb +8 -25
  16. data/lib/watir/input_elements.rb +32 -81
  17. data/lib/watir/link.rb +2 -17
  18. data/lib/watir/locator.rb +29 -25
  19. data/lib/watir/modal_dialog.rb +26 -40
  20. data/lib/watir/non_control_elements.rb +111 -79
  21. data/lib/watir/page-container.rb +12 -1
  22. data/lib/watir/supported_elements.rb +172 -0
  23. data/lib/watir/table.rb +61 -89
  24. data/lib/watir/win32ole.rb +2 -3
  25. data/lib/watir/win32ole/1.9.3/win32ole.so +0 -0
  26. data/lib/watir/xpath_locator.rb +52 -0
  27. data/rakefile.rb +1 -1
  28. data/unittests/checkbox_test.rb +22 -32
  29. data/unittests/css_selector_test.rb +1 -6
  30. data/unittests/css_test.rb +1 -4
  31. data/unittests/div_test.rb +3 -21
  32. data/unittests/document_standards.rb +0 -4
  33. data/unittests/element_collections_test.rb +2 -2
  34. data/unittests/element_test.rb +1 -1
  35. data/unittests/form_test.rb +0 -30
  36. data/unittests/frame_test.rb +8 -49
  37. data/unittests/ie_test.rb +5 -9
  38. data/unittests/images_test.rb +6 -6
  39. data/unittests/index_specifier_test.rb +0 -1
  40. data/unittests/js_events_test.rb +1 -1
  41. data/unittests/links_multi_test.rb +0 -14
  42. data/unittests/links_test.rb +8 -51
  43. data/unittests/lists_test.rb +0 -9
  44. data/unittests/navigate_test.rb +1 -1
  45. data/unittests/nbsp_xpath_test.rb +1 -1
  46. data/unittests/no_wait_test.rb +3 -3
  47. data/unittests/parent_child_test.rb +0 -17
  48. data/unittests/pre_test.rb +0 -3
  49. data/unittests/radios_test.rb +31 -42
  50. data/unittests/selectbox_test.rb +18 -21
  51. data/unittests/selectbox_xpath_test.rb +11 -26
  52. data/unittests/table_test.rb +14 -79
  53. data/unittests/textfields_test.rb +8 -47
  54. data/unittests/windows/attach_to_new_window_test.rb +0 -8
  55. data/unittests/windows/frame_links_test.rb +5 -5
  56. data/unittests/windows/ie-each_test.rb +1 -1
  57. data/unittests/windows/modal_dialog_test.rb +2 -2
  58. data/watir.gemspec +3 -3
  59. metadata +81 -126
  60. data/lib/watir/camel_case.rb +0 -67
  61. data/lib/watir/collections.rb +0 -48
  62. data/lib/watir/cookiemanager.rb +0 -56
  63. data/lib/watir/element_collections.rb +0 -81
  64. data/lib/watir/html_element.rb +0 -30
  65. data/unittests/defer_test.rb +0 -47
  66. data/unittests/multiple_specifiers_test.rb +0 -29
  67. data/unittests/table_and_tablerow_to_a_test.rb +0 -117
  68. data/unittests/windows/iedialog_test.rb +0 -53
@@ -29,9 +29,9 @@ class TC_SelectList < Test::Unit::TestCase
29
29
  end
30
30
 
31
31
  def test_select_by_text
32
- assert_equal(['Option 3'], browser.select_list(:name, "sel1").getSelectedItems)
32
+ assert_equal('Option 3', browser.select_list(:name, "sel1").selected_options.first.text)
33
33
  browser.select_list(:name, "sel1").select('Option 2')
34
- assert_equal(['Option 2'], browser.select_list(:name, "sel1").getSelectedItems)
34
+ assert_equal('Option 2', browser.select_list(:name, "sel1").selected_options.first.text)
35
35
  end
36
36
 
37
37
  def test_select_by_value
@@ -39,12 +39,6 @@ class TC_SelectList < Test::Unit::TestCase
39
39
  assert(browser.text.include?("PASS"))
40
40
  end
41
41
 
42
- def test_set # by text
43
- assert_equal(['Option 3'], browser.select_list(:name, "sel1").getSelectedItems)
44
- browser.select_list(:name, "sel1").set('Option 2')
45
- assert_equal(['Option 2'], browser.select_list(:name, "sel1").getSelectedItems)
46
- end
47
-
48
42
  # Option
49
43
 
50
44
  def test_Option_text_select
@@ -52,12 +46,15 @@ class TC_SelectList < Test::Unit::TestCase
52
46
  assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, /missing/).select }
53
47
  assert_raises(MissingWayOfFindingObjectException) { browser.select_list(:name, "sel1").option(:missing, "Option 1").select }
54
48
 
55
- # the select method keeps any currently selected items - use the clear selection method first
56
- browser.select_list(:name, "sel1").clearSelection
57
49
  browser.select_list(:name, "sel1").option(:text, "Option 1").select
58
- assert_equal(["Option 1" ], browser.select_list(:name, "sel1").getSelectedItems)
50
+ assert_equal("Option 1", browser.select_list(:name, "sel1").selected_options.first.text)
59
51
  end
60
-
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
+
61
58
  def xtest_option_class_name
62
59
  # the option object doesnt inherit from element, so this doesnt work
63
60
  assert_raises(UnknownObjectException) { browser.select_list(:name, "sel1").option(:text, "missing item").class_name }
@@ -69,10 +66,10 @@ class TC_SelectList < Test::Unit::TestCase
69
66
 
70
67
  tag_method :test_includes, :fails_on_firefox
71
68
  def test_includes
72
- assert browser.select_list(:name, 'sel1').includes?('Option 1')
73
- assert browser.select_list(:name, 'sel1').includes?(/option/i)
74
- assert ! browser.select_list(:name, 'sel1').includes?('Option 6')
75
- assert ! browser.select_list(:name, 'sel1').includes?(/foobar/)
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/)
76
73
  end
77
74
 
78
75
  # SelectList#selected?
@@ -97,7 +94,7 @@ class TC_SelectList < Test::Unit::TestCase
97
94
  assert_raises(UnknownObjectException) { browser.select_list(:index, 199).value }
98
95
  assert_raises(UnknownObjectException) { browser.select_list(:index, 199).name }
99
96
  assert_raises(UnknownObjectException) { browser.select_list(:index, 199).id }
100
- assert_raises(UnknownObjectException) { browser.select_list(:index, 199).disabled }
97
+ assert_raises(UnknownObjectException) { browser.select_list(:index, 199).disabled? }
101
98
  assert_raises(UnknownObjectException) { browser.select_list(:index, 199).type }
102
99
 
103
100
  assert_equal("o3" , browser.select_list(:index, 0).value)
@@ -109,9 +106,9 @@ class TC_SelectList < Test::Unit::TestCase
109
106
  browser.select_list(:index,0).select(/1/)
110
107
  assert_equal("o1", browser.select_list(:index, 0).value)
111
108
 
112
- assert_false( browser.select_list(:index, 0).disabled)
113
- assert(browser.select_list(:index, 3).disabled)
114
- assert(browser.select_list(:id, 'selectbox_4').disabled)
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?)
115
112
  end
116
113
 
117
114
  def test_iterator
@@ -141,7 +138,7 @@ class TC_Select_Options < Test::Unit::TestCase
141
138
 
142
139
  def test_options_text
143
140
  browser.select_list(:name, 'op_numhits').option(:text, '>=').select
144
- assert(browser.select_list(:name, 'op_numhits').option(:text, '>=').selected)
141
+ assert(browser.select_list(:name, 'op_numhits').option(:text, '>=').selected?)
145
142
  end
146
143
  end
147
144
 
@@ -24,52 +24,39 @@ class TC_Selectbox_XPath < Test::Unit::TestCase
24
24
  def test_select_list_getAllContents
25
25
  assert_raises(UnknownObjectException) { browser.select_list(:xpath, "//select[@name='NoName']/").getAllContents }
26
26
  assert_equal( ["Option 1" ,"Option 2" , "Option 3" , "Option 4"] ,
27
- browser.select_list(:xpath, "//select[@name='sel1']/").getAllContents)
27
+ browser.select_list(:xpath, "//select[@name='sel1']/").options.map(&:text))
28
28
  end
29
29
 
30
30
  def test_select_list_getSelectedItems
31
31
  assert_raises(UnknownObjectException) { browser.select_list(:xpath, "//select[@name='NoName']/").getSelectedItems }
32
32
  assert_equal( ["Option 3" ] ,
33
- browser.select_list(:xpath, "//select[@name='sel1']/").getSelectedItems)
33
+ browser.select_list(:xpath, "//select[@name='sel1']/").selected_options.map(&:text))
34
34
  assert_equal( ["Option 3" , "Option 6" ] ,
35
- browser.select_list(:xpath, "//select[@name='sel2']/").getSelectedItems)
35
+ browser.select_list(:xpath, "//select[@name='sel2']/").selected_options.map(&:text))
36
36
  end
37
37
 
38
38
  def test_clearSelection
39
- assert_raises(UnknownObjectException) { browser.select_list(:xpath, "//select[@name='NoName']/").clearSelection }
40
- browser.select_list(:xpath, "//select[@name='sel1']/").clearSelection
41
-
42
- if Watir::IE.version_parts[0].to_i >= 9
43
- # ie9 allows you to clear a selected item even if it requires a selection
44
- assert_equal( [] , browser.select_list(:xpath, "//select[@name='sel1']/").getSelectedItems)
45
- else
46
- # the box sel1 has no ability to have a de-selected item
47
- assert_equal( ["Option 3" ] , browser.select_list(:xpath, "//select[@name='sel1']/").getSelectedItems)
48
- end
49
-
50
39
  browser.select_list(:xpath, "//select[@name='sel2']/").clearSelection
51
- assert_equal( [ ] , browser.select_list(:xpath, "//select[@name='sel2']/").getSelectedItems)
40
+ assert_equal( [ ] , browser.select_list(:xpath, "//select[@name='sel2']/").selected_options.map(&:text))
52
41
  end
53
42
 
54
43
  def test_select_list_select
55
- assert_raises(UnknownObjectException) { browser.select_list(:xpath, "//select[@name='NoName']/").getSelectedItems }
44
+ assert_raises(UnknownObjectException) { browser.select_list(:xpath, "//select[@name='NoName']/").selected_options.map(&:text) }
56
45
  assert_raises(NoValueFoundException) { browser.select_list(:xpath, "//select[@name='sel1']/").select("missing item") }
57
46
  assert_raises(NoValueFoundException) { browser.select_list(:xpath, "//select[@name='sel1']/").select(/missing/) }
58
47
 
59
48
  # the select method keeps any currently selected items - use the clear selectcion method first
60
- browser.select_list(:xpath, "//select[@name='sel1']/").clearSelection
61
49
  browser.select_list(:xpath, "//select[@name='sel1']/").select("Option 1")
62
- assert_equal( ["Option 1" ] , browser.select_list(:xpath, "//select[@name='sel1']/").getSelectedItems)
50
+ assert_equal( ["Option 1" ] , browser.select_list(:xpath, "//select[@name='sel1']/").selected_options.map(&:text))
63
51
 
64
- browser.select_list(:xpath, "//select[@name='sel1']/").clearSelection
65
52
  browser.select_list(:xpath, "//select[@name='sel1']/").select(/2/)
66
- assert_equal( ["Option 2" ] , browser.select_list(:xpath, "//select[@name='sel1']/").getSelectedItems)
53
+ assert_equal( ["Option 2" ] , browser.select_list(:xpath, "//select[@name='sel1']/").selected_options.map(&:text))
67
54
 
68
55
  browser.select_list(:xpath, "//select[@name='sel2']/").clearSelection
69
56
  browser.select_list(:xpath, "//select[@name='sel2']/").select( /2/ )
70
57
  browser.select_list(:xpath, "//select[@name='sel2']/").select( /4/ )
71
58
  assert_equal( ["Option 2" , "Option 4" ] ,
72
- browser.select_list(:xpath, "//select[@name='sel2']/").getSelectedItems)
59
+ browser.select_list(:xpath, "//select[@name='sel2']/").selected_options.map(&:text))
73
60
 
74
61
  # these are to test the onchange event
75
62
  # the event shouldnt get fired, as this is the selected item
@@ -89,18 +76,16 @@ class TC_Selectbox_XPath < Test::Unit::TestCase
89
76
  assert_raises(NoValueFoundException) { browser.select_list(:xpath, "//select[@name='sel1']/").select_value(/missing/) }
90
77
 
91
78
  # the select method keeps any currently selected items - use the clear selectcion method first
92
- browser.select_list(:xpath, "//select[@name='sel1']/").clearSelection
93
79
  browser.select_list(:xpath, "//select[@name='sel1']/").select_value("o1")
94
- assert_equal( ["Option 1" ] , browser.select_list(:xpath, "//select[@name='sel1']/").getSelectedItems)
80
+ assert_equal( ["Option 1" ] , browser.select_list(:xpath, "//select[@name='sel1']/").selected_options.map(&:text))
95
81
 
96
- browser.select_list(:xpath, "//select[@name='sel1']/").clearSelection
97
82
  browser.select_list(:xpath, "//select[@name='sel1']/").select_value(/2/)
98
- assert_equal( ["Option 2" ] , browser.select_list(:xpath, "//select[@name='sel1']/").getSelectedItems)
83
+ assert_equal( ["Option 2" ] , browser.select_list(:xpath, "//select[@name='sel1']/").selected_options.map(&:text))
99
84
 
100
85
  browser.select_list(:xpath, "//select[@name='sel2']/").clearSelection
101
86
  browser.select_list(:xpath, "//select[@name='sel2']/").select( /2/ )
102
87
  browser.select_list(:xpath, "//select[@name='sel2']/").select( /4/ )
103
- assert_equal( ["Option 2" , "Option 4" ] , browser.select_list(:xpath, "//select[@name='sel2']/").getSelectedItems)
88
+ assert_equal( ["Option 2" , "Option 4" ] , browser.select_list(:xpath, "//select[@name='sel2']/").selected_options.map(&:text))
104
89
 
105
90
  # these are to test the onchange event
106
91
  # the event shouldnt get fired, as this is the selected item
@@ -58,8 +58,7 @@ class TC_Tables < Test::Unit::TestCase
58
58
  tag_method :test_row_counts, :fails_on_firefox
59
59
  def test_row_counts
60
60
  table = browser.table(:id => 't2')
61
- assert_equal(3, table.row_count)
62
- assert_equal(2, table.row_count_excluding_nested_tables)
61
+ assert_equal(2, table.row_count)
63
62
  end
64
63
 
65
64
  tag_method :test_dynamic_tables, :fails_on_firefox
@@ -82,25 +81,19 @@ class TC_Tables < Test::Unit::TestCase
82
81
  assert_equal(1, browser.table(:id, 't1').column_count) # row one has 1 cell with a colspan of 2
83
82
  end
84
83
 
85
- def test_to_a
86
- expected = [ ["Row 1 Col1" , "Row 1 Col2"],
87
- [ "Row 2 Col1" , "Row 2 Col2"] ]
88
- assert_equal(expected, browser.table(:index , 0).to_a)
89
- end
90
-
91
84
  def test_links_and_images_in_table
92
85
  table = browser.table(:id, 'pic_table')
93
86
  image = table[0][1].image(:index,0)
94
- assert_equal("106", image.width)
87
+ assert_equal(106, image.width)
95
88
 
96
89
  link = table[0][3].link(:index,0)
97
- assert_equal("Google", link.innerText)
90
+ assert_equal("Google", link.text)
98
91
  end
99
92
 
100
93
  def test_cell_directly
101
- assert browser.cell(:id, 'cell1').exists?
102
- assert ! browser.cell(:id, 'no_exist').exists?
103
- assert_equal("Row 1 Col1", browser.cell(:id, 'cell1').to_s.strip)
94
+ assert browser.td(:id, 'cell1').exists?
95
+ assert ! browser.td(:id, 'no_exist').exists?
96
+ assert_equal("Row 1 Col1", browser.td(:id, 'cell1').to_s.strip)
104
97
  end
105
98
 
106
99
  def test_cell_another_way
@@ -108,11 +101,11 @@ class TC_Tables < Test::Unit::TestCase
108
101
  end
109
102
 
110
103
  def test_row_directly
111
- assert browser.row(:id, 'row1').exists?
112
- assert ! browser.row(:id, 'no_exist').exists?
104
+ assert browser.tr(:id, 'row1').exists?
105
+ assert ! browser.tr(:id, 'no_exist').exists?
113
106
  end
114
107
  def test_row_another_way
115
- assert_equal('Row 2 Col1', browser.row(:id, 'row1')[0].to_s.strip)
108
+ assert_equal('Row 2 Col1', browser.tr(:id, 'row1')[0].to_s.strip)
116
109
  end
117
110
 
118
111
  tag_method :test_row_in_table, :fails_on_firefox
@@ -121,16 +114,6 @@ class TC_Tables < Test::Unit::TestCase
121
114
  browser.table(:id, 't1').row(:id, 'row1').text.gsub(/(\r|\n)/,'')
122
115
  end
123
116
 
124
- def test_row_iterator
125
- t = browser.table(:index, 0)
126
- count = 1
127
- t.each do |row|
128
- assert("Row #{count} Col1", row[0].text)
129
- assert("Row #{count} Col2", row[1].text)
130
- count += 1
131
- end
132
- end
133
-
134
117
  def test_row_collection
135
118
  t = browser.table(:index,0)
136
119
  t.rows.each_with_index do |row, i|
@@ -148,11 +131,11 @@ class TC_Tables < Test::Unit::TestCase
148
131
 
149
132
  tag_method :test_table_body, :fails_on_firefox
150
133
  def test_table_body
151
- assert_equal(1, browser.table(:index, 0).bodies.length)
152
- assert_equal(3, browser.table(:id, 'body_test').bodies.length)
134
+ assert_equal(1, browser.table(:index, 0).tbodys.length)
135
+ assert_equal(3, browser.table(:id, 'body_test').tbodys.length)
153
136
 
154
137
  count = 1
155
- browser.table(:id, 'body_test').bodies.each do |n|
138
+ browser.table(:id, 'body_test').tbodys.each do |n|
156
139
  # do something better here!
157
140
  case count
158
141
  when 1
@@ -165,19 +148,8 @@ class TC_Tables < Test::Unit::TestCase
165
148
  assert_equal(compare_text, n[0][0].to_s.strip ) # this is the 1st cell of the first row of this particular body
166
149
  count += 1
167
150
  end
168
- assert_equal( count - 1, browser.table(:id, 'body_test').bodies.length )
169
- assert_equal( "This text is in the THIRD TBODY." ,browser.table(:id, 'body_test' ).body(:index,2)[0][0].to_s.strip )
170
-
171
- # iterate through all the rows in a table body
172
- count = 1
173
- browser.table(:id, 'body_test').body(:index, 1).each do | row |
174
- if count == 1
175
- assert_equal('This text is in the SECOND TBODY.', row[0].text.strip )
176
- elsif count == 2
177
- assert_equal("This text is also in the SECOND TBODY.", row[0].text.strip )
178
- end
179
- count+=1
180
- end
151
+ assert_equal( count - 1, browser.table(:id, 'body_test').tbodys.length )
152
+ assert_equal( "This text is in the THIRD TBODY." ,browser.table(:id, 'body_test' ).tbody(:index,2)[0][0].to_s.strip )
181
153
  end
182
154
 
183
155
  def test_table_container
@@ -265,30 +237,6 @@ class TC_Tables_Buttons < Test::Unit::TestCase
265
237
  assert_match(/3\.gif/, table[2][0].image(:index, 2).src)
266
238
  end
267
239
 
268
- def test_table_with_hidden_or_visible_rows
269
- t = browser.table(:id , 'show_hide')
270
-
271
- # expand the table
272
- t.each do |r|
273
- r[0].image(:src, /plus/).click if r[0].image(:src, /plus/).exists?
274
- end
275
-
276
- # shrink rows 1,2,3
277
- count = 1
278
- t.each do |r|
279
- r[0].image(:src, /minus/).click if r[0].image(:src, /minus/).exists? and (1..3) === count
280
- count = 2
281
- end
282
- end
283
-
284
- tag_method :test_table_from_element, :fails_on_firefox
285
- def test_table_from_element
286
- button = browser.button(:id, "b1")
287
- table = Watir::Table.create_from_element(browser, button)
288
-
289
- table[1][0].button(:index, 0).click
290
- assert(browser.text_field(:name, "confirmtext").verify_contains(/CLICK2/i))
291
- end
292
240
  end
293
241
 
294
242
  class TC_Table_Columns < Test::Unit::TestCase
@@ -345,17 +293,4 @@ class TC_Tables_Complex < Test::Unit::TestCase
345
293
  assert_equal("subtable2 Row 1 Col1",table[1][0].table(:index,0)[0][0].text.strip)
346
294
  end
347
295
 
348
- def test_each_itterator
349
- # for WTR-324: keep Watir::Table.each from crashing when run on nested tables
350
- table = browser.table(:index,0)
351
- assert_equal(table.row_count, 4)
352
- assert_equal(table.row_count_excluding_nested_tables, 2)
353
- example_row_count = 0
354
- assert_nothing_thrown do
355
- table.each do
356
- example_row_count += 1
357
- end
358
- end
359
- assert_equal(example_row_count, 2)
360
- end
361
296
  end
@@ -18,17 +18,12 @@ class TC_Fields < Test::Unit::TestCase
18
18
  assert(browser.text_field(:id, "text2").exists?)
19
19
  assert_false(browser.text_field(:id, "alsomissing").exists?)
20
20
 
21
- assert(browser.text_field(:beforeText, "This Text After").exists? )
22
- assert(browser.text_field(:afterText, "This Text Before").exists? )
23
-
24
- assert(browser.text_field(:beforeText, /after/i).exists? )
25
- assert(browser.text_field(:afterText, /before/i).exists? )
26
21
  assert(browser.text_field(:value, 'foo').exists?)
27
22
  end
28
23
 
29
24
  tag_method :test_text_field_dragContentsTo, :fails_on_firefox
30
25
  def test_text_field_dragContentsTo
31
- browser.text_field(:name, "text1").dragContentsTo(:id, "text2")
26
+ browser.text_field(:name, "text1").drag_contents_to(:id, "text2")
32
27
  assert_equal(browser.text_field(:name, "text1").value, "")
33
28
  assert_equal(browser.text_field(:id, "text2").value, "goodbye allHello World")
34
29
  end
@@ -61,34 +56,6 @@ class TC_Fields < Test::Unit::TestCase
61
56
  assert_equal("Hello World", browser.text_field(:name, "text1").value)
62
57
  end
63
58
 
64
- tag_method :test_text_field_to_s, :fails_on_firefox
65
- def test_text_field_to_s
66
- expected = [
67
- build_to_s_regex("type", "text"),
68
- build_to_s_regex("id", ""),
69
- build_to_s_regex("name", "text1"),
70
- build_to_s_regex("value", "Hello World"),
71
- build_to_s_regex("disabled", "false"),
72
- build_to_s_regex("length", "20"),
73
- build_to_s_regex("max length", "20"),
74
- build_to_s_regex("read only", "false")
75
- ]
76
- items = browser.text_field(:index, 0).to_s.split(/\n/)
77
- expected.each_with_index{|regex, x| assert_match(regex, items[x]) }
78
- expected[1] = build_to_s_regex("id", "text2")
79
- expected[2] = build_to_s_regex("name", "")
80
- expected[3] = build_to_s_regex("value", "goodbye all")
81
- expected[6] = build_to_s_regex("max length", "2147483647")
82
-
83
- items = browser.text_field(:index, 1).to_s.split(/\n/)
84
- expected.each_with_index{|regex, x| assert_match(regex, items[x]) }
85
- assert_raises(UnknownObjectException) { browser.text_field(:index, 999).to_s }
86
- end
87
-
88
- def build_to_s_regex(lhs, rhs)
89
- Regexp.new("^#{lhs}: +#{rhs}$")
90
- end
91
-
92
59
  tag_method :test_text_field_append, :fails_on_firefox
93
60
  def test_text_field_append
94
61
  assert_raises(ObjectReadOnlyException) { browser.text_field(:id, "readOnly2").append("Some Text") }
@@ -116,19 +83,19 @@ class TC_Fields < Test::Unit::TestCase
116
83
  assert_raises(UnknownObjectException) { browser.text_field(:index, 199).value }
117
84
  assert_raises(UnknownObjectException) { browser.text_field(:index, 199).name }
118
85
  assert_raises(UnknownObjectException) { browser.text_field(:index, 199).id }
119
- assert_raises(UnknownObjectException) { browser.text_field(:index, 199).disabled }
86
+ assert_raises(UnknownObjectException) { browser.text_field(:index, 199).disabled? }
120
87
  assert_raises(UnknownObjectException) { browser.text_field(:index, 199).type }
121
88
 
122
89
  assert_equal("Hello World" , browser.text_field(:index, 0).value)
123
90
  assert_equal("text" , browser.text_field(:index, 0).type)
124
91
  assert_equal("text1" , browser.text_field(:index, 0).name)
125
92
  assert_equal("" , browser.text_field(:index, 0).id)
126
- assert_equal(false , browser.text_field(:index, 0).disabled)
93
+ assert_equal(false , browser.text_field(:index, 0).disabled?)
127
94
 
128
95
  assert_equal("" , browser.text_field(:index, 1).name)
129
96
  assert_equal("text2" , browser.text_field(:index, 1).id)
130
97
 
131
- assert(browser.text_field(:index, 3).disabled)
98
+ assert(browser.text_field(:index, 3).disabled?)
132
99
 
133
100
  assert_equal("This used to test :afterText", browser.text_field(:name, "aftertest").title)
134
101
  assert_equal("", browser.text_field(:index, 0).title)
@@ -176,8 +143,8 @@ class TC_Fields < Test::Unit::TestCase
176
143
 
177
144
  def test_labels_iterator
178
145
  assert_equal(3, browser.labels.length)
179
- assert_equal('Label For this Field' , browser.labels[0].innerText.strip )
180
- assert_equal('Password With ID ( the text here is a label for it )' , browser.labels[2].innerText )
146
+ assert_equal('Label For this Field' , browser.labels[0].text.strip )
147
+ assert_equal('Password With ID ( the text here is a label for it )' , browser.labels[2].text )
181
148
 
182
149
  count=0
183
150
  browser.labels.each do |l|
@@ -187,10 +154,8 @@ class TC_Fields < Test::Unit::TestCase
187
154
  end
188
155
 
189
156
  def test_label_properties
190
- assert_raises(UnknownObjectException) { browser.label(:index,20).innerText }
157
+ assert_raises(UnknownObjectException) { browser.label(:index,20).text }
191
158
  assert_raises(UnknownObjectException) { browser.label(:index,20).for }
192
- assert_raises(UnknownObjectException) { browser.label(:index,20).name }
193
- assert_raises(UnknownObjectException) { browser.label(:index,20).type }
194
159
  assert_raises(UnknownObjectException) { browser.label(:index,20).id }
195
160
 
196
161
  assert_false(browser.label(:index,10).exists?)
@@ -203,7 +168,7 @@ class TC_Fields < Test::Unit::TestCase
203
168
 
204
169
  assert_equal("label2", browser.label(:index,1).id )
205
170
 
206
- assert_equal("Password With ID ( the text here is a label for it )" , browser.label(:index,2).innerText)
171
+ assert_equal("Password With ID ( the text here is a label for it )" , browser.label(:index,2).text)
207
172
  assert_equal("password1", browser.label(:index,2).for)
208
173
  end
209
174
 
@@ -216,8 +181,4 @@ class TC_Fields < Test::Unit::TestCase
216
181
  assert_equal(20, browser.text_field(:name, 'text1').maxlength)
217
182
  end
218
183
 
219
- def test_additional_events
220
- browser.text_field(:value, 'foo').set 'bar'
221
- assert(browser.text_field(:value, 'bar').exists?)
222
- end
223
184
  end
@@ -23,14 +23,6 @@ class TC_NewWindow< Watir::TestCase
23
23
  ie_new.close
24
24
  end
25
25
 
26
- def test_attach_to_new_window_using_separate_process
27
- browser.eval_in_spawned_process "link(:text, 'New Window').click"
28
- IE.attach_timeout = 6.0
29
- ie_new = IE.attach(:title, 'Pass Page')
30
- assert(ie_new.text.include?('PASS'))
31
- ie_new.close
32
- end
33
-
34
26
  def test_attach_to_new_window_using_click_no_wait
35
27
  # this test is sometimes failing with a "Canvas does not allow drawing" error
36
28
  # this is with IE7. I think the problem could be with the highlighting of the