Cypress – way to make contains() work in case-insensitive way

cypress

I have a project that doesn't capitalize on level of HTML and values in HTML have inconsistent capitalization.

Is there any way how to force Cypress to match text if I use only lower-case strings as arguments to contains() function?

Best Answer

As of 4.0.0, Cypress offers matchCase option with contains...

cy.get('div').contains('capital sentence', { matchCase: false })

Related Topic