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.

Featured Partners

Related Articles

View all articles
Eli McGarvie, Helena Ivanova, Melisa Brankovic, Sabina Dapo
test
test test test
test
Sabina Dapo
New Test
The basic purpose of narrative is to entertain, to gain and hold readers’ interest. However narratives can also be written to teach or inform, to change attitudes / social opinions e.g. soap operas and television dramas that are used to raise topical...
New Test

From learning to earning

Jobs that call for the skills explored in this talk.

Senior QA Engineer

CheckYeti
Vienna, Austria

Senior
Selenium
JavaScript
Manual Testing
Automated Testing