spec/element_spec.rb in watir-webdriver-0.1.8 vs spec/element_spec.rb in watir-webdriver-0.1.9
- old
+ new
@@ -8,6 +8,24 @@
browser.div(:id, 'receiver').send_keys("hello world")
browser.div(:id, 'output').ps.size.should == 11
end
end
+ describe "#present?" do
+ before do
+ browser.goto("file://" + File.expand_path("html/wait.html", File.dirname(__FILE__)))
+ end
+
+ it "returns true if the element exists and is visible" do
+ browser.div(:id, 'foo').should be_present
+ end
+
+ it "returns false if the element exists but is not visible" do
+ browser.div(:id, 'bar').should_not be_present
+ end
+
+ it "returns false if the element does not exist" do
+ browser.div(:id, 'should-not-exist').should_not be_present
+ end
+ end
+
end