-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
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 in next production build
If I have translation key test
(public/static/locales/en) cy.contains('test').should('not.exist')
will check body exist or not
If 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"