watir 1.9.2 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/CHANGES +27 -0
  2. data/VERSION +1 -1
  3. data/lib/watir/collections.rb +29 -387
  4. data/lib/watir/container.rb +14 -784
  5. data/lib/watir/dialogs/javascript.rb +7 -0
  6. data/lib/watir/element.rb +24 -4
  7. data/lib/watir/element_collections.rb +35 -57
  8. data/lib/watir/form.rb +13 -33
  9. data/lib/watir/frame.rb +14 -27
  10. data/lib/watir/html_element.rb +11 -3
  11. data/lib/watir/ie-class.rb +10 -1
  12. data/lib/watir/image.rb +3 -11
  13. data/lib/watir/input_elements.rb +11 -11
  14. data/lib/watir/link.rb +8 -15
  15. data/lib/watir/locator.rb +98 -73
  16. data/lib/watir/modal_dialog.rb +7 -1
  17. data/lib/watir/non_control_elements.rb +5 -89
  18. data/lib/watir/table.rb +46 -49
  19. data/unittests/checkbox_test.rb +39 -44
  20. data/unittests/checkbox_xpath_test.rb +2 -2
  21. data/unittests/css_test.rb +1 -1
  22. data/unittests/div_test.rb +43 -43
  23. data/unittests/div_xpath_test.rb +12 -12
  24. data/unittests/element_collections_test.rb +85 -0
  25. data/unittests/element_test.rb +4 -4
  26. data/unittests/form_test.rb +16 -19
  27. data/unittests/form_xpath_test.rb +6 -6
  28. data/unittests/frame_test.rb +114 -120
  29. data/unittests/html/multiple_specifiers.html +64 -0
  30. data/unittests/ie_test.rb +5 -5
  31. data/unittests/images_test.rb +12 -12
  32. data/unittests/index_specifier_test.rb +32 -0
  33. data/unittests/js_events_test.rb +3 -3
  34. data/unittests/links_multi_test.rb +4 -4
  35. data/unittests/links_test.rb +20 -20
  36. data/unittests/lists_test.rb +1 -1
  37. data/unittests/map_test.rb +1 -1
  38. data/unittests/multiple_specifiers_test.rb +29 -0
  39. data/unittests/no_wait_test.rb +2 -2
  40. data/unittests/pagecontainstext_test.rb +2 -2
  41. data/unittests/parent_child_test.rb +2 -2
  42. data/unittests/pre_test.rb +5 -5
  43. data/unittests/radios_test.rb +41 -60
  44. data/unittests/selectbox_test.rb +15 -15
  45. data/unittests/speed_settings_test.rb +2 -2
  46. data/unittests/table_and_tablerow_to_a_test.rb +7 -7
  47. data/unittests/table_test.rb +81 -94
  48. data/unittests/textfields_test.rb +26 -27
  49. data/unittests/windows/attach_to_new_window_test.rb +1 -1
  50. data/watir-rdoc.rb +1 -1
  51. data/watir.gemspec +1 -2
  52. metadata +34 -40
@@ -100,28 +100,28 @@ class TC_SelectList < Test::Unit::TestCase
100
100
  assert_raises(UnknownObjectException) { browser.select_list(:index, 199).disabled }
101
101
  assert_raises(UnknownObjectException) { browser.select_list(:index, 199).type }
102
102
 
103
- assert_equal("o3" , browser.select_list(:index, 1).value)
104
- assert_equal("sel1" , browser.select_list(:index, 1).name)
105
- assert_equal("" , browser.select_list(:index, 1).id)
106
- assert_equal("select-one", browser.select_list(:index, 1).type)
107
- assert_equal("select-multiple", browser.select_list(:index, 2).type)
103
+ assert_equal("o3" , browser.select_list(:index, 0).value)
104
+ assert_equal("sel1" , browser.select_list(:index, 0).name)
105
+ assert_equal("" , browser.select_list(:index, 0).id)
106
+ assert_equal("select-one", browser.select_list(:index, 0).type)
107
+ assert_equal("select-multiple", browser.select_list(:index, 1).type)
108
108
 
109
- browser.select_list(:index,1).select(/1/)
110
- assert_equal("o1", browser.select_list(:index, 1).value)
109
+ browser.select_list(:index,0).select(/1/)
110
+ assert_equal("o1", browser.select_list(:index, 0).value)
111
111
 
