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.
Name of

Name of

Remote
Intermediate
PHP
Java
+1

Featured Partners

Related Articles

View all articles
SD
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
EM
Eli McGarvie
13 AI Tools You Have to Try
First, it was NFTs, then it was Web3, and now it’s generative AI… it’s probably time to stop collecting pictures of monkeys and kitties. Chatbots and generative AI are the next big thing. This time we’ve jumped on a trend that has real-world applicat...
13 AI Tools You Have to Try

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