Open NicMcPhee opened 2 years ago
I think this is a duplicate issue: #649
Actually, I think these are quite different. What I was concerned about is tests that expect specific words/text to be returned. In #874, for example, we had a test that checked explicitly for the text Added User ${user.name}
. That then breaks if you do something like change the case of User
to user
, which isn't awesome. I think there are quite a few instances of this in our tests and we could probably make that better.
I'm pretty sure the #649 is a timing issue, and thus unrelated to this.
As Nic pointed out, the linked blog post specifically about the "detached elements in the DOM" problem explains some things to try. One thing I noticed we do have is some fragile chaining where we try to continue after clicking on something, but click is not safe to chain off of. Also, some of the fixes that I noticed do things like wait until there are more than 0 elements... if you know there will be 2, you should probably just say 2. cy.get waits until the state you are waiting for exists (or until it times out), so putting exactly what you're waiting for in there makes sense.
The way the tests broke in #874 when I changed the case of what's arguably an inconsequential word suggests that at least some of our Cypress tests are overly fragile and we should probably fix that.