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.

test

Milly
Vienna, Austria

Intermediate

test

Milly
Vienna, Austria

Intermediate

Featured Partners

Related Articles

View all articles
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
LM
Luis Minvielle
10 Developer Websites in 2023
As a web developer, you're always investigating how to level up your skills and streamline your workflow. That's why we've gathered a collection of 10 innovative tools that are guaranteed to boost your productivity, enhance your coding abilities, ele...
10 Developer Websites in 2023

From learning to earning

Jobs that call for the skills explored in this talk.