Sebastian Clavijo Suero
1 min readMay 7, 2024

--

Really good blog post with a lot of useful information!

In my experience, I think two of the main causes of flaky tests in Cypress (if not the most) are the use of cy.wait() with a specific amount of time (that you address in this post), and not guaranteeing test independence (so the tests can be run in any order without affecting to each other).

I released a blog post specifically addressing the cy.wait(TIME) issues, with a set of alternatives to use instead, depending on your specific use cases: https://dev.to/sebastianclavijo/the-most-abused-cypress-command-ever-cywaittime-15e0.

Regarding test independence, one reason I found that causes quite a number of flaky tests (even incorrect tests that might not discover security vulnerabilities) is when fixtures imported from a file are mutated by other tests unnoticed. I published another blog post addressing this issue and how you can avoid it: https://dev.to/sebastianclavijo/what-do-the-number-ph-phi-a-cheese-pizza-pie-and-a-cypress-fixture-have-in-common-3c3c

As I said, great blog!

--

--