`Compound Matcher Expressions`
boris-petrov opened this issue · comments
Meta
Capybara Version:
3.39.2
Driver Information (and browser if relevant):
selenium-webdriver 4.15.0
Expected Behavior
RSpec has a nice concept of Compound Matcher Expressions which works really well in some cases. Capybara doesn't seem to work with it:
expect(page).to have_text('a').and have_text('b')
NoMethodError:
undefined method `and' for #<Capybara::RSpecMatchers::Matchers::HaveText:0x22daa2df>
Did you mean? rand
end
Actual Behavior
NoMethodError
Steps to reproduce
See example above.
That would appear that you do not have the Capybara matchers installed correctly. Check what have_text
you're actually calling. Compounding is supported and tested - https://github.com/teamcapybara/capybara/blob/master/spec/rspec/shared_spec_matchers.rb#L500
@twalpole thanks for the answer and sorry for the faulty issue! Do you have any idea how I might "not have the Capybara matchers installed correctly"? Everything else from Capybara works fine for me. As you see from the error, have_text
seems to be Capybara::RSpecMatchers::Matchers::HaveText
which I think is correct. I'm using JRuby, could that be the problem? Any ideas on how to debug this are appreciated!