112
- assert_false( browser.select_list(:index, 1).disabled)
113
- assert(browser.select_list(:index, 4).disabled)
112
+ assert_false( browser.select_list(:index, 0).disabled)
113
+ assert(browser.select_list(:index, 3).disabled)
114
114
  assert(browser.select_list(:id, 'selectbox_4').disabled)
115
115
  end
116
116
 
117
117
  def test_iterator
118
118
  assert_equal(4, browser.select_lists.length)
119
- assert_equal("o3" , browser.select_lists[1].value)
120
- assert_equal("sel1" , browser.select_lists[1].name )
121
- assert_equal("select-one", browser.select_lists[1].type )
122
- assert_equal("select-multiple" , browser.select_lists[2].type )
119
+ assert_equal("o3" , browser.select_lists[0].value)
120
+ assert_equal("sel1" , browser.select_lists[0].name )
121
+ assert_equal("select-one", browser.select_lists[0].type )
122
+ assert_equal("select-multiple" , browser.select_lists[1].type )
123
123
 
124
- index = 1
124
+ index = 0
125
125
  browser.select_lists.each do |l|
126
126
  assert_equal( browser.select_list(:index, index).name, l.name)
127
127
  assert_equal( browser.select_list(:index, index).id, l.id)
@@ -129,7 +129,7 @@ class TC_SelectList < Test::Unit::TestCase
129
129
  assert_equal( browser.select_list(:index, index).value, l.value)
130
130
  index += 1
131
131
  end
132
- assert_equal(index - 1, browser.select_lists.length)
132
+ assert_equal(index, browser.select_lists.length)
133
133
  end
134
134
  end
135
135
 
@@ -33,7 +33,7 @@ class TC_class_options < Test::Unit::TestCase
33
33
  @previous = IE.options
34
34
  end
35
35
  def test_class_defaults
36
- assert_equal({:speed => IE.speed, :visible => IE.visible, :attach_timeout => IE.attach_timeout}, IE.options)
36
+ assert_equal({:speed => IE.speed, :visible => IE.visible, :attach_timeout => IE.attach_timeout, :zero_based_indexing => IE.zero_based_indexing}, IE.options)
37
37
  end
38
38
  def test_change_defaults
39
39
  IE.set_options(:speed => :fast)
@@ -64,4 +64,4 @@ class TC_class_options < Test::Unit::TestCase
64
64
  @ie2.close if @ie2
65
65
  @ie3.close if @ie3
66
66
  end
67
- end
67
+ end
@@ -79,38 +79,38 @@ class TC_Table_TableRow_to_a < Test::Unit::TestCase
79
79
  end
80
80
 
81
81
  def test_tablerow_to_a_works_with_regular_row
82
- first_row = browser.table(:id => "normal")[1]
82
+ first_row = browser.table(:id => "normal")[0]
83
83
  assert_equal(["1", "2", "3"], first_row.to_a)
84
84
  end
85
85
 
86
86
  def test_tablerow_to_a_works_with_headers_in_row
87
- first_row = browser.table(:id => "headers")[1]
87
+ first_row = browser.table(:id => "headers")[0]
88
88
  assert_equal(["1", "2", "3", "4"], first_row.to_a)
89
89
  end
90
90
 
91
91
  def test_tablerow_to_a_works_with_nested_tables
92
- second_row = browser.table(:id => "nested")[2]
92
+ second_row = browser.table(:id => "nested")[1]
93
93
  assert_equal([[["11", "12"], ["13", "14"]], "3"], second_row.to_a(2))
94
94
  end
95
95
 
96
96
  def test_tablerow_to_a_works_with_deep_nested_tables
97
- second_row = browser.table(:id => "deepnested")[2]
97
+ second_row = browser.table(:id => "deepnested")[1]
98
98
  expected_row = [[["11", "12"],
99
99
  [[["404", "405"], ["406", "407"]], "14"]], "3"]
100
100
  assert_equal(expected_row, second_row.to_a(3))
101
101
  end
102
102
 
103
103
  def test_tablerow_to_a_works_with_colspan
