Added has_content? to check for content on page
This commit is contained in:
parent
b061056d1b
commit
feb29e2d64
|
@ -61,6 +61,10 @@ class Webcat::Session
|
||||||
driver.body
|
driver.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_content?(content)
|
||||||
|
driver.find("//*[contains(child::text(),'#{content}')]").size > 0
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_link(locator)
|
def find_link(locator)
|
||||||
|
|
|
@ -281,6 +281,21 @@ shared_examples_for "session" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#has_content?' do
|
||||||
|
it "should be true if the given content is on the page at least once" do
|
||||||
|
@session.visit('/with_html')
|
||||||
|
@session.should have_content('est')
|
||||||
|
@session.should have_content('Lorem')
|
||||||
|
@session.should have_content('Redirect')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be false if the given content is not on the page" do
|
||||||
|
@session.visit('/with_html')
|
||||||
|
@session.should_not have_content('xxxxyzzz')
|
||||||
|
@session.should_not have_content('monkey')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#attach_file" do
|
describe "#attach_file" do
|
||||||
before do
|
before do
|
||||||
@session.visit('/form')
|
@session.visit('/form')
|
||||||
|
|
Loading…
Reference in New Issue