Luca Micieli

Advanced Cypress: custom assertions and tasks

Bypass slow and flaky UI interactions in your Cypress tests. Use tasks to directly seed your database, read files, and even handle complex OAuth authentication flows.

Advanced Cypress: custom assertions and tasks
#1about 2 minutes

Understanding the Cypress architecture and tasks

Cypress runs in two processes, and tasks act as remote procedure calls to execute Node.js code from within the browser-based test environment.

#2about 3 minutes

Using tasks for database seeding and auth flows

Tasks enable complex test setups like seeding a database, accessing the file system for email links, or controlling a separate window for OAuth authentication.

#3about 2 minutes

Creating type-safe custom assertions with Chai

Extend the Chai assertion library to create custom assertions and use TypeScript declaration merging to provide type safety for your new commands.

#4about 2 minutes

Applying custom assertions for robust UI tests

Use custom assertions to handle dynamic content like translated text or localized dates, making tests more resilient to content changes.

Related jobs
Jobs that call for the skills explored in this talk.

Angular Developer

Picnic Technologies B.V.
Amsterdam, Netherlands

Intermediate
Senior

Featured Partners

From learning to earning

Jobs that call for the skills explored in this talk.