spec/watirspec/table_spec.rb in watir-webdriver-0.0.6 vs spec/watirspec/table_spec.rb in watir-webdriver-0.0.7
- old
+ new
@@ -1,7 +1,7 @@
# encoding: utf-8
-require File.dirname(__FILE__) + '/spec_helper'
+require File.expand_path('spec_helper', File.dirname(__FILE__))
describe "Table" do
before :each do
browser.goto(WatirSpec.files + "/tables.html")
@@ -21,25 +21,30 @@
browser.table(:id, /no_such_id/).should_not exist
browser.table(:index, 1337).should_not exist
browser.table(:xpath, "//table[@id='no_such_id']").should_not exist
end
+ bug "http://github.com/jarib/watir-webdriver/issues#issue/6", :webdriver do
+ it "checks the tag name when locating by xpath" do
+ browser.table(:xpath, "//table//td").should_not exist
+ browser.table(:xpath, "//table").should exist
+ end
+ end
+
it "raises TypeError when 'what' argument is invalid" do
lambda { browser.table(:id, 3.14).exists? }.should raise_error(TypeError)
end
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
lambda { browser.table(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
end
end
describe "#length" do
- bug "WTR-354", :watir do
- it "returns the number of rows" do
- browser.table(:id, 'outer').rows.length.should == 3
- browser.table(:id, 'inner').rows.length.should == 1
- end
+ it "returns the number of rows" do
+ browser.table(:id, 'outer').rows.length.should == 3
+ browser.table(:id, 'inner').rows.length.should == 1
end
end
# Other
describe "#to_a" do
@@ -53,52 +58,58 @@
browser.table(:id, 'inner').click
messages.first.should == 'table'
end
end
- describe "#row_count" do
- bug "WTR-354", :watir do
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#row_count" do
it "counts the number of rows correctly" do
browser.table(:id, 'inner').row_count.should == 1
browser.table(:id, 'outer').row_count.should == 3
end
- end
- it "raises an UnknownObjectException if the table doesn't exist" do
- lambda { browser.table(:id, 'no_such_id').row_count }.should raise_error(UnknownObjectException)
- lambda { browser.table(:index, 1337).row_count }.should raise_error(UnknownObjectException)
+ it "raises an UnknownObjectException if the table doesn't exist" do
+ lambda { browser.table(:id, 'no_such_id').row_count }.should raise_error(UnknownObjectException)
+ lambda { browser.table(:index, 1337).row_count }.should raise_error(UnknownObjectException)
+ end
end
end
- describe "#row_values" do
- it "gets row values" do
- browser.table(:id, 'outer').row_values(0).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 1, Cell 2"]
- browser.table(:id, 'inner').row_values(0).should == ["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]
- browser.table(:id, 'outer').row_values(2).should == ["Table 1, Row 3, Cell 1", "Table 1, Row 3, Cell 2"]
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#row_values" do
+ it "gets row values" do
+ browser.table(:id, 'outer').row_values(0).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 1, Cell 2"]
+ browser.table(:id, 'inner').row_values(0).should == ["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]
+ browser.table(:id, 'outer').row_values(2).should == ["Table 1, Row 3, Cell 1", "Table 1, Row 3, Cell 2"]
+ end
end
end
- describe "#column_count" do
- it "counts the number of columns correctly" do
- browser.table(:id, 'inner').column_count.should == 2
- browser.table(:id, 'outer').column_count.should == 2
- end
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#column_count" do
+ it "counts the number of columns correctly" do
+ browser.table(:id, 'inner').column_count.should == 2
+ browser.table(:id, 'outer').column_count.should == 2
+ end
- it "raises an UnknownObjectException if the table doesn't exist" do
- lambda { browser.table(:id, 'no_such_id').column_count }.should raise_error(UnknownObjectException)
- lambda { browser.table(:index, 1337).column_count }.should raise_error(UnknownObjectException)
+ it "raises an UnknownObjectException if the table doesn't exist" do
+ lambda { browser.table(:id, 'no_such_id').column_count }.should raise_error(UnknownObjectException)
+ lambda { browser.table(:index, 1337).column_count }.should raise_error(UnknownObjectException)
+ end
end
end
- describe "#column_values" do
- it "gets column values" do
- browser.table(:id, 'inner').column_values(0).should == ["Table 2, Row 1, Cell 1"]
- 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"]
- end
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#column_values" do
+ it "gets column values" do
+ browser.table(:id, 'inner').column_values(0).should == ["Table 2, Row 1, Cell 1"]
+ 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"]
+ end
- it "raises UnknownCellException when trying to locate non-existing cell" do
- lambda { browser.table(:id, 'inner').column_values(1337) }.should raise_error(UnknownCellException)
+ it "raises UnknownCellException when trying to locate non-existing cell" do
+ lambda { browser.table(:id, 'inner').column_values(1337) }.should raise_error(UnknownCellException)
+ end
end
end
describe "#[]" do
it "returns the nth child row" do
@@ -109,52 +120,62 @@
it "raises UnknownRowException if the index is out of bounds" do
lambda { browser.table(:id, 'outer')[1337] }.should raise_error(UnknownRowException)
end
end
- describe "#child_row" do
- it "returns the nth child row" do
- browser.table(:id, 'outer').child_row(0).id.should == "outer_first"
- browser.table(:id, 'inner').child_row(0).id.should == "inner_first"
- browser.table(:id, 'outer').child_row(2).id.should == "outer_last"
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#child_row" do
+ it "returns the nth child row" do
+ browser.table(:id, 'outer').child_row(0).id.should == "outer_first"
+ browser.table(:id, 'inner').child_row(0).id.should == "inner_first"
+ browser.table(:id, 'outer').child_row(2).id.should == "outer_last"
+ end
+ it "raises UnknownRowException if the index is out of bounds" do
+ lambda { browser.table(:id, 'outer').child_row(1337) }.should raise_error(UnknownRowException)
+ end
end
- it "raises UnknownRowException if the index is out of bounds" do
- lambda { browser.table(:id, 'outer').child_row(1337) }.should raise_error(UnknownRowException)
- end
end
- describe "#child_cell" do
- it "returns the nth child row" do
- browser.table(:id, 'outer').child_cell(4).text.should == "Table 1, Row 3, Cell 1"
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#child_cell" do
+ it "returns the nth child row" do
+ browser.table(:id, 'outer').child_cell(4).text.should == "Table 1, Row 3, Cell 1"
+ end
+ it "raises UnknownCellException if the index is out of bounds" do
+ lambda { browser.table(:id, 'outer').child_cell(1337) }.should raise_error(UnknownCellException)
+ end
end
- it "raises UnknownCellException if the index is out of bounds" do
- lambda { browser.table(:id, 'outer').child_cell(1337) }.should raise_error(UnknownCellException)
- end
end
- describe "#each" do
- it "iterates through the table's rows" do
- ids = ["outer_first", "outer_second", "outer_last"]
- browser.table(:id, 'outer').each_with_index do |r, idx|
- r.id.should == ids[idx]
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#each" do
+ it "iterates through the table's rows" do
+ ids = ["outer_first", "outer_second", "outer_last"]
+ browser.table(:id, 'outer').each_with_index do |r, idx|
+ r.id.should == ids[idx]
+ end
end
end
end
- describe "#body" do
- it "returns the correct instance of TableBody" do
- body = browser.table(:index, 0).body(:id, 'first')
- body.should be_instance_of(TableBody)
- body[0][0].text.should == "March 2008"
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#body" do
+ it "returns the correct instance of TableBody" do
+ body = browser.table(:index, 0).body(:id, 'first')
+ body.should be_instance_of(TableBody)
+ body[0][0].text.should == "March 2008"
+ end
end
end
- describe "#bodies" do
- it "returns the correct instance of TableBodies" do
- bodies = browser.table(:index, 0).bodies
- bodies.should be_instance_of(TableBodies)
- bodies[0].id.should == "first"
- bodies[1].id.should == "second"
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
+ describe "#bodies" do
+ it "returns the correct instance of TableBodies" do
+ bodies = browser.table(:index, 0).bodies
+ bodies.should be_instance_of(TableBodies)
+ bodies[0].id.should == "first"
+ bodies[1].id.should == "second"
+ end
end
end
end