@[email protected]

Testing Components with Cypress

by Rob Richardson

  @[email protected]

https://robrich.org/

About Me

Rob Richardson

Rob Richardson is a software craftsman building web properties in ASP.NET and Node, React and Vue. He's a frequent speaker at conferences, user groups, and community events, and a diligent teacher and student of high quality software development. You can find this and other talks on https://robrich.org/presentations and follow him on Mastodon at @[email protected].

Cypress Component Testing

You already know how to do this!

cy.page(url)
becomes
cy.mount(Component)

Testing

Demo

Cypress Component Testing!

github.com/robrich/web-test-all-the-things

Mocking

Transitioning into Component Tests

Comparing Cypress
Component Testing
to similar tools

Comparing to Test Utils

Browser-based runners, like Cypress, can catch issues that node-based runners, like Vitest, cannot (e.g. style issues, real native DOM events, cookies, local storage, and network failures), but browser-based runners are orders of magnitude slower than Vitest because they do open a browser, compile your stylesheets, and more.

vuejs.org/guide/scaling-up/testing#recommendation-1