-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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.contains('xxx').should('not.exist') try to expect <body> not to exist in the DOM #14861
Comments
I ran into this on my Next app, found that To fix, as a work around, i can no longer rely on suggestion solution would be to exclude |
By default, cy.contains('xxx').should('match', 'body'); You might ask, "can't we just ban the Maybe adding |
We have exactly the same issue. We are moving from react to nextjs et our cypress tests are broken because of this. We are using the workaround, but is there something else planned for this? :) Thank youuu |
@sainthkh do you know what "icebox" mean? :D |
@Nikoms It means this work is not prioritized for the Cypress team to work on. |
The code for this is done in cypress-io/cypress#17477, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
I try to test input validation by cypress
When user enter page first time, user should not see the error message
So I write test like this
cy.contains('forgot_password_error_email_empty').should('not.exist');
but it seems that command try to expect body not to exist in the DOM so it fails in the end
When I reproduced my problem, I found this bug is related to
next-i18n
and only occur innext production build
If I have translation key
test
(public/static/locales/en)cy.contains('test').should('not.exist')
will check body exist or notIf I write cy.contains with selector
cy.contains('span', 'test').should('not.exist')
, the test will pass.But I think this is not the good solution.
Desired behavior
cy.contains should not check the body
Test code to reproduce
clone this project (https://github.com/aNyMoRe0505/next-cypress)
npm install => npm run build => npm run start
then npm run cypress:open to execute test
if you run in dev mode (npm run dev) everything works fine.
Versions
"cypress": "^6.3.0"
The text was updated successfully, but these errors were encountered: