-
Notifications
You must be signed in to change notification settings - Fork 154
CypressError: cy.findByText() failed because it requires the subject be a global 'document' object. #114
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
Comments
Thanks for the detailed issue. I'll look into this. The logic should be trying the previous subject first (in your case, the element containing "Log me in"). If the Something about that fallback doesn't seem to be working in your case and I'll look into why. My best guess is this error is coming from Cypress and not the logic of this command. The command is registered to receive no subject, an element, the document or window. It seems to be receiving something other than those types and Cypress is throwing that error. |
I don't have quick access to an environment to test my theory. If you can manually edit the |
It works |
If you have time, feel free to open a pull request with that change. A test that verifies the existing failure and changed code passing, that be great. If not, we can get to it on Monday. |
WIP |
* test: chain commands with subject different of document, element or window * fix: set previous subject to be optional This allows to commands to be chained with a previous command that not returns a document, element or window FIX #114
🎉 This issue has been resolved in version 5.2.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
cypress-testing-library
version: 5.2.0node
version: 13.7.0npm
(oryarn
) version: 6.13.6Relevant code or config
What you did: Bump @testing-library/cypress from 5.0.2 to 5.2.0
What happened:
https://github.com/leosuncin/mui-next-ts/pull/26/checks?check_run_id=421662750
Reproduction repository:
https://github.com/leosuncin/mui-next-ts/tree/dependabot/npm_and_yarn/testing-library/cypress-5.2.0
Problem description:
Suggested solution:
The text was updated successfully, but these errors were encountered: