codenamev
4/18/2013 - 2:23 PM

Cucumber step to look for a resource (link, image, etc.) on the page.

Cucumber step to look for a resource (link, image, etc.) on the page.

Then /^I should see the ([^"]*) "([^"]*)"$/ do |element_type, file_name|
  case element_type
  when /link/
    page.should have_xpath("//link[contains(@href, '#{file_name}')]")
  when /img/
    page.should have_xpath("//img[contains(@src, '#{file_name}')]")
  end
end