104
- second_row = browser.table(:id => "colspan")[2]
104
+ second_row = browser.table(:id => "colspan")[1]
105
105
  assert_equal(["3"], second_row.to_a)
106
106
  end
107
107
 
108
108
  def test_tablerow_to_a_works_with_rowspan
109
109
  t = browser.table(:id => "rowspan")
110
- second_row = t[2]
110
+ second_row = t[1]
111
111
  assert_equal(["3", "4"], second_row.to_a)
112
112
 
113
- third_row = t[3]
113
+ third_row = t[2]
114
114
  assert_equal(["5"], third_row.to_a)
115
115
  end
116
116
  end
@@ -21,7 +21,7 @@ class TC_Tables < Test::Unit::TestCase
21
21
  assert !browser.table(:id, 'missingTable').exists?
22
22
  assert !browser.table(:id, /missing_table/).exists?
23
23
 
24
- assert browser.table(:index, 1).exists?
24
+ assert browser.table(:index, 0).exists?
25
25
  assert !browser.table(:index, 33).exists?
26
26
  end
27
27
 
@@ -38,15 +38,15 @@ class TC_Tables < Test::Unit::TestCase
38
38
  end
39
39
  end
40
40
  def test_rows
41
- assert_equal(2, browser.table(:index, 1).row_count)
42
- assert_equal(2, browser.table(:index, 1).rows.length)
41
+ assert_equal(2, browser.table(:index, 0).row_count)
42
+ assert_equal(2, browser.table(:index, 0).rows.length)
43
43
 
44
44
  assert_equal(5, browser.table(:id, 't1').row_count) # 4 rows and a header
45
- assert_equal(5, browser.table(:index, 2).row_count) # same table as above, just accessed by index
45
+ assert_equal(5, browser.table(:index, 1).row_count) # same table as above, just accessed by index
46
46
  assert_equal(5, browser.table(:id, 't1').rows.length)
47
47
 
48
48
  # test the each iterator on rows - ie, go through each cell
49
- row = browser.table(:index, 2)[2]
49
+ row = browser.table(:index, 1)[1]
50
50
  result = []
51
51
  row.each do |cell|
52
52
  result << cell.to_s.strip
@@ -78,22 +78,22 @@ class TC_Tables < Test::Unit::TestCase
78
78
  assert_raises UnknownObjectException do
79
79
  browser.table(:index, 77).column_count
80
80
  end
81
- assert_equal(2, browser.table(:index, 1).column_count)
81
+ assert_equal(2, browser.table(:index, 0).column_count)
82
82
  assert_equal(1, browser.table(:id, 't1').column_count) # row one has 1 cell with a colspan of 2
83
83
  end
84
84
 
85
85
  def test_to_a
86
86
  expected = [ ["Row 1 Col1" , "Row 1 Col2"],
87
87
  [ "Row 2 Col1" , "Row 2 Col2"] ]
88
- assert_equal(expected, browser.table(:index , 1).to_a)
88
+ assert_equal(expected, browser.table(:index , 0).to_a)
89
89
  end
90
90
 
91
91
  def test_links_and_images_in_table
92
92
  table = browser.table(:id, 'pic_table')
93
- image = table[1][2].image(:index,1)
93
+ image = table[0][1].image(:index,0)
94
94
  assert_equal("106", image.width)
95
95
 
96
- link = table[1][4].link(:index,1)
96
+ link = table[0][3].link(:index,0)
97
97
  assert_equal("Google", link.innerText)
98
98
  end
99
99
 
@@ -104,7 +104,7 @@ class TC_Tables < Test::Unit::TestCase
104
104
  end
105
105
 
106
106
  def test_cell_another_way
107
- assert_equal( "Row 1 Col1", browser.table(:index,1)[1][1].to_s.strip)
107
+ assert_equal( "Row 1 Col1", browser.table(:index,0)[0][0].to_s.strip)
108
108
  end
109
109
 
110
110
  def test_row_directly
@@ -112,7 +112,7 @@ class TC_Tables < Test::Unit::TestCase
112
112
  assert ! browser.row(:id, 'no_exist').exists?
113
113
  end
114
114
  def test_row_another_way
115
- assert_equal('Row 2 Col1', browser.row(:id, 'row1')[1].to_s.strip)
115
+ assert_equal('Row 2 Col1', browser.row(:id, 'row1')[0].to_s.strip)
116
116
  end
117
117
 
118
118
  tag_method :test_row_in_table, :fails_on_firefox
@@ -122,45 +122,33 @@ class TC_Tables < Test::Unit::TestCase
122
122
  end
123
123
 
124
124
  def test_row_iterator
125
- t = browser.table(:index, 1)
126
- count = 1
125
+ t = browser.table(:index, 0)
126
+ count = 1
127
127
  t.each do |row|
128
- if count == 1
129
- assert("Row 1 Col1", row[1].text)
130
- assert("Row 1 Col2", row[2].text)
131
- elsif count == 2
132
- assert("Row 2 Col1", row[1].text)
133
- assert("Row 2 Col2", row[2].text)
134
- end
128
+ assert("Row #{count} Col1", row[0].text)
129
+ assert("Row #{count} Col2", row[1].text)
135
130
  count += 1
136
131
  end
137
132
  end
138
133
 
139
134
  def test_row_collection
140
- t = browser.table(:index,1)
141
- count = 1
142
- t.rows.each do |row|
143
- if count == 1
144
- assert("Row 1 Col1", row[1].text)
145
- assert("Row 1 Col2", row[2].text)
146
- elsif count == 2
147
- assert("Row 2 Col1", row[1].text)
148
- assert("Row 2 Col2", row[2].text)
149
- end
150
- count += 1
135
+ t = browser.table(:index,0)
136
+ t.rows.each_with_index do |row, i|
137
+ assert("Row #{i + 1} Col1", row[0].text)
138
+ assert("Row #{i + 1} Col2", row[1].text)
151
139
  end
152
140
  end
153
141
 
154
142
  tag_method :test_cell_collection, :fails_on_firefox
155
143
  def test_cell_collection
156
- t = browser.table(:index,1)
144
+ t = browser.table(:index,0)
157
145
  contents = t.cells.collect {|c| c.text}
158
146
  assert_equal(["Row 1 Col1","Row 1 Col2","Row 2 Col1","Row 2 Col2"], contents)
159
147
  end
160
148
 
161
149
  tag_method :test_table_body, :fails_on_firefox
162
150
  def test_table_body
163
- assert_equal(1, browser.table(:index, 1).bodies.length)
151
+ assert_equal(1, browser.table(:index, 0).bodies.length)
164
152
  assert_equal(3, browser.table(:id, 'body_test').bodies.length)
165
153
 
166
154
  count = 1
@@ -174,20 +162,19 @@ class TC_Tables < Test::Unit::TestCase
174
162
  when 3
175
163
  compare_text = "This text is in the THIRD TBODY."
176
164
  end
177
- assert_equal(compare_text, n[1][1].to_s.strip ) # this is the 1st cell of the first row of this particular body
165
+ assert_equal(compare_text, n[0][0].to_s.strip ) # this is the 1st cell of the first row of this particular body
178
166
  count += 1
179
167
  end
180
168
  assert_equal( count - 1, browser.table(:id, 'body_test').bodies.length )
181
- assert_equal( "This text is in the THIRD TBODY." ,browser.table(:id, 'body_test' ).body(:index,3)[1][1].to_s.strip )
169
+ assert_equal( "This text is in the THIRD TBODY." ,browser.table(:id, 'body_test' ).body(:index,2)[0][0].to_s.strip )
182
170
 
183
171
  # iterate through all the rows in a table body
184
172
  count = 1
185
- browser.table(:id, 'body_test').body(:index, 2).each do | row |
186
- # row.flash # this line commented out, to speed up the tests
173
+ browser.table(:id, 'body_test').body(:index, 1).each do | row |
187
174
  if count == 1
188
- assert_equal('This text is in the SECOND TBODY.', row[1].text.strip )
189
- elsif count == 1 # BUG: Huh?
190
- assert_equal('This text is also in the SECOND TBODY.', row[1].text.strip )
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 )
191
178
  end
192
179
  count+=1
193
180
  end
@@ -199,7 +186,7 @@ class TC_Tables < Test::Unit::TestCase
199
186
 
200
187
  def test_multiple_selector
