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

Related Articles

View all articles
DC
Daniel Cranney
Exploring TypeScript: Benefits for Large-Scale JavaScript Projects
JavaScript is the backbone of web development, powering everything from small websites to large-scale enterprise applications. However, as projects grow in complexity, maintaining JavaScript code can become increasingly difficult. This is where TypeS...
Exploring TypeScript: Benefits for Large-Scale JavaScript Projects
DC
Daniel Cranney
Dev Digest 190: GitHub A11Y action, >12s Sora 2 videos and 42 CSS units!
Inside last week’s Dev Digest 190 . 🙅 Developers don’t trust AI, and that’s a good thing 🤖 Why everyone is talking about AI agents 🔓 Autonomous AI hacking and the future of cyber security 😨 Windows 10 support ends, millions of PC’s fall off a securi...
Dev Digest 190: GitHub A11Y action, >12s Sora 2 videos and 42 CSS units!

From learning to earning

Jobs that call for the skills explored in this talk.