I'm using Poltergeist / Capybara for my tests:
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, {
timeout: 60,
phantomjs_options: ['--load-images=no'],
case_insensitive: true # <-- doesn't work
})
end
end
but I noticed that I have to rewrite a lot of tests, as Poltergeists driver seems to be case-sensitive. Is there anything I can pass to change this?
As @eugen mentions all searches in capybara are case sensitive by default. The problem you mention of having to rewrite tests usually occurs when moving from a driver that does/does-not support css text-transform to one that does-not/does - so the text being matched is or is not having the css text-transform (uppercase/lowercase/capitalize/...) applied. If you want to be able to swap back and forth between drivers and really need case insensitivity you can pass regexes to the different matchers
expect(page).to have_text(/case insensitive text/i)
expect(page).to have_selector(:css, '#div1', text: /case insensitive text/i)
All searches in capybara are case sensitive, there is no global option to change that. If you need to do case insensitive matching, you'll have to do it on a search by search basis.
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