-
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
I have problem when I am using Cypress Testing Library #19257
Comments
I fix it, by adding an index.js file in cypress/support/
|
Hi, even after adding the above file. still getting the same issue |
@np185092 I fixed the problem by adding the "import '@testing-library/cypress/add-commands' line to the cypress/support/command.ts " file |
ahmedelamine
|
With Cypress 10.8.0 I added "import "@testing-library/cypress/add-commands";" to cypress/support/e2e.ts which worked for me. |
I am having the same problem but I am using javascript, not typescript. Here is my set up: I have updated my project files as follows: /package.json: (updated after install)
My test contains:
I have restarted my terminal window and relaunched vs code. I still get the error: Does this work with JavaScript or only TypeScript? |
This was solved for me adding So the command.ts now looks like: /// <reference types="@testing-library/cypress" />
/// <reference types="cypress" />
import '@testing-library/cypress/add-commands' Thanks to testing-library/cypress-testing-library#227 (comment) |
Thanks, this worked for me |
Current behavior
TypeError:
cy.findByRole is not a function
Desired behavior
I am getting this error even I am using the cypress testing library as in the docs
I have added this line to project cypress/support/commands.js:
import
'@testing-library/cypress/add-commands';And in my test, I use it like this
then when I run the test I get this error
`TypeError: cy.findByRole is not a function
Test code to reproduce
Cypress Version
9.1.1
Other
No response
The text was updated successfully, but these errors were encountered: