Capybara: A step for finding images with filename and extension

Posted Over 6 years ago. Visible to the public.

This cucumber step is useful for testing an image (looking at the src of the image).

Then(/^I should see the image "([^"]*)"$/) do |filename_with_extension|
  expect(page).to have_css("img[src*='#{filename_with_extension}']")
end
Then I should see the image "placeholder.png"

Outline: Read more about how to test a uploaded file here, e.g. file downloads.

Last edit
Over 6 years ago
Emanuel
License
Source code in this card is licensed under the MIT License.
Posted by Emanuel to makandra dev (2018-01-05 08:56)