watir 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/watir-console +1 -0
- data/changes.rb +16 -2
- data/readme.rb +2 -16
- data/unittests/buttons_test.rb +74 -101
- data/unittests/buttons_xpath_test.rb +3 -3
- data/unittests/checkbox_test.rb +3 -3
- data/unittests/checkbox_xpath_test.rb +3 -3
- data/unittests/core_tests.rb +1 -1
- data/unittests/css_test.rb +2 -7
- data/unittests/defer_test.rb +2 -2
- data/unittests/dialog_test.rb +2 -2
- data/unittests/div2_xpath_test.rb +1 -1
- data/unittests/div_test.rb +122 -121
- data/unittests/div_xpath_test.rb +3 -3
- data/unittests/errorchecker_test.rb +3 -8
- data/unittests/filefield_test.rb +4 -7
- data/unittests/filefield_xpath_test.rb +3 -5
- data/unittests/form_test.rb +7 -7
- data/unittests/form_xpath_test.rb +6 -6
- data/unittests/frame_test.rb +8 -9
- data/unittests/google_form_test.rb +1 -2
- data/unittests/html/div.html +7 -1
- data/unittests/html/lists.html +1 -1
- data/unittests/ie_mock.rb +4 -2
- data/unittests/ie_test.rb +2 -2
- data/unittests/images_test.rb +2 -2
- data/unittests/images_xpath_test.rb +2 -2
- data/unittests/links_multi_test.rb +23 -9
- data/unittests/links_test.rb +7 -7
- data/unittests/links_xpath_test.rb +2 -3
- data/unittests/lists_test.rb +6 -3
- data/unittests/map_test.rb +1 -2
- data/unittests/minmax_test.rb +4 -5
- data/unittests/navigate_test.rb +18 -23
- data/unittests/nbsp_xpath_test.rb +4 -5
- data/unittests/{screen_capture_test.rb → other/screen_capture_test.rb} +1 -1
- data/unittests/pagecontainstext_test.rb +3 -4
- data/unittests/parent_child_test.rb +1 -1
- data/unittests/pre_test.rb +2 -3
- data/unittests/radios_test.rb +13 -17
- data/unittests/radios_xpath_test.rb +3 -3
- data/unittests/selectbox_test.rb +6 -14
- data/unittests/selectbox_xpath_test.rb +3 -3
- data/unittests/setup.rb +30 -10
- data/unittests/speed_settings_test.rb +2 -3
- data/unittests/table_cell_using_xpath_test.rb +2 -7
- data/unittests/table_test.rb +144 -136
- data/unittests/table_xpath_test.rb +5 -9
- data/unittests/textarea_test.rb +3 -7
- data/unittests/textarea_xpath_test.rb +5 -9
- data/unittests/textfield_for_ch_char_test.rb +1 -1
- data/unittests/textfields_test.rb +3 -4
- data/unittests/textfields_xpath_test.rb +3 -3
- data/unittests/windows/attach_to_existing_window_test.rb +2 -2
- data/unittests/windows/attach_to_new_window_test.rb +2 -2
- data/unittests/windows/close_window_test.rb +2 -3
- data/unittests/windows/frame_links_test.rb +1 -1
- data/unittests/windows/iedialog_test.rb +3 -3
- data/unittests/windows/js_events_test.rb +2 -4
- data/unittests/windows/modal_dialog_test.rb +2 -2
- data/unittests/windows/send_keys_test.rb +2 -4
- data/watir.rb +4 -13
- data/watir/assertions.rb +9 -1
- data/watir/collections.rb +6 -11
- data/watir/container.rb +9 -99
- data/watir/cookiemanager.rb +4 -1
- data/watir/element.rb +8 -1
- data/watir/ie.rb +2 -2
- data/watir/input_elements.rb +2 -2
- data/watir/non_control_elements.rb +39 -2
- data/watir/page-container.rb +1 -1
- data/watir/table.rb +25 -23
- metadata +68 -54
- data/watir/bonus-elements.rb +0 -65
- data/watir/testUnitAddons.rb +0 -8
@@ -1,11 +1,10 @@
|
|
1
1
|
# tests for ability to set defaults for Watir
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1319 $
|
3
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
4
4
|
require 'test/unit'
|
5
5
|
require 'watir'
|
6
6
|
|
7
7
|
class TC_instance_options < Test::Unit::TestCase
|
8
|
-
include Watir
|
9
8
|
|
10
9
|
def test_using_default
|
11
10
|
@ie1 = Watir::IE.new
|
@@ -25,7 +24,7 @@ class TC_class_options < Test::Unit::TestCase
|
|
25
24
|
include Watir
|
26
25
|
@@hide_ie = $HIDE_IE
|
27
26
|
def setup
|
28
|
-
@previous =
|
27
|
+
@previous = IE.defaults
|
29
28
|
end
|
30
29
|
def test_class_defaults
|
31
30
|
assert_equal({:speed => :slow, :visible => ! @@hide_ie}, IE.defaults)
|
@@ -1,18 +1,13 @@
|
|
1
1
|
# feature tests for xpath table cells
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_TableCell_XPath < Test::Unit::TestCase
|
8
|
-
include Watir
|
9
8
|
|
10
9
|
def setup
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
def gotoTableCellPage
|
15
|
-
$ie.goto($htmlRoot + "tableCell_using_xpath.html")
|
10
|
+
goto_page "tableCell_using_xpath.html"
|
16
11
|
end
|
17
12
|
|
18
13
|
def testCellExists
|
data/unittests/table_test.rb
CHANGED
@@ -1,77 +1,88 @@
|
|
1
1
|
# feature tests for Tables
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1348 $
|
3
|
+
|
4
|
+
# Why do so many of these tests call "strip"? A distinct smell...
|
3
5
|
|
4
6
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
5
7
|
require 'unittests/setup'
|
6
8
|
|
7
9
|
class TC_Tables < Test::Unit::TestCase
|
8
|
-
include Watir
|
10
|
+
include Watir::Exception
|
9
11
|
|
10
12
|
def setup
|
11
|
-
|
13
|
+
uses_page "table1.html"
|
14
|
+
end
|
15
|
+
def teardown
|
16
|
+
browser.refresh if @reload_page
|
12
17
|
end
|
13
18
|
|
14
|
-
def
|
15
|
-
assert
|
16
|
-
assert
|
19
|
+
def test_exists
|
20
|
+
assert browser.table(:id, 't1').exists?
|
21
|
+
assert browser.table(:id, /t/).exists?
|
17
22
|
|
18
|
-
assert
|
19
|
-
assert
|
20
|
-
assert(!$ie.table(:id, /missing_table/).exists?)
|
23
|
+
assert !browser.table(:id, 'missingTable').exists?
|
24
|
+
assert !browser.table(:id, /missing_table/).exists?
|
21
25
|
|
22
|
-
assert
|
23
|
-
assert
|
26
|
+
assert browser.table(:index, 1).exists?
|
27
|
+
assert !browser.table(:index, 33).exists?
|
24
28
|
end
|
25
29
|
|
30
|
+
def test_row_count_exceptions
|
31
|
+
assert_raises UnknownObjectException do
|
32
|
+
browser.table(:id, 'missingTable').row_count
|
33
|
+
end
|
34
|
+
assert_raises UnknownObjectException do
|
35
|
+
browser.table(:index, 66).row_count
|
36
|
+
end
|
37
|
+
assert_raises MissingWayOfFindingObjectException do
|
38
|
+
browser.table(:bad_attribute, 99).row_count
|
39
|
+
end
|
40
|
+
end
|
26
41
|
def test_rows
|
27
|
-
|
28
|
-
|
29
|
-
assert_raises(MissingWayOfFindingObjectException){ $ie.table(:bad_attribute, 99).row_count }
|
30
|
-
|
31
|
-
assert_equal(2, $ie.table(:index, 1).row_count)
|
32
|
-
assert_equal(2, $ie.table(:index, 1).rows.length)
|
42
|
+
assert_equal(2, browser.table(:index, 1).row_count)
|
43
|
+
assert_equal(2, browser.table(:index, 1).rows.length)
|
33
44
|
|
34
|
-
assert_equal(5,
|
35
|
-
assert_equal(5,
|
36
|
-
assert_equal(5,
|
45
|
+
assert_equal(5, browser.table(:id, 't1').row_count) # 4 rows and a header
|
46
|
+
assert_equal(5, browser.table(:index, 2).row_count) # same table as above, just accessed by index
|
47
|
+
assert_equal(5, browser.table(:id, 't1').rows.length)
|
37
48
|
|
38
49
|
# test the each iterator on rows - ie, go through each cell
|
39
|
-
row =
|
40
|
-
|
50
|
+
row = browser.table(:index, 2)[2]
|
51
|
+
result = []
|
41
52
|
row.each do |cell|
|
42
|
-
|
43
|
-
if count == 1
|
44
|
-
assert_equal('Row 1 Col1', cell.to_s.strip)
|
45
|
-
elsif count==2
|
46
|
-
assert_equal('Row 1 Col2', cell.to_s.strip)
|
47
|
-
end
|
48
|
-
count += 1
|
53
|
+
result << cell.to_s.strip
|
49
54
|
end
|
50
|
-
assert_equal(
|
51
|
-
assert_equal(2,
|
55
|
+
assert_equal(['Row 1 Col1', 'Row 1 Col2'], result)
|
56
|
+
assert_equal(2, row.column_count)
|
52
57
|
end
|
53
|
-
|
58
|
+
|
54
59
|
def test_dynamic_tables
|
55
|
-
|
60
|
+
@reload_page = true
|
61
|
+
t = browser.table(:id, 't1')
|
56
62
|
assert_equal(5, t.row_count)
|
57
|
-
|
63
|
+
browser.button(:value, 'add row').click
|
58
64
|
assert_equal(6, t.row_count)
|
59
65
|
end
|
60
66
|
|
61
67
|
def test_columns
|
62
|
-
assert_raises
|
63
|
-
|
64
|
-
|
65
|
-
|
68
|
+
assert_raises UnknownObjectException do
|
69
|
+
browser.table(:id, 'missingTable').column_count
|
70
|
+
end
|
71
|
+
assert_raises UnknownObjectException do
|
72
|
+
browser.table(:index, 77).column_count
|
73
|
+
end
|
74
|
+
assert_equal(2, browser.table(:index, 1).column_count)
|
75
|
+
assert_equal(1, browser.table(:id, 't1').column_count) # row one has 1 cell with a colspan of 2
|
66
76
|
end
|
67
77
|
|
68
78
|
def test_to_a
|
69
|
-
|
70
|
-
|
79
|
+
expected = [ ["Row 1 Col1" , "Row 1 Col2"],
|
80
|
+
[ "Row 2 Col1" , "Row 2 Col2"] ]
|
81
|
+
assert_equal(expected, browser.table(:index , 1).to_a)
|
71
82
|
end
|
72
83
|
|
73
84
|
def test_links_and_images_in_table
|
74
|
-
table =
|
85
|
+
table = browser.table(:id, 'pic_table')
|
75
86
|
image = table[1][2].image(:index,1)
|
76
87
|
assert_equal("106", image.width)
|
77
88
|
|
@@ -80,23 +91,30 @@ class TC_Tables < Test::Unit::TestCase
|
|
80
91
|
end
|
81
92
|
|
82
93
|
def test_cell_directly
|
83
|
-
assert
|
84
|
-
assert
|
85
|
-
assert_equal(
|
86
|
-
|
87
|
-
|
88
|
-
|
94
|
+
assert browser.cell(:id, 'cell1').exists?
|
95
|
+
assert ! browser.cell(:id, 'no_exist').exists?
|
96
|
+
assert_equal("Row 1 Col1", browser.cell(:id, 'cell1').to_s.strip)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_cell_another_way
|
100
|
+
assert_equal( "Row 1 Col1", browser.table(:index,1)[1][1].to_s.strip)
|
89
101
|
end
|
90
102
|
|
91
103
|
def test_row_directly
|
92
|
-
assert
|
93
|
-
assert
|
94
|
-
|
95
|
-
|
104
|
+
assert browser.row(:id, 'row1').exists?
|
105
|
+
assert ! browser.row(:id, 'no_exist').exists?
|
106
|
+
end
|
107
|
+
def test_row_another_way
|
108
|
+
assert_equal('Row 2 Col1', browser.row(:id, 'row1')[1].to_s.strip)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_row_in_table
|
112
|
+
assert_equal 'Row 2 Col1 Row 2 Col2',
|
113
|
+
browser.table(:id, 't1').row(:id, 'row1').text
|
96
114
|
end
|
97
115
|
|
98
116
|
def test_row_iterator
|
99
|
-
t =
|
117
|
+
t = browser.table(:index, 1)
|
100
118
|
count = 1
|
101
119
|
t.each do |row|
|
102
120
|
if count == 1
|
@@ -111,7 +129,7 @@ class TC_Tables < Test::Unit::TestCase
|
|
111
129
|
end
|
112
130
|
|
113
131
|
def test_row_collection
|
114
|
-
t =
|
132
|
+
t = browser.table(:index,1)
|
115
133
|
count = 1
|
116
134
|
t.rows.each do |row|
|
117
135
|
if count == 1
|
@@ -126,22 +144,18 @@ class TC_Tables < Test::Unit::TestCase
|
|
126
144
|
end
|
127
145
|
|
128
146
|
def test_cell_collection
|
129
|
-
t =
|
130
|
-
count = 1
|
147
|
+
t = browser.table(:index,1)
|
131
148
|
contents = t.cells.collect {|c| c.text}
|
132
149
|
assert_equal(["Row 1 Col1","Row 1 Col2","Row 2 Col1","Row 2 Col2"], contents)
|
133
150
|
end
|
134
151
|
|
135
152
|
def test_table_body
|
136
|
-
assert_equal(
|
137
|
-
assert_equal(
|
153
|
+
assert_equal(1, browser.table(:index, 1).bodies.length)
|
154
|
+
assert_equal(3, browser.table(:id, 'body_test').bodies.length)
|
138
155
|
|
139
156
|
count = 1
|
140
|
-
|
141
|
-
|
157
|
+
browser.table(:id, 'body_test').bodies.each do |n|
|
142
158
|
# do something better here!
|
143
|
-
# n.flash # this line commented out to speed up the test
|
144
|
-
|
145
159
|
case count
|
146
160
|
when 1
|
147
161
|
compare_text = "This text is in the FRST TBODY."
|
@@ -150,18 +164,15 @@ class TC_Tables < Test::Unit::TestCase
|
|
150
164
|
when 3
|
151
165
|
compare_text = "This text is in the THIRD TBODY."
|
152
166
|
end
|
153
|
-
|
154
167
|
assert_equal(compare_text, n[1][1].to_s.strip ) # this is the 1st cell of the first row of this particular body
|
155
|
-
|
156
168
|
count += 1
|
157
169
|
end
|
158
|
-
assert_equal( count - 1,
|
159
|
-
|
160
|
-
assert_equal( "This text is in the THIRD TBODY." ,$ie.table(:id, 'body_test' ).body(:index,3)[1][1].to_s.strip )
|
170
|
+
assert_equal( count - 1, browser.table(:id, 'body_test').bodies.length )
|
171
|
+
assert_equal( "This text is in the THIRD TBODY." ,browser.table(:id, 'body_test' ).body(:index,3)[1][1].to_s.strip )
|
161
172
|
|
162
173
|
# iterate through all the rows in a table body
|
163
174
|
count = 1
|
164
|
-
|
175
|
+
browser.table(:id, 'body_test').body(:index, 2).each do | row |
|
165
176
|
# row.flash # this line commented out, to speed up the tests
|
166
177
|
if count == 1
|
167
178
|
assert_equal('This text is in the SECOND TBODY.', row[1].text.strip )
|
@@ -173,11 +184,12 @@ class TC_Tables < Test::Unit::TestCase
|
|
173
184
|
end
|
174
185
|
|
175
186
|
def test_table_container
|
176
|
-
assert_nothing_raised {
|
187
|
+
assert_nothing_raised { browser.table(:id, 't1').html }
|
177
188
|
end
|
178
189
|
|
179
190
|
def test_multiple_selector
|
180
|
-
|
191
|
+
assert_equal('Second table with css class',
|
192
|
+
browser.table(:class => 'sample', :index => 2)[1][1].text)
|
181
193
|
end
|
182
194
|
end
|
183
195
|
|
@@ -185,81 +197,79 @@ class TC_Tables_Simple < Test::Unit::TestCase
|
|
185
197
|
include Watir
|
186
198
|
|
187
199
|
def setup
|
188
|
-
|
200
|
+
goto_page "simple_table.html"
|
189
201
|
end
|
190
202
|
|
191
203
|
def test_simple_table_access
|
192
|
-
table =
|
193
|
-
|
194
|
-
assert_equal("Row
|
195
|
-
assert_equal("Row
|
196
|
-
assert_equal(
|
197
|
-
assert_equal(2,table.column_count)
|
204
|
+
table = browser.table(:index,1)
|
205
|
+
assert_equal("Row 3 Col1", table[3][1].text.strip)
|
206
|
+
assert_equal("Row 1 Col1", table[1][1].text.strip)
|
207
|
+
assert_equal("Row 3 Col2", table[3][2].text.strip)
|
208
|
+
assert_equal(2, table.column_count)
|
198
209
|
end
|
199
210
|
end
|
200
211
|
class TC_Tables_Buttons < Test::Unit::TestCase
|
201
212
|
include Watir
|
202
213
|
|
203
214
|
def setup
|
204
|
-
|
215
|
+
uses_page "simple_table_buttons.html"
|
205
216
|
end
|
206
217
|
|
207
218
|
def test_simple_table_buttons
|
208
|
-
table =
|
219
|
+
table = browser.table(:index,1)
|
209
220
|
|
210
221
|
table[1][1].button(:index,1).click
|
211
|
-
assert(
|
222
|
+
assert(browser.textField(:name,"confirmtext").verify_contains(/CLICK1/i))
|
212
223
|
table[2][1].button(:index,1).click
|
213
|
-
assert(
|
224
|
+
assert(browser.textField(:name,"confirmtext").verify_contains(/CLICK2/i))
|
214
225
|
|
215
226
|
table[1][1].button(:id,'b1').click
|
216
|
-
assert(
|
227
|
+
assert(browser.textField(:name,"confirmtext").verify_contains(/CLICK1/i))
|
217
228
|
|
218
229
|
assert_raises(UnknownObjectException ) { table[1][1].button(:id,'b_missing').click }
|
219
230
|
|
220
231
|
table[3][1].button(:index,2).click
|
221
|
-
assert(
|
232
|
+
assert(browser.textField(:name,"confirmtext").verify_contains(/TOO/i))
|
222
233
|
|
223
234
|
table[3][1].button(:value ,"Click too").click
|
224
|
-
assert(
|
235
|
+
assert(browser.textField(:name,"confirmtext").verify_contains(/TOO/i))
|
225
236
|
|
226
|
-
|
227
|
-
assert(
|
237
|
+
browser.table(:index,1)[4][1].text_field(:index,1).set("123")
|
238
|
+
assert(browser.text_field(:index,2).verify_contains("123"))
|
228
239
|
|
229
240
|
# check when a cell contains 2 objects
|
230
241
|
|
231
242
|
# if there were 2 different html objects in the same cell, some weird things happened ( button caption could change for example)
|
232
|
-
assert_equal( 'Click ->' ,
|
233
|
-
|
234
|
-
assert_equal( 'Click ->' ,
|
243
|
+
assert_equal( 'Click ->' , browser.table(:index,1)[5][1].text_field(:index,1).value )
|
244
|
+
browser.table(:index,1)[5][1].text_field(:index,1).click
|
245
|
+
assert_equal( 'Click ->' , browser.table(:index,1)[5][1].text_field(:index,1).value )
|
235
246
|
|
236
|
-
|
237
|
-
assert_equal( '' ,
|
247
|
+
browser.table(:index,1)[5][1].button(:index,1).click
|
248
|
+
assert_equal( '' , browser.table(:index,1)[5][1].text_field(:index,1).value )
|
238
249
|
end
|
239
250
|
|
240
251
|
def test_simple_table_gif
|
241
|
-
table =
|
252
|
+
table = browser.table(:index,2)
|
253
|
+
assert_match(/1\.gif/, table[1][1].image(:index, 1).src)
|
254
|
+
assert_match(/2\.gif/, table[1][2].image(:index, 1).src)
|
255
|
+
assert_match(/3\.gif/, table[1][3].image(:index, 1).src)
|
242
256
|
|
243
|
-
assert_match(
|
244
|
-
assert_match(
|
245
|
-
assert_match(
|
257
|
+
assert_match(/1\.gif/, table[3][1].image(:index, 1).src)
|
258
|
+
assert_match(/2\.gif/, table[3][2].image(:index, 1).src)
|
259
|
+
assert_match(/3\.gif/, table[3][3].image(:index, 1).src)
|
246
260
|
|
247
|
-
|
248
|
-
assert_match(
|
249
|
-
assert_match(
|
261
|
+
table = browser.table(:index,3)
|
262
|
+
assert_match(/1\.gif/, table[1][1].image(:index, 1).src)
|
263
|
+
assert_match(/2\.gif/, table[1][1].image(:index, 2).src)
|
264
|
+
assert_match(/3\.gif/, table[1][1].image(:index, 3).src)
|
250
265
|
|
251
|
-
table
|
252
|
-
assert_match(
|
253
|
-
assert_match(
|
254
|
-
assert_match( /3\.gif/ , table[1][1].image( :index ,3).src )
|
255
|
-
|
256
|
-
assert_match( /1\.gif/ , table[3][1].image( :index ,1).src )
|
257
|
-
assert_match( /2\.gif/ , table[3][1].image( :index ,2).src )
|
258
|
-
assert_match( /3\.gif/ , table[3][1].image( :index ,3).src )
|
266
|
+
assert_match(/1\.gif/, table[3][1].image(:index, 1).src)
|
267
|
+
assert_match(/2\.gif/, table[3][1].image(:index, 2).src)
|
268
|
+
assert_match(/3\.gif/, table[3][1].image(:index, 3).src)
|
259
269
|
end
|
260
270
|
|
261
271
|
def test_table_with_hidden_or_visible_rows
|
262
|
-
t =
|
272
|
+
t = browser.table(:id , 'show_hide')
|
263
273
|
|
264
274
|
# expand the table
|
265
275
|
t.each do |r|
|
@@ -267,71 +277,69 @@ class TC_Tables_Buttons < Test::Unit::TestCase
|
|
267
277
|
end
|
268
278
|
|
269
279
|
# shrink rows 1,2,3
|
270
|
-
count=1
|
280
|
+
count = 1
|
271
281
|
t.each do |r|
|
272
282
|
r[1].image(:src, /minus/).click if r[1].image(:src, /minus/).exists? and (1..3) === count
|
273
|
-
count=2
|
283
|
+
count = 2
|
274
284
|
end
|
275
285
|
end
|
276
286
|
|
277
287
|
def test_table_from_element
|
278
|
-
button =
|
279
|
-
table = Table.create_from_element(
|
288
|
+
button = browser.button(:id, "b1")
|
289
|
+
table = Watir::Table.create_from_element(browser, button)
|
280
290
|
|
281
291
|
table[2][1].button(:index, 1).click
|
282
|
-
assert(
|
292
|
+
assert(browser.textField(:name, "confirmtext").verify_contains(/CLICK2/i))
|
283
293
|
end
|
284
294
|
end
|
285
295
|
|
286
296
|
class TC_Table_Columns < Test::Unit::TestCase
|
287
|
-
include Watir
|
297
|
+
include Watir::Exception
|
288
298
|
def setup
|
289
|
-
|
299
|
+
uses_page "simple_table_columns.html"
|
290
300
|
end
|
291
301
|
|
292
302
|
def test_get_columnvalues_single_column
|
293
|
-
assert_equal(["R1C1", "R2C1", "R3C1"],
|
303
|
+
assert_equal(["R1C1", "R2C1", "R3C1"], browser.table(:index, 1).column_values(1))
|
294
304
|
end
|
295
|
-
|
305
|
+
|
296
306
|
def test_colspan
|
297
|
-
assert_equal(2,
|
298
|
-
assert_equal(1,
|
299
|
-
assert_equal(3,
|
307
|
+
assert_equal(2, browser.table(:index, 3)[2][1].colspan)
|
308
|
+
assert_equal(1, browser.table(:index, 3)[1][1].colspan)
|
309
|
+
assert_equal(3, browser.table(:index, 3)[4][1].colspan)
|
300
310
|
end
|
301
|
-
|
311
|
+
|
302
312
|
def test_get_columnvalues_multiple_column
|
303
|
-
assert_equal(["R1C1", "R2C1", "R3C1"],
|
304
|
-
assert_equal(["R1C3", "R2C3", "R3C3"],
|
313
|
+
assert_equal(["R1C1", "R2C1", "R3C1"], browser.table(:index, 2).column_values(1))
|
314
|
+
assert_equal(["R1C3", "R2C3", "R3C3"], browser.table(:index, 2).column_values(3))
|
305
315
|
end
|
306
|
-
|
316
|
+
|
307
317
|
def test_get_columnvalues_with_colspan
|
308
|
-
assert_equal(["R1C1", "R2C1", "R3C1", "R4C1", "R5C1", "R6C2"],
|
309
|
-
|
318
|
+
assert_equal(["R1C1", "R2C1", "R3C1", "R4C1", "R5C1", "R6C2"], browser.table(:index, 3).column_values(1))
|
319
|
+
(2..4).each{|x|assert_raises(UnknownCellException){browser.table(:index, 3).column_values(x)}}
|
310
320
|
end
|
311
|
-
|
321
|
+
|
312
322
|
def test_get_rowvalues_full_row
|
313
|
-
assert_equal(["R1C1", "R1C2", "R1C3"],
|
323
|
+
assert_equal(["R1C1", "R1C2", "R1C3"], browser.table(:index, 3).row_values(1))
|
314
324
|
end
|
315
|
-
|
325
|
+
|
316
326
|
def test_get_rowvalues_with_colspan
|
317
|
-
assert_equal(["R2C1", "R2C2"],
|
327
|
+
assert_equal(["R2C1", "R2C2"], browser.table(:index, 3).row_values(2))
|
318
328
|
end
|
319
|
-
|
329
|
+
|
320
330
|
def test_getrowvalues_with_rowspan
|
321
|
-
assert_equal(["R5C1", "R5C2", "R5C3"],
|
322
|
-
assert_equal(["R6C2", "R6C3"],
|
331
|
+
assert_equal(["R5C1", "R5C2", "R5C3"], browser.table(:index, 3).row_values(5))
|
332
|
+
assert_equal(["R6C2", "R6C3"], browser.table(:index, 3).row_values(6))
|
323
333
|
end
|
324
334
|
end
|
325
335
|
|
326
336
|
class TC_Tables_Complex < Test::Unit::TestCase
|
327
|
-
include Watir
|
328
337
|
def setup
|
329
|
-
|
338
|
+
uses_page "complex_table.html"
|
330
339
|
end
|
331
|
-
|
340
|
+
|
332
341
|
def test_complex_table_access
|
333
|
-
table =
|
334
|
-
|
342
|
+
table = browser.table(:index,1)
|
335
343
|
assert_equal("subtable1 Row 1 Col1",table[1][1].table(:index,1)[1][1].text.strip)
|
336
344
|
assert_equal("subtable1 Row 1 Col2",table[1][1].table(:index,1)[1][2].text.strip)
|
337
345
|
assert_equal("subtable2 Row 1 Col2",table[2][1].table(:index,1)[1][2].text.strip)
|