Skip to content

Instantly share code, notes, and snippets.

@codenamev
Last active December 16, 2015 09:29
Show Gist options
  • Save codenamev/5413099 to your computer and use it in GitHub Desktop.
Save codenamev/5413099 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment