It's easy to use Capybara Matcher on an element with single check like
expect(element).to have_selector('#selector')
||
BUT
How do I achieve the same when asserting on an element that is part of a list and multiple checks need to be done to assert.
I want to do something like:
<products>
<product>
<product>
<product>
</products>
def have_product(name,price)
products.any? {|product| product.have_text(name) && product.have_text(price)} # pseudo code
end
I want to be able to check whether a product with given name and price(both need to match) exists in the list.