Cypress Tutorial Home / Video /

How to Handle Non-Cypress Async Promises using .then command? | Cypress Tutorial | Part V

How to Handle Non-Cypress Async Promises using .then command? | Cypress Tutorial | Part V

...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
  • What Is Cypress| LambdaTest
  • Learn Cypress in 3 Hours | Full Cypress Tutorial

About The Video

This video is a part of our Cypress Testing Tutorial series. In this video, Chris DeSilva (@desilvadev) explains how to manage Non-Cypress Async Promises. Also, you will get to know when to use the “.then” method in Cypress, which is built-in Cypress to explicitly handle Non Cypress Promises.

Video Chapters

00:00 Introduction of Non-Cypress Async Promises

00:44 Learning goals

03:07 Adding .then() to utilize Non Cypress Commands

09:40 Recap

10:41 Conclusion of Session

Key Topics Covered

Introduction to Cypress's Synchronous and Asynchronous Features: The video begins by recapping Cypress's handling of synchronous and asynchronous operations, emphasizing the difference between Cypress commands (which queue and execute in order) and non-Cypress commands (which do not follow the Cypress execution queue).

Handling Non-Cypress Async Promises: It delves into strategies for managing asynchronous promises in Cypress that are not inherently part of the Cypress command queue. This includes examples of using console logs and network requests that are executed outside of the Cypress command queue.

Using the .then() Method in Cypress: A significant portion of the video focuses on the .then() method provided by Cypress to handle non-Cypress promises. This method allows for the sequential execution of Cypress commands followed by non-Cypress commands, ensuring that asynchronous operations complete in the expected order.

Practical Examples and Demonstrations: The presenter provides practical coding examples to demonstrate how to use the .then() method to handle asynchronous operations, including logging and fetching data from an API (using the SpaceX API as an example).

Advanced Use Cases for .then() Method: Further exploration of the .then() method showcases its versatility in integrating non-Cypress asynchronous operations within the Cypress test workflow, such as making network requests after certain Cypress commands have executed.

Conclusion and Further Learning: The video concludes with a summary of the key points covered and a teaser for upcoming content focusing on building more complex tests with Cypress, including writing assertions to verify elements' presence, values, and properties.

Related Blogs & Hubs

Selenium vs Cypress – Which Is Better in 2021?

What is Cypress Test Automation Framework

How To Perform Cypress Testing At Scale With LambdaTest

How To Find Broken Links Using Cypress

More Videos from Cypress Tutorial