I’ve asked several fellow QA engineers about the most common pitfall or error they see when writing Cypress tests (I also asked GPT-4 just for fun). All of them coincide in an answer that can be condensed in this sentence:
“One of the most common pitfalls or errors, if not the most, made by QA Automation engineers when writing tests in Cypress is not understanding or not correctly handling asynchronous behavior in their tests. Cypress commands are asynchronous, but they look synchronous, leading to confusion. This can result in timing issues or flaky tests, where tests may pass or fail inconsistently.”
These mishandlings can occur because of multiple reasons like not waiting for elements to appear, interacting with network requests incorrectly, relying on inconsistent timing, chaining commands incorrectly, etc.
To address most, if not all, these issues, I wrote a blog article a few months ago called “The most abused Cypress command ever: cy.wait(TIME)”.
I believe it’s worth a read, and can help to build a solid toolkit to handle “the most common issue in Cypress history”.
Cheers