Approaching testing at a component level definitely has its benefits. Seeing your components rendered in isolation and making sure it behaves correctly with different properties is definitely faster than trying to interact with an app at an end-to-end level. Besides, it renders each component in the browser as the user would see it, and that allows you to debug components using your dev tools.
With Cypress’ component testing, you can now take the best of both worlds. Render components and interact with them in a real browser. You can pass different properties, spy on its function calls, click and type into them or even intercept its network calls. All this with a minimal setup and vast options.
What you'll learn
- setup component testing in Cypress
- customize component mounting properties
- render a component in a browser
- examine a component with different passed properties
- make assertions on component’s emitted events
- render a component with content passed into its
- catch edge cases by calling actions and passing values into Pinia’s state
- handle router and its effect component behavior