Cypress Commands Reference

All Cypress cy.* commands with argument types, subject chaining and aliases.

Searchable Cypress cy.* command reference covering querying, actions, assertions, network interception, cookies, fixtures and aliases — with which yield a chainable subject.

What is the chained subject?

Most commands yield a subject (a DOM element, response or value) to the next command in the chain. cy.get yields elements, .its yields a property, and .then gives you the raw subject to work with imperatively.

Look up Cypress commands without the docs tab

Cypress drives the browser through chained cy.* commands that yield subjects to one another. This reference lists the common commands grouped by querying, actions, assertions, network and utilities, noting their arguments and whether they yield a chainable subject. It runs entirely in your browser.

How it works

A test reads as a chain: a query yields elements, actions operate on them, and .should() asserts with retry. Commands are asynchronous and enqueued, not run immediately, so you chain rather than store return values. cy.intercept aliased with .as() lets you wait on network calls:

cy.intercept("POST", "/api/login").as("login");
cy.get('[data-cy="email"]').type("[email protected]");
cy.get('[data-cy="submit"]').click();
cy.wait("@login").its("response.statusCode").should("eq", 200);
cy.contains("Welcome").should("be.visible");

Tips and examples

  • Prefer dedicated data-cy attributes for cy.get selectors so tests do not break when classes or copy change.
  • Chain .should() directly after a query so Cypress retries both together; avoid cy.wait(ms) with fixed delays.
  • Use .as("name") to alias elements, routes or fixtures, then reference them as @name to keep tests readable and avoid re-querying.
  • cy.fixture("user.json") loads test data from cypress/fixtures and pairs with cy.intercept(url, { fixture: "user.json" }) to stub responses.