Cypress is a JavaScript-based end-to-end testing framework built specifically for modern web applications. Unlike traditional testing tools that run outside the browser, Cypress executes in the same run-loop as your application, enabling automatic waiting, real-time reloading, and time-travel debugging. The Cypress platform now extends beyond the open-source App into Cypress Cloud β offering Test Replay, Flake Detection, Smart Orchestration, Cypress Accessibility, UI Coverage, and AI-powered features including Studio AI, cy.prompt(), and Cloud MCP for AI coding assistants. The framework supports E2E testing, component testing for React, Vue, Angular, and Svelte, and API testing, making it a comprehensive solution for validating modern web applications at every layer.
What This Cheat Sheet Covers
This topic spans 24 focused tables and 188 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Core Navigation and Query Commands
| Command | Example | Description |
|---|---|---|
cy.visit('/login') | β’ Loads the specified URL in the test browser β’ accepts relative or absolute paths and waits for page load events. | |
cy.get('[data-cy="submit-btn"]') | β’ Queries DOM elements using CSS or jQuery selectors β’ automatically retries until elements appear or timeout. | |
cy.contains('button', 'Submit') | β’ Finds element of specific type containing text β’ more precise when both element type and text are provided. | |
cy.get('.form').find('input') | β’ Searches for descendant elements within previously queried parent β’ similar to jQuery's .find(). | |
cy.get('form').within(() => { cy.get('input').type('text')}) | β’ Scopes all subsequent commands within a parent element β’ useful for form contexts or component isolation. | |
cy.get('li').eq(2) | β’ Selects element at specific index from matched set β’ zero-based indexing. | |
cy.get('li').first() | Returns the first element from a matched set. | |
cy.get('li').last() | Returns the last element from a matched set. |