Cypress Tutorial Home / Video /

How To Handle Cypress Async Commands? Smart Hacks | Cypress TutorialšŸ‘Œ | Part IV

How To Handle Cypress Async Commands? Smart Hacks | Cypress TutorialšŸ‘Œ | Part IV

...Playlist

...
  • Introduction to Cypress Testing
  • Cypress GET and FIND Command Hacks
  • How to install Cypress Plugin & Set Environment Variables
  • How To Handle Cypress Async Commands
  • How to Handle Non-Cypress Async Promises using .then command?
  • How to use Assertion in Cypress?
  • How To Write Tests With Cypress UI Commands
  • What Are Cypress Hooks?
  • What Are Cypress Fixtures?
  • What Are Cypress Custom Commands?
  • What Are Cypress Mouse Commands?
  • What Are Cypress Actions? | GitHub Actions
  • Perform Cross Browser Testing on Cloud with Cypress & LambdaTest
  • Learn Cypress in 3 Hours | Full Cypress Tutorial

About The Video

This video showcases how the Cypress wrapper feature ensures test execution of its commands happens in the sequence therefore these commands are executed all at once; however, they are queued. The JavaScript command, when it works with a Cypress command, remains asynchronous.

Video Chapters

00:04 Async Cypress Introduction with Example

00:39 Promises in JavaScript

01:33 Cypress Async & Sync Nature

01:48 Learning Goals

02:09 Practical Implementation

11:44 Conclusion of Session

Key Topics Covered

Introduction to Asynchronous Programming: The video starts with an analogy to explain the concept of asynchronous programming, comparing it to doing laundry and waiting for the machine to signal when it's done. This analogy is used to introduce the concept of promises in programming, where a task is initiated, and the program can continue running other tasks while waiting for the promise to resolve.

Asynchronous Programming in JavaScript: It dives into how asynchronous programming works in JavaScript, especially with promises and how they allow other processes to run while waiting for a task to be completed. The concept of promises being fulfilled or rejected is discussed, along with the implications of these states.

Cypress and Asynchronous Programming: The video explains that Cypress tests run asynchronously and synchronously, and it's crucial to understand how to manage both types of operations when writing tests. The goal is to compare synchronous and asynchronous programming and understand their roles in Cypress testing.

Writing Cypress Tests: Several examples are provided to illustrate how to write Cypress tests that deal with both synchronous and asynchronous operations. The process includes setting up a project, writing tests that navigate to specific pages, interacting with elements (like typing into an email field), and waiting for actions to complete. The use of Cypress commands and their synchronous nature is highlighted, along with tips on handling asynchronous JavaScript operations within Cypress tests.

Debugging and Test Execution: The video demonstrates running Cypress tests, observing the output, and debugging issues related to asynchronous operations. It emphasizes the importance of understanding the order in which Cypress executes commands and how custom JavaScript code interacts with Cypress's asynchronous handling.

Conclusion and Further Learning: It wraps up with a discussion on the importance of mastering synchronous and asynchronous functions in Cypress tests. The presenter mentions resources for further learning, including the LambdaTest blog and community page, and teases future content focused on executing non-Cypress commands in JavaScript asynchronously for more predictable control over test execution.

Related Blogs & Hubs

Selenium vs Cypress ā€“ Which Is Better in 2021?

What is Cypress Test Automation Framework

How To Find Broken Links Using Cypress

......
...

TestĪ¼ 2024

Join the free online conference to decode the future of testing!

...21 - 23 August, 2024

More Videos from Cypress Tutorial