score:2

Accepted answer

With some help from the cypress community, it seems as though the react-testing-library is adding the after each hook for clean up.

https://github.com/testing-library/react-testing-library/blob/master/src/index.js

This is an async method which results in cypress giving a warning :

cypress_runner.js:85235 Cypress Warning: Cypress detected that you returned a promise in a test, but also invoked one or more cy commands inside of that promise.

I was able to prevent this addition of the afterEach and get the tests working. We can use any one of the methods given here to achieve this.


Related Query

More Query from same tag