I have a Scenario that validates that the image I just uploaded exists on the next page.
This below works great, except that I have a variable folder structure based on the listing_id. How can I use regex here to match image to only the filename instead of the entire url?
Then /^I should see the image "(.+)"$/ do |image|
page.should have_xpath("//img[@src=\"/public/images/#{image}\"]")
end
Try page.should have_xpath("//img[contains(@src, \"#{image}\")]")
, which will match any img
whose src
contains your filename.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With