使用RSpec和Capybara检查图像和图标的存在 [英] Checking existence of images and favicons with RSpec and Capybara
本文介绍了使用RSpec和Capybara检查图像和图标的存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有使用rspec和capybara检查图像和图标的存在的好方法?
Is there a good way to check on existence of images and favicons using rspec and capybara?
我可以检查图标和图像的DOM,但是我想要以便检查是否也加载了这些图像。
I can check on the DOM of favicons and images, but I want to be able to check that those images load as well. Is this possible with rspec and capybara?
推荐答案
describe "check images and favicon" do
before { visit "url/to/check")
it "should have the images" do
page.should have_css('img', text: "image1.jpg")
it "should have the favicon" do
page.should have_xpath("/html/head/link[@href='favicon.ico']"
end
end
这篇关于使用RSpec和Capybara检查图像和图标的存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文