Hackernoon logo5 Cypress E2E Testing Mistakes to Avoid by@webiny

5 Cypress E2E Testing Mistakes to Avoid

Using id and class for selecting element is problematic because they are primarily for behavior and styling purposes, due to which they are subject to change frequently. Instead of using id or class to target this element for test, use data-testid. Using arbitrary values in the cy.wait command is dangerous because it mimics the behavior of a real user in real-world scenarios. When using a clause like Promise.all with Cypress command, it might not work as you expect because Cypress commands are like Promise, but not real Promise.
image
Webiny Serverless Framework Hacker Noon profile picture

Webiny Serverless Framework

#OpenSource #React #NodeJs #GraphQL #Headless #Serverless

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.