201
188
  assert_equal('Second table with css class',
202
- browser.table(:class => 'sample', :index => 2)[1][1].text)
189
+ browser.table(:class => 'sample', :index => 1)[0][0].text)
203
190
  end
204
191
  end
205
192
 
@@ -211,10 +198,10 @@ class TC_Tables_Simple < Test::Unit::TestCase
211
198
  end
212
199
 
213
200
  def test_simple_table_access
214
- table = browser.table(:index,1)
215
- assert_equal("Row 3 Col1", table[3][1].text.strip)
216
- assert_equal("Row 1 Col1", table[1][1].text.strip)
217
- assert_equal("Row 3 Col2", table[3][2].text.strip)
201
+ table = browser.table(:index,0)
202
+ assert_equal("Row 3 Col1", table[2][0].text.strip)
203
+ assert_equal("Row 1 Col1", table[0][0].text.strip)
204
+ assert_equal("Row 3 Col2", table[2][1].text.strip)
218
205
  assert_equal(2, table.column_count)
219
206
  end
220
207
  end
@@ -226,56 +213,56 @@ class TC_Tables_Buttons < Test::Unit::TestCase
226
213
  end
227
214
 
228
215
  def test_simple_table_buttons
229
- table = browser.table(:index, 1)
216
+ table = browser.table(:index, 0)
230
217
 
231
- table[1][1].button(:index, 1).click
218
+ table[0][0].button(:index, 0).click
232
219
  assert(browser.text_field(:name,"confirmtext").verify_contains(/CLICK1/i))
233
- table[2][1].button(:index, 1).click
220
+ table[1][0].button(:index, 0).click
234
221
  assert(browser.text_field(:name,"confirmtext").verify_contains(/CLICK2/i))
235
222
 
236
- table[1][1].button(:id, 'b1').click
223
+ table[0][0].button(:id, 'b1').click
237
224
  assert(browser.text_field(:name,"confirmtext").verify_contains(/CLICK1/i))
238
225
 
239
- assert_raises(UnknownObjectException ) { table[1][1].button(:id,'b_missing').click }
226
+ assert_raises(UnknownObjectException ) { table[0][0].button(:id,'b_missing').click }
240
227
 
241
- table[3][1].button(:index, 2).click
228
+ table[2][0].button(:index, 1).click
242
229
  assert(browser.text_field(:name,"confirmtext").verify_contains(/TOO/i))
243
230
 
244
- table[3][1].button(:value, "Click too").click
231
+ table[2][0].button(:value, "Click too").click
245
232
  assert(browser.text_field(:name,"confirmtext").verify_contains(/TOO/i))
246
233
 
247
- browser.table(:index, 1)[4][1].text_field(:index,1).set("123")
248
- assert(browser.text_field(:index,2).verify_contains("123"))
234
+ browser.table(:index, 0)[3][0].text_field(:index,0).set("123")
235
+ assert(browser.text_field(:index,1).verify_contains("123"))
249
236
 
250
237
  # check when a cell contains 2 objects
251
238
 
252
239
  # if there were 2 different html objects in the same cell, some weird things happened ( button caption could change for example)
253
- assert_equal( 'Click ->' , browser.table(:index,1)[5][1].text_field(:index,1).value )
254
- browser.table(:index,1)[5][1].text_field(:index,1).click
255
- assert_equal( 'Click ->' , browser.table(:index,1)[5][1].text_field(:index,1).value )
240
+ assert_equal( 'Click ->' , browser.table(:index,0)[4][0].text_field(:index,0).value )
241
+ browser.table(:index,0)[4][0].text_field(:index,0).click
242
+ assert_equal( 'Click ->' , browser.table(:index,0)[4][0].text_field(:index,0).value )
256
243
 
257
- browser.table(:index,1)[5][1].button(:index,1).click
258
- assert_equal( '' , browser.table(:index,1)[5][1].text_field(:index,1).value )
244
+ browser.table(:index,0)[4][0].button(:index,0).click
245
+ assert_equal( '' , browser.table(:index,0)[4][0].text_field(:index,0).value )
259
246
  end
260
247
 
261
248
  def test_simple_table_gif
