cy.contains() argument matchCase defaults to true.
cy.contains() argument matchCase defaults to false and can be set to true for case-sensitive matching.
As already stated by @jennifer-shehane in this issue, I find it quite annoying to have to change my tests cy.contains()s whenever I change capitalization and would generally prefer case-insensitive matching as for me, that would be closer to the easy way of creating tests Cypress is always promoting.
Cypress 4.0.2
Chromium, Manjaro Linux
I would recommend just overwriting the .contains command, so that every time you use it it has matchCase set to false.
Cypress.Commands.overwrite('contains', (originalFn, subject, filter, text, options = {}) => {
// determine if a filter argument was passed
if (typeof text === 'object') {
options = text
text = filter
filter = undefined
}
options.matchCase = false
return originalFn(subject, filter, text, options)
})
We didn't want to make a massive breaking change for everyone (which this would have been) in 4.0 when we released this.
Adding this feature is not something we see as within our scope of feature work, so we will be closing this issue. We will reconsider and reopen if we see this issue gains more 馃憤 or comments in support.
Most helpful comment
I would recommend just overwriting the
.containscommand, so that every time you use it it hasmatchCaseset tofalse.We didn't want to make a massive breaking change for everyone (which this would have been) in 4.0 when we released this.
Adding this feature is not something we see as within our scope of feature work, so we will be closing this issue. We will reconsider and reopen if we see this issue gains more 馃憤 or comments in support.