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-cyattributes forcy.getselectors so tests do not break when classes or copy change. - Chain
.should()directly after a query so Cypress retries both together; avoidcy.wait(ms)with fixed delays. - Use
.as("name")to alias elements, routes or fixtures, then reference them as@nameto keep tests readable and avoid re-querying. cy.fixture("user.json")loads test data fromcypress/fixturesand pairs withcy.intercept(url, { fixture: "user.json" })to stub responses.