lecture 8 of 200 completed

How Cypress actually runs

Why cy commands are not promises, what the command queue is, and why you chain instead of using await.

What you'll learn

  • Why cy commands do not behave like ordinary JavaScript
  • What the command queue is, and why you chain instead of await
  • The two beginner mistakes that come from ignoring it
  • Why a try and catch cannot catch a command, and where a catch does hide a failure

You have now written tests that find elements, click them, and check the result. Everything worked, but one thing about the code was never explained: Cypress does not run your commands the way ordinary JavaScript runs.

That difference explains several things you may have already wondered about, and it is where a common beginner mistake comes from.

Here is the surprise. This code looks like it finds an element:

full course

Keep reading with the full course

The Foundations track and the first lessons in each framework are free. This lesson needs full course access. A course plan includes all lessons for Playwright, Cypress and Selenium.

See course plans →