beforeEach - (uncaught exception)
pedrogomes97 opened this issue · comments
Current behavior
The beforeEach hook contains actions to login to a product and it works correctly
But for some reason when starting a the second test, it fails with the error:
(uncaught exception)TypeError: Cannot read properties of undefined (reading 'createRange')
Even if you don't put any command (or just a cy.log) inside the beforeEach() and pass the login inside the it() of the 2 tests, the error happens in the beforeEach when starting the second test.
If I remove the beforeEach() the tests pass. I could remove the beforeEach() hook, but this is not a solution. The command exists to avoid code replication.
I tried adding cy.wait(100) at the end of the first test and it works every time. So I can conclude that the beforeEach problem must be related to some dependency of the previous test, which should not happen.
I have tests with beforeEach working correctly, only this one fails with this constant error, although I have already managed to reproduce it in other scenarios.
Desired behavior
It would be expected that beforeEach works correctly and does not need to replicate the login in all tests.
Test code to reproduce
This scenario is only reproduceable on our company test solution, so I can't share a reproduceable scenario, but I can schedule a call to be reviewed if you want so.
Cypress Version
12.3.0
Node version
v16.19.0
Operating System
Windows 10
Debug Logs
VM1511 polyfills.2269035e20e0ae82cc9c.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'createRange')
at p (VM1605 tinymce.min.js:9:229210)
at Object.getNode (VM1605 tinymce.min.js:9:231820)
at o (VM1605 tinymce.min.js:9:150805)
at VM1605 tinymce.min.js:9:151838
at VM1605 tinymce.min.js:9:35351
at m.<computed> (VM1511 polyfills.2269035e20e0ae82cc9c.js:1:41149)
at v.invokeTask (VM1511 polyfills.2269035e20e0ae82cc9c.js:1:8279)
at v.runTask (VM1511 polyfills.2269035e20e0ae82cc9c.js:1:3337)
at v.invokeTask (VM1511 polyfills.2269035e20e0ae82cc9c.js:1:9413)
at invoke (VM1511 polyfills.2269035e20e0ae82cc9c.js:1:9304)
Other
No response
Hi @pedrogomes97 , I'm sorry to hear you are having issues running Cypress. Unfortunately we will not be able to dig deeper into this issue without a reproducible example. Is it possible to create an example using a fork of https://github.com/cypress-io/cypress-test-tiny which points to externally facing resources? An example spec file would be very helpful. Screenshots of the code are difficult to work with for our engineers.