Checking existence of images and favicons with RSpec and Capybara

后端 未结 4 1825
灰色年华
灰色年华 2021-01-12 09:01

Is there a good way to check on existence of images and favicons using rspec and capybara?

I can check on the DOM of favicons and images, but I want to be able to ch

4条回答
  •  被撕碎了的回忆
    2021-01-12 10:08

    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
    

提交回复
热议问题