262
- table = browser.table(:index,2)
263
- assert_match(/1\.gif/, table[1][1].image(:index, 1).src)
264
- assert_match(/2\.gif/, table[1][2].image(:index, 1).src)
265
- assert_match(/3\.gif/, table[1][3].image(:index, 1).src)
249
+ table = browser.table(:index,1)
250
+ assert_match(/1\.gif/, table[0][0].image(:index, 0).src)
251
+ assert_match(/2\.gif/, table[0][1].image(:index, 0).src)
252
+ assert_match(/3\.gif/, table[0][2].image(:index, 0).src)
266
253
 
267
- assert_match(/1\.gif/, table[3][1].image(:index, 1).src)
268
- assert_match(/2\.gif/, table[3][2].image(:index, 1).src)
269
- assert_match(/3\.gif/, table[3][3].image(:index, 1).src)
254
+ assert_match(/1\.gif/, table[2][0].image(:index, 0).src)
255
+ assert_match(/2\.gif/, table[2][1].image(:index, 0).src)
256
+ assert_match(/3\.gif/, table[2][2].image(:index, 0).src)
270
257
 
271
- table = browser.table(:index,3)
272
- assert_match(/1\.gif/, table[1][1].image(:index, 1).src)
273
- assert_match(/2\.gif/, table[1][1].image(:index, 2).src)
274
- assert_match(/3\.gif/, table[1][1].image(:index, 3).src)
258
+ table = browser.table(:index,2)
259
+ assert_match(/1\.gif/, table[0][0].image(:index, 0).src)
260
+ assert_match(/2\.gif/, table[0][0].image(:index, 1).src)
261
+ assert_match(/3\.gif/, table[0][0].image(:index, 2).src)
275
262
 
276
- assert_match(/1\.gif/, table[3][1].image(:index, 1).src)
277
- assert_match(/2\.gif/, table[3][1].image(:index, 2).src)
278
- assert_match(/3\.gif/, table[3][1].image(:index, 3).src)
263
+ assert_match(/1\.gif/, table[2][0].image(:index, 0).src)
264
+ assert_match(/2\.gif/, table[2][0].image(:index, 1).src)
265
+ assert_match(/3\.gif/, table[2][0].image(:index, 2).src)
279
266
  end
280
267
 
281
268
  def test_table_with_hidden_or_visible_rows
@@ -283,13 +270,13 @@ class TC_Tables_Buttons < Test::Unit::TestCase
283
270
 
284
271
  # expand the table
285
272
  t.each do |r|
286
- r[1].image(:src, /plus/).click if r[1].image(:src, /plus/).exists?
273
+ r[0].image(:src, /plus/).click if r[0].image(:src, /plus/).exists?
287
274
  end
288
275
 
289
276
  # shrink rows 1,2,3
290
277
  count = 1
291
278
  t.each do |r|
292
- r[1].image(:src, /minus/).click if r[1].image(:src, /minus/).exists? and (1..3) === count
279
+ r[0].image(:src, /minus/).click if r[0].image(:src, /minus/).exists? and (1..3) === count
293
280
  count = 2
294
281
  end
295
282
  end
@@ -299,7 +286,7 @@ class TC_Tables_Buttons < Test::Unit::TestCase
299
286
  button = browser.button(:id, "b1")
300
287
  table = Watir::Table.create_from_element(browser, button)
301
288
 
302
- table[2][1].button(:index, 1).click
289
+ table[1][0].button(:index, 0).click
303
290
  assert(browser.text_field(:name, "confirmtext").verify_contains(/CLICK2/i))
304
291
  end
305
292
  end
@@ -311,37 +298,37 @@ class TC_Table_Columns < Test::Unit::TestCase
311
298
  end
312
299
 
313
300
  def test_get_columnvalues_single_column
314
- assert_equal(["R1C1", "R2C1", "R3C1"], browser.table(:index, 1).column_values(1))
301
+ assert_equal(["R1C1", "R2C1", "R3C1"], browser.table(:index, 0).column_values(0))
315
302
  end
316
303
 
317
304
  def test_colspan
318
- assert_equal(2, browser.table(:index, 3)[2][1].colspan)
319
- assert_equal(1, browser.table(:index, 3)[1][1].colspan)
320
- assert_equal(3, browser.table(:index, 3)[4][1].colspan)
305
+ assert_equal(2, browser.table(:index, 2)[1][0].colspan)
306
+ assert_equal(1, browser.table(:index, 2)[0][0].colspan)
307
+ assert_equal(3, browser.table(:index, 2)[3][0].colspan)
321
308
  end
