I'm trying to write test the value of alt text + src of an image using capybara and the css selectors.
any idea s to test both in single xpath ?
I'm trying to write test the value of alt text + src of an image using capybara and the css selectors.
any idea s to test both in single xpath ?
In 2022, this works perfectly:
find("img[src='https://some-url.com/image.jpg']")
or with embedded ruby
find("img[src='#{@post.image}']")
Here is an example I recently used:
test "Showing a company" do
visit companies_path
click_link @company.name
assert_title @company.name
assert_selector :link, href: @company.url
assert_selector "h3", text: @company.title
assert_selector "p", text: @company.description
find("img[src='#{@company.image}']")
end