I created tests for my rails application using Capybara
.
I have one failing test without any idea how to fix.
Failures:
1) ManageController ManageController check user login to manage admin success
Failure/Error: page.should have_content("Login")
Capybara::ElementNotFound:
****Unable to find xpath "/html"****
Code:
describe "POST perform_login" do
it ("check user login to manage admin success") do
visit('/manage')
page.should have_content("Login")
fill_in('email' , {:with=> 'moshe.tini@conduit.com'})
fill_in('password', {:with=>'1234'})
button_link 'submit_login'
page.should have_content("Fake Login")
end
end
Can you post your code in for "login"?
Here's an example... I went to google and searched "San francisco" and inspected the first link.
The link has a structure like this:
<h3 class="r">
<a href="/link">
In this case, I'd just do:
page.should have_selector('.r a')
If you're looking for a certain text within the url, you could then do:
url_text = page.find('.r a').text
url_text.should include("foo")