New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cy.wrap(element).should('contain', textWithBackslash) fails #19116
Comments
Sorry for the late reply. Confirmed that it doesn't work with the code below: it('t', () => {
const nastyString = '"<OE_D]dQ\\'
const tag = Cypress.$('<span />').text(nastyString).appendTo(document.body)
cy.wrap(tag).should('contain', nastyString) // fails here
}) |
1 task
cypress-bot
bot
added
stage: needs review
The PR code is done & tested, needs review
and removed
stage: ready for work
The issue is reproducible and in scope
labels
Mar 21, 2022
cypress-bot
bot
added
stage: pending release
and removed
stage: needs review
The PR code is done & tested, needs review
labels
Apr 26, 2022
The code for this is done in cypress-io/cypress#20704, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Current behavior
I have an email form input field which displays a (real-time) error message beneath if invalid input is detected, to the effect of:
"[value] is not a valid email"
I use Cypress to run a lot of simultaneous checks (i.e. make sure the form is disabled, there's an error indicator somewhere on the page, the text is red, etc, etc, etc). Somewhere along the way, Cypress also checks that the error message itself contains the input the user entered... and this is where it falls over.
I've provided the smallest sample code I could make which reproduced the problem consistently
The error stack trace is as follows:
NB: despite the appearance in the screenshot, there is definitely a backslash at the end of the problematic string. Cypress is also parsing error messages so this is why it's being hidden (see #18800 for how this affects other text formatting)
Desired behavior
Not encounter an error... and confirm whether the selected element contains the text or not
Test code to reproduce
Cypress Version
9.1.0
Other
Platform: Win 11
Node: 17.1 (nodeVersion: bundled - it'll crash otherwise, see #18914 )
The text was updated successfully, but these errors were encountered: