forked from watir/watirspec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
table_nesting_spec.rb
53 lines (40 loc) · 1.8 KB
/
table_nesting_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)
describe "Table" do
before :each do
browser.goto(WatirSpec.url_for("nested_tables.html"))
end
# not a webdriver bug - IE seems unable to deal with the invalid nesting
not_compliant_on :internet_explorer do
it "returns the correct number of rows under a table" do
tables = browser.div(id: "table-rows-test").tables(id: /^tbl/)
expect(tables.length).to be > 0
tables.each do |table|
expected = Integer(table.data_row_count)
actual = table.rows.length
browser_count = Integer(table.data_browser_count)
expect(actual).to eql(expected), "expected #{expected} rows, got #{actual} for table id=#{table.id}, browser reported: #{browser_count}"
end
end
it "returns the correct number of cells under a row" do
rows = browser.div(id: "row-cells-test").trs(id: /^row/)
expect(rows.length).to be > 0
rows.each do |row|
expected = Integer(row.data_cell_count)
actual = row.cells.length
browser_count = Integer(row.data_browser_count)
expect(actual).to eql(expected), "expected #{expected} cells, got #{actual} for row id=#{row.id}, browser reported: #{browser_count}"
end
end
it "returns the correct number of rows under a table section" do
tbodies = browser.table(id: "tbody-rows-test").tbodys(id: /^body/)
expect(tbodies.length).to be > 0
tbodies.each do |tbody|
expected = Integer(tbody.data_rows_count)
actual = tbody.rows.count
browser_count = Integer(tbody.data_browser_count)
expect(actual).to eql(expected), "expected #{expected} rows, got #{actual} for tbody id=#{tbody.id}, browser reported: #{browser_count}"
end
end
end
end