watir-webdriver 0.0.1.dev5 → 0.0.1.dev6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -19
- data/VERSION +1 -1
- data/lib/watir-webdriver.rb +3 -1
- data/lib/watir-webdriver/base_element.rb +33 -27
- data/lib/watir-webdriver/browser.rb +2 -6
- data/lib/watir-webdriver/elements/font.rb +12 -0
- data/lib/watir-webdriver/elements/generated.rb +1027 -622
- data/lib/watir-webdriver/elements/select_list.rb +3 -3
- data/lib/watir-webdriver/locators/element_locator.rb +2 -2
- data/lib/watir-webdriver/xpath_support.rb +2 -2
- data/support/html5/html5.idl +942 -483
- data/support/html5/old/html5.idl +962 -0
- data/support/html5/{html5_extras.idl → old/html5_extras.idl} +0 -2
- data/support/html5/watir_visitor.rb +23 -19
- metadata +74 -100
- data/spec/watirspec/area_spec.rb +0 -78
- data/spec/watirspec/areas_spec.rb +0 -31
- data/spec/watirspec/browser_spec.rb +0 -274
- data/spec/watirspec/button_spec.rb +0 -242
- data/spec/watirspec/buttons_spec.rb +0 -48
- data/spec/watirspec/checkbox_spec.rb +0 -272
- data/spec/watirspec/checkboxes_spec.rb +0 -32
- data/spec/watirspec/dd_spec.rb +0 -123
- data/spec/watirspec/dds_spec.rb +0 -31
- data/spec/watirspec/div_spec.rb +0 -211
- data/spec/watirspec/divs_spec.rb +0 -31
- data/spec/watirspec/dl_spec.rb +0 -123
- data/spec/watirspec/dls_spec.rb +0 -32
- data/spec/watirspec/dt_spec.rb +0 -123
- data/spec/watirspec/dts_spec.rb +0 -31
- data/spec/watirspec/element_spec.rb +0 -89
- data/spec/watirspec/em_spec.rb +0 -97
- data/spec/watirspec/ems_spec.rb +0 -32
- data/spec/watirspec/filefield_spec.rb +0 -119
- data/spec/watirspec/filefields_spec.rb +0 -32
- data/spec/watirspec/form_spec.rb +0 -63
- data/spec/watirspec/forms_spec.rb +0 -33
- data/spec/watirspec/frame_spec.rb +0 -129
- data/spec/watirspec/frames_spec.rb +0 -62
- data/spec/watirspec/hidden_spec.rb +0 -102
- data/spec/watirspec/hiddens_spec.rb +0 -32
- data/spec/watirspec/hn_spec.rb +0 -93
- data/spec/watirspec/hns_spec.rb +0 -38
- data/spec/watirspec/image_spec.rb +0 -207
- data/spec/watirspec/images_spec.rb +0 -31
- data/spec/watirspec/label_spec.rb +0 -75
- data/spec/watirspec/labels_spec.rb +0 -31
- data/spec/watirspec/li_spec.rb +0 -112
- data/spec/watirspec/lib/guards.rb +0 -59
- data/spec/watirspec/lib/server.rb +0 -127
- data/spec/watirspec/lib/spec_helper.rb +0 -79
- data/spec/watirspec/lib/watirspec.rb +0 -72
- data/spec/watirspec/link_spec.rb +0 -168
- data/spec/watirspec/links_spec.rb +0 -35
- data/spec/watirspec/lis_spec.rb +0 -31
- data/spec/watirspec/map_spec.rb +0 -76
- data/spec/watirspec/maps_spec.rb +0 -32
- data/spec/watirspec/meta_spec.rb +0 -22
- data/spec/watirspec/metas_spec.rb +0 -30
- data/spec/watirspec/ol_spec.rb +0 -78
- data/spec/watirspec/ols_spec.rb +0 -31
- data/spec/watirspec/option_spec.rb +0 -173
- data/spec/watirspec/p_spec.rb +0 -128
- data/spec/watirspec/pre_spec.rb +0 -112
- data/spec/watirspec/pres_spec.rb +0 -31
- data/spec/watirspec/ps_spec.rb +0 -31
- data/spec/watirspec/radio_spec.rb +0 -255
- data/spec/watirspec/radios_spec.rb +0 -32
- data/spec/watirspec/select_list_spec.rb +0 -318
- data/spec/watirspec/select_lists_spec.rb +0 -35
- data/spec/watirspec/span_spec.rb +0 -142
- data/spec/watirspec/spans_spec.rb +0 -31
- data/spec/watirspec/spec_helper.rb +0 -17
- data/spec/watirspec/strong_spec.rb +0 -89
- data/spec/watirspec/strongs_spec.rb +0 -32
- data/spec/watirspec/table_bodies_spec.rb +0 -45
- data/spec/watirspec/table_body_spec.rb +0 -98
- data/spec/watirspec/table_cell_spec.rb +0 -68
- data/spec/watirspec/table_cells_spec.rb +0 -47
- data/spec/watirspec/table_footer_spec.rb +0 -85
- data/spec/watirspec/table_footers_spec.rb +0 -47
- data/spec/watirspec/table_header_spec.rb +0 -85
- data/spec/watirspec/table_headers_spec.rb +0 -45
- data/spec/watirspec/table_row_spec.rb +0 -87
- data/spec/watirspec/table_rows_spec.rb +0 -50
- data/spec/watirspec/table_spec.rb +0 -160
- data/spec/watirspec/tables_spec.rb +0 -33
- data/spec/watirspec/text_field_spec.rb +0 -276
- data/spec/watirspec/text_fields_spec.rb +0 -35
- data/spec/watirspec/ul_spec.rb +0 -76
- data/spec/watirspec/uls_spec.rb +0 -33
- data/support/html5/idl_extractor.rb +0 -73
@@ -1,47 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
bug "WTR-358", :watir do
|
5
|
-
|
6
|
-
describe "TableFooters" do
|
7
|
-
before :each do
|
8
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#length" do
|
12
|
-
it "returns the correct number of table tfoots (page context)" do
|
13
|
-
browser.tfoots.length.should == 1
|
14
|
-
end
|
15
|
-
|
16
|
-
it "returns the correct number of table tfoots (table context)" do
|
17
|
-
browser.table(:index, 0).tfoots.length.should == 1
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#[]" do
|
22
|
-
it "returns the row at the given index (page context)" do
|
23
|
-
browser.tfoots[0].id.should == "tax_totals"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns the row at the given index (table context)" do
|
27
|
-
browser.table(:index, 0).tfoots[0].id.should == "tax_totals"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "#each" do
|
32
|
-
it "iterates through table tfoots correctly (page context)" do
|
33
|
-
browser.tfoots.each_with_index do |tfoot, index|
|
34
|
-
tfoot.id.should == browser.tfoot(:index, index).id
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it "iterates through table tfoots correctly (table context)" do
|
39
|
-
table = browser.table(:index, 0)
|
40
|
-
table.tfoots.each_with_index do |tfoot, index|
|
41
|
-
tfoot.id.should == table.tfoot(:index, index).id
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
bug "WTR-357", :watir do
|
5
|
-
describe "TableHeader" do
|
6
|
-
|
7
|
-
before :each do
|
8
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true if the table theader exists (page context)" do
|
13
|
-
browser.thead(:id, 'tax_headers').should exist
|
14
|
-
browser.thead(:id, /tax_headers/).should exist
|
15
|
-
browser.thead(:index, 0).should exist
|
16
|
-
browser.thead(:xpath, "//thead[@id='tax_headers']").should exist
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns true if the table theader exists (table context)" do
|
20
|
-
browser.table(:index, 0).thead(:id, 'tax_headers').should exist
|
21
|
-
browser.table(:index, 0).thead(:id, /tax_headers/).should exist
|
22
|
-
browser.table(:index, 0).thead(:index, 0).should exist
|
23
|
-
browser.table(:index, 0).thead(:xpath, "//thead[@id='tax_headers']").should exist
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns false if the table theader doesn't exist (page context)" do
|
27
|
-
browser.thead(:id, 'no_such_id').should_not exist
|
28
|
-
browser.thead(:id, /no_such_id/).should_not exist
|
29
|
-
browser.thead(:index, 1337).should_not exist
|
30
|
-
browser.thead(:xpath, "//thead[@id='no_such_id']").should_not exist
|
31
|
-
end
|
32
|
-
|
33
|
-
it "returns false if the table theader doesn't exist (table context)" do
|
34
|
-
browser.table(:index, 0).thead(:id, 'no_such_id').should_not exist
|
35
|
-
browser.table(:index, 0).thead(:id, /no_such_id/).should_not exist
|
36
|
-
browser.table(:index, 0).thead(:index, 1337).should_not exist
|
37
|
-
browser.table(:index, 0).thead(:xpath, "//thead[@id='no_such_id']").should_not exist
|
38
|
-
end
|
39
|
-
|
40
|
-
it "raises TypeError when 'what' argument is invalid" do
|
41
|
-
lambda { browser.thead(:id, 3.14).exists? }.should raise_error(TypeError)
|
42
|
-
lambda { browser.table(:index, 0).thead(:id, 3.14).exists? }.should raise_error(TypeError)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
46
|
-
lambda { browser.thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
47
|
-
lambda { browser.table(:index, 0).thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#length" do
|
52
|
-
it "returns the correct number of table bodies (page context)" do
|
53
|
-
browser.thead(:id, 'tax_headers').length.should == 1
|
54
|
-
end
|
55
|
-
|
56
|
-
it "returns the correct number of table bodies (table context)" do
|
57
|
-
browser.table(:index, 0).thead(:id, 'tax_headers').length.should == 1
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "#[]" do
|
62
|
-
it "returns the row at the given index (page context)" do
|
63
|
-
browser.thead(:id, 'tax_headers')[0].id.should == 'thead_row_1'
|
64
|
-
browser.thead(:id, 'tax_headers')[0][1].text.should == 'Before income tax'
|
65
|
-
browser.thead(:id, 'tax_headers')[0][2].text.should == 'Income tax'
|
66
|
-
end
|
67
|
-
|
68
|
-
it "returns the row at the given index (table context)" do
|
69
|
-
browser.table(:index, 0).thead(:id, 'tax_headers')[0].id.should == 'thead_row_1'
|
70
|
-
browser.table(:index, 0).thead(:id, 'tax_headers')[0][1].text.should == 'Before income tax'
|
71
|
-
browser.table(:index, 0).thead(:id, 'tax_headers')[0][2].text.should == 'Income tax'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "#each" do
|
76
|
-
it "iterates through rows correctly" do
|
77
|
-
theader = browser.table(:index, 0).thead(:id, 'tax_headers')
|
78
|
-
theader.each_with_index do |r, index|
|
79
|
-
r.id.should == browser.row(:index, index).id
|
80
|
-
r.value.should == browser.row(:index, index).value
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
bug "WTR-357", :watir do
|
5
|
-
describe "TableHeaders" do
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#length" do
|
11
|
-
it "returns the correct number of table theads (page context)" do
|
12
|
-
browser.theads.length.should == 1
|
13
|
-
end
|
14
|
-
|
15
|
-
it "returns the correct number of table theads (table context)" do
|
16
|
-
browser.table(:index, 0).theads.length.should == 1
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "#[]" do
|
21
|
-
it "returns the row at the given index (page context)" do
|
22
|
-
browser.theads[0].id.should == "tax_headers"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns the row at the given index (table context)" do
|
26
|
-
browser.table(:index, 0).theads[0].id.should == "tax_headers"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through table theads correctly (page context)" do
|
32
|
-
browser.theads.each_with_index do |thead, index|
|
33
|
-
thead.id.should == browser.thead(:index, index).id
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
it "iterates through table theads correctly (table context)" do
|
38
|
-
table = browser.table(:index, 0)
|
39
|
-
table.theads.each_with_index do |thead, index|
|
40
|
-
thead.id.should == table.thead(:index, index).id
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "TableRow" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#exists?" do
|
11
|
-
it "returns true if the table row exists" do
|
12
|
-
browser.row(:id, "outer_first").should exist
|
13
|
-
browser.row(:id, /outer_first/).should exist
|
14
|
-
browser.row(:index, 0).should exist
|
15
|
-
browser.row(:xpath, "//tr[@id='outer_first']")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "returns false if the table row doesn't exist" do
|
19
|
-
browser.row(:id, "no_such_id").should_not exist
|
20
|
-
browser.row(:id, /no_such_id/).should_not exist
|
21
|
-
browser.row(:index, 1337).should_not exist
|
22
|
-
browser.row(:xpath, "//tr[@id='no_such_id']")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "raises TypeError when 'what' argument is invalid" do
|
26
|
-
lambda { browser.row(:id, 3.14).exists? }.should raise_error(TypeError)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
30
|
-
lambda { browser.row(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "#click" do
|
35
|
-
it "fires the rows's onclick event" do
|
36
|
-
browser.row(:id, 'inner_first').click
|
37
|
-
messages.should include('tr')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "#column_count" do
|
42
|
-
it "returns the number of columns (cells) in the row" do
|
43
|
-
browser.table(:id, 'outer').rows[0].column_count.should == 2
|
44
|
-
browser.table(:id, 'outer')[1].column_count.should == 2
|
45
|
-
browser.table(:id, 'colspan')[0].column_count.should == 1
|
46
|
-
browser.table(:id, 'colspan').rows[1].column_count.should == 2
|
47
|
-
browser.rows[0].column_count.should == 4
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#[]" do
|
52
|
-
it "returns the nth cell of the parent row" do
|
53
|
-
browser.table(:id, 'outer').row(:index, 0)[0].text.should == "Table 1, Row 1, Cell 1"
|
54
|
-
browser.table(:id, 'outer')[0][0].text.should == "Table 1, Row 1, Cell 1"
|
55
|
-
browser.table(:id, 'outer')[2][0].text.should == "Table 1, Row 3, Cell 1"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "raises UnknownCellException if the index is out of bounds" do
|
59
|
-
lambda { browser.table(:id, 'outer').row(:index, 0)[1337] }.should raise_error(UnknownCellException)
|
60
|
-
lambda { browser.table(:id, 'outer')[0][1337] }.should raise_error(UnknownCellException)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
bug "WTR-359", :watir do
|
65
|
-
describe "#child_cell" do
|
66
|
-
it "returns the nth cell of the parent row" do
|
67
|
-
browser.table(:id, 'outer').row(:index, 0).child_cell(0).text.should == "Table 1, Row 1, Cell 1"
|
68
|
-
browser.table(:id, 'outer')[0].child_cell(0).text.should == "Table 1, Row 1, Cell 1"
|
69
|
-
browser.table(:id, 'outer')[2].child_cell(0).text.should == "Table 1, Row 3, Cell 1"
|
70
|
-
end
|
71
|
-
|
72
|
-
it "raises UnknownCellException if the index is out of bounds" do
|
73
|
-
lambda { browser.table(:id, 'outer').row(:index, 0).child_cell(1337) }.should raise_error(UnknownCellException)
|
74
|
-
lambda { browser.table(:id, 'outer')[0].child_cell(1337) }.should raise_error(UnknownCellException)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#each" do
|
79
|
-
it "iterates correctly through the cells of the row" do
|
80
|
-
browser.table(:id, 'outer')[1].each_with_index do |cell,idx|
|
81
|
-
cell.id.should == "t1_r2_c#{idx + 1}"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "TableRows" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#length" do
|
11
|
-
bug "WTR-354", :watir do
|
12
|
-
it "returns the correct number of cells (table context)" do
|
13
|
-
browser.table(:id, 'inner').rows.length.should == 1
|
14
|
-
browser.table(:id, 'outer').rows.length.should == 3
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
it "returns the correct number of cells (page context)" do
|
19
|
-
browser.rows.length.should == 14
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#[]" do
|
24
|
-
it "returns the row at the given index (table context)" do
|
25
|
-
browser.table(:id, 'outer').rows[0].id.should == "outer_first"
|
26
|
-
end
|
27
|
-
|
28
|
-
it "returns the row at the given index (page context)" do
|
29
|
-
browser.rows[0].id.should == "thead_row_1"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "#each" do
|
34
|
-
it "iterates through rows correctly" do
|
35
|
-
# rows inside a table
|
36
|
-
inner_table = browser.table(:id, 'inner')
|
37
|
-
inner_table.rows.each_with_index do |r, index|
|
38
|
-
r.id.should == inner_table.row(:index, index).id
|
39
|
-
r.value.should == inner_table.row(:index, index).value
|
40
|
-
end
|
41
|
-
# rows inside a table (should not include rows inside a table inside a table)
|
42
|
-
outer_table = browser.table(:id, 'outer')
|
43
|
-
outer_table.rows.each_with_index do |r, index|
|
44
|
-
r.id.should == outer_table.row(:index, index).id
|
45
|
-
r.value.should == outer_table.row(:index, index).value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,160 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "Table" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true if the table exists" do
|
13
|
-
browser.table(:id, 'axis_example').should exist
|
14
|
-
browser.table(:id, /axis_example/).should exist
|
15
|
-
browser.table(:index, 0).should exist
|
16
|
-
browser.table(:xpath, "//table[@id='axis_example']").should exist
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns false if the table does not exist" do
|
20
|
-
browser.table(:id, 'no_such_id').should_not exist
|
21
|
-
browser.table(:id, /no_such_id/).should_not exist
|
22
|
-
browser.table(:index, 1337).should_not exist
|
23
|
-
browser.table(:xpath, "//table[@id='no_such_id']").should_not exist
|
24
|
-
end
|
25
|
-
|
26
|
-
it "raises TypeError when 'what' argument is invalid" do
|
27
|
-
lambda { browser.table(:id, 3.14).exists? }.should raise_error(TypeError)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
31
|
-
lambda { browser.table(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "#length" do
|
36
|
-
bug "WTR-354", :watir do
|
37
|
-
it "returns the number of rows" do
|
38
|
-
browser.table(:id, 'outer').rows.length.should == 3
|
39
|
-
browser.table(:id, 'inner').rows.length.should == 1
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Other
|
45
|
-
describe "#to_a" do
|
46
|
-
it "returns a two-dimensional array representation of the table" do
|
47
|
-
browser.table(:id, 'inner').to_a.should == [["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]]
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#click" do
|
52
|
-
it "fires the table's onclick event" do
|
53
|
-
browser.table(:id, 'inner').click
|
54
|
-
messages.first.should == 'table'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "#row_count" do
|
59
|
-
bug "WTR-354", :watir do
|
60
|
-
it "counts the number of rows correctly" do
|
61
|
-
browser.table(:id, 'inner').row_count.should == 1
|
62
|
-
browser.table(:id, 'outer').row_count.should == 3
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it "raises an UnknownObjectException if the table doesn't exist" do
|
67
|
-
lambda { browser.table(:id, 'no_such_id').row_count }.should raise_error(UnknownObjectException)
|
68
|
-
lambda { browser.table(:index, 1337).row_count }.should raise_error(UnknownObjectException)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "#row_values" do
|
73
|
-
it "gets row values" do
|
74
|
-
browser.table(:id, 'outer').row_values(0).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 1, Cell 2"]
|
75
|
-
browser.table(:id, 'inner').row_values(0).should == ["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]
|
76
|
-
browser.table(:id, 'outer').row_values(2).should == ["Table 1, Row 3, Cell 1", "Table 1, Row 3, Cell 2"]
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "#column_count" do
|
81
|
-
it "counts the number of columns correctly" do
|
82
|
-
browser.table(:id, 'inner').column_count.should == 2
|
83
|
-
browser.table(:id, 'outer').column_count.should == 2
|
84
|
-
end
|
85
|
-
|
86
|
-
it "raises an UnknownObjectException if the table doesn't exist" do
|
87
|
-
lambda { browser.table(:id, 'no_such_id').column_count }.should raise_error(UnknownObjectException)
|
88
|
-
lambda { browser.table(:index, 1337).column_count }.should raise_error(UnknownObjectException)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "#column_values" do
|
93
|
-
it "gets column values" do
|
94
|
-
browser.table(:id, 'inner').column_values(0).should == ["Table 2, Row 1, Cell 1"]
|
95
|
-
browser.table(:id, 'outer').column_values(0).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 2, Cell 1", "Table 1, Row 3, Cell 1"]
|
96
|
-
end
|
97
|
-
|
98
|
-
it "raises UnknownCellException when trying to locate non-existing cell" do
|
99
|
-
lambda { browser.table(:id, 'inner').column_values(1337) }.should raise_error(UnknownCellException)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe "#[]" do
|
104
|
-
it "returns the nth child row" do
|
105
|
-
browser.table(:id, 'outer')[0].id.should == "outer_first"
|
106
|
-
browser.table(:id, 'inner')[0].id.should == "inner_first"
|
107
|
-
browser.table(:id, 'outer')[2].id.should == "outer_last"
|
108
|
-
end
|
109
|
-
it "raises UnknownRowException if the index is out of bounds" do
|
110
|
-
lambda { browser.table(:id, 'outer')[1337] }.should raise_error(UnknownRowException)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "#child_row" do
|
115
|
-
it "returns the nth child row" do
|
116
|
-
browser.table(:id, 'outer').child_row(0).id.should == "outer_first"
|
117
|
-
browser.table(:id, 'inner').child_row(0).id.should == "inner_first"
|
118
|
-
browser.table(:id, 'outer').child_row(2).id.should == "outer_last"
|
119
|
-
end
|
120
|
-
it "raises UnknownRowException if the index is out of bounds" do
|
121
|
-
lambda { browser.table(:id, 'outer').child_row(1337) }.should raise_error(UnknownRowException)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe "#child_cell" do
|
126
|
-
it "returns the nth child row" do
|
127
|
-
browser.table(:id, 'outer').child_cell(4).text.should == "Table 1, Row 3, Cell 1"
|
128
|
-
end
|
129
|
-
it "raises UnknownCellException if the index is out of bounds" do
|
130
|
-
lambda { browser.table(:id, 'outer').child_cell(1337) }.should raise_error(UnknownCellException)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe "#each" do
|
135
|
-
it "iterates through the table's rows" do
|
136
|
-
ids = ["outer_first", "outer_second", "outer_last"]
|
137
|
-
browser.table(:id, 'outer').each_with_index do |r, idx|
|
138
|
-
r.id.should == ids[idx]
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe "#body" do
|
144
|
-
it "returns the correct instance of TableBody" do
|
145
|
-
body = browser.table(:index, 0).body(:id, 'first')
|
146
|
-
body.should be_instance_of(TableBody)
|
147
|
-
body[0][0].text.should == "March 2008"
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe "#bodies" do
|
152
|
-
it "returns the correct instance of TableBodies" do
|
153
|
-
bodies = browser.table(:index, 0).bodies
|
154
|
-
bodies.should be_instance_of(TableBodies)
|
155
|
-
bodies[0].id.should == "first"
|
156
|
-
bodies[1].id.should == "second"
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|