Created by Gleb Bahmutov gleb.dev Let’s take a look at a basic test that adds a todo item and checks the number of todo items. Even a simple test can illuminate the major differences between the two test runners. The test can assume that it starts with zero items
Let’s start with Playwright solution, and we are going to use full website URL for now. Here is the finished test running in Playwright UI mode (we will look at the test runner modes later) Playwright tests follow a simple formula:
We will simplify the locators in the future days of this calendar. Meanwhile, let’s look at the Cypress solution to this test. The test passes, here is a screenshot from Cypress interactive mode You can see how the declarative syntax of Cypress differs from imperative Playwright syntax. A typical Cypress test simply “declares” what commands to run and what is expected from the web application page:
This advent calendar is based on my online course “Cypress vs Playwright“ and open-source workshop bahmutov/cypress-workshop-cy-vs-pw. You can find links to the previous advent calendar days in my blog post “Cypress vs Playwright Advent Calendar 2025“. For more Cypress testing knowledge, visit cypress.tips today If you liked this post from Cypress Tips Advent Calendar 2021, why not share it? |