322
309
 
323
310
  def test_get_columnvalues_multiple_column
324
- assert_equal(["R1C1", "R2C1", "R3C1"], browser.table(:index, 2).column_values(1))
325
- assert_equal(["R1C3", "R2C3", "R3C3"], browser.table(:index, 2).column_values(3))
311
+ assert_equal(["R1C1", "R2C1", "R3C1"], browser.table(:index, 1).column_values(0))
312
+ assert_equal(["R1C3", "R2C3", "R3C3"], browser.table(:index, 1).column_values(2))
326
313
  end
327
314
 
328
315
  tag_method :test_get_columnvalues_with_colspan, :fails_on_firefox
329
316
  def test_get_columnvalues_with_colspan
330
- assert_equal(["R1C1", "R2C1", "R3C1", "R4C1", "R5C1", "R6C2"], browser.table(:index, 3).column_values(1))
331
- (2..4).each{|x|assert_raises(UnknownCellException){browser.table(:index, 3).column_values(x)}}
317
+ assert_equal(["R1C1", "R2C1", "R3C1", "R4C1", "R5C1", "R6C2"], browser.table(:index, 2).column_values(0))
318
+ (1..3).each{|x|assert_raises(UnknownCellException){browser.table(:index, 2).column_values(x)}}
332
319
  end
333
320
 
334
321
  def test_get_rowvalues_full_row
335
- assert_equal(["R1C1", "R1C2", "R1C3"], browser.table(:index, 3).row_values(1))
322
+ assert_equal(["R1C1", "R1C2", "R1C3"], browser.table(:index, 2).row_values(0))
336
323
  end
337
324
 
338
325
  def test_get_rowvalues_with_colspan
339
- assert_equal(["R2C1", "R2C2"], browser.table(:index, 3).row_values(2))
326
+ assert_equal(["R2C1", "R2C2"], browser.table(:index, 2).row_values(1))
340
327
  end
341
328
 
342
329
  def test_getrowvalues_with_rowspan
343
- assert_equal(["R5C1", "R5C2", "R5C3"], browser.table(:index, 3).row_values(5))
344
- assert_equal(["R6C2", "R6C3"], browser.table(:index, 3).row_values(6))
330
+ assert_equal(["R5C1", "R5C2", "R5C3"], browser.table(:index, 2).row_values(4))
331
+ assert_equal(["R6C2", "R6C3"], browser.table(:index, 2).row_values(5))
345
332
  end
346
333
  end
347
334
 
@@ -351,16 +338,16 @@ class TC_Tables_Complex < Test::Unit::TestCase
351
338
  end
352
339
 
353
340
  def test_complex_table_access
354
- table = browser.table(:index,1)
355
- assert_equal("subtable1 Row 1 Col1",table[1][1].table(:index,1)[1][1].text.strip)
356
- assert_equal("subtable1 Row 1 Col2",table[1][1].table(:index,1)[1][2].text.strip)
357
- assert_equal("subtable2 Row 1 Col2",table[2][1].table(:index,1)[1][2].text.strip)
358
- assert_equal("subtable2 Row 1 Col1",table[2][1].table(:index,1)[1][1].text.strip)
341
+ table = browser.table(:index,0)
342
+ assert_equal("subtable1 Row 1 Col1",table[0][0].table(:index,0)[0][0].text.strip)
343
+ assert_equal("subtable1 Row 1 Col2",table[0][0].table(:index,0)[0][1].text.strip)
344
+ assert_equal("subtable2 Row 1 Col2",table[1][0].table(:index,0)[0][1].text.strip)
345
+ assert_equal("subtable2 Row 1 Col1",table[1][0].table(:index,0)[0][0].text.strip)
359
346
  end
360
347
 
361
348
  def test_each_itterator
362
349
  # for WTR-324: keep Watir::Table.each from crashing when run on nested tables
363
- table = browser.table(:index,1)
350
+ table = browser.table(:index,0)
364
351
  assert_equal(table.row_count, 4)
365
352
  assert_equal(table.row_count_excluding_nested_tables, 2)
366
353
  example_row_count = 0