I have a react app that I'm trying to test with Cypress using the badeball/cypress-cucumber-preprocessor and testing-library but I'm getting the error
cy.findByRole is not a function
Here's my current setup:
- react-scripts: 5.0.1
- typescript: 4.8.3
- cypress: 10.8.0
- @badeball/cypress-cucumber-preprocessor: 12.2.0
- @testing-library/cypress: 8.0.3
- node: 16.15.0
I have created a sample app that demonstrates the issue here
The e2e section of cypress.config.ts has two configurations that can be tested by commenting out one and leaving the other. The first (as it is currently configured) will attempt to run the test as a feature file and will fail. The second configuration uses a normal cypress test and will show that the testing-library function works correctly there.
The setupNodeEvents function in cypress.config.ts doesn't exactly follow the webpack/ts example found in the badeball/cypress-cucumber-preprocessor docs because that example doesn't play well with esModuleInterop being set to true which is used in other parts of my app so this configuration is my attempt to make that work. But I did test that example configuration and still couldn't get the testing-library functions to work.
I have the scripts setup so you can use nmp test to start cypress in e2e mode.
Any help is appreciated.