Cypress
In one line
Cypress is an E2E testing tool known for its excellent developer experience, time-travel debugging, and in-browser execution.
In simple words
Cypress is a popular end-to-end testing framework known for its exceptional developer experience. It runs directly in the browser alongside your application, which gives it unique capabilities.
Key features:
- Time-travel debugging: take 'snapshots' at each step and hover to see the app state at any point
- Real-time reloads: tests reload instantly as you edit
- In-browser execution: runs in the same loop as your app, with direct DOM access
- Automatic waiting: waits for elements and actions automatically
- Screenshot/video recording: captures visual evidence of test runs
Cypress is great for beginners because of its friendly API and visual feedback. Limitations include: primarily Chromium-based (limited Firefox/WebKit support), single-tab testing, and some advanced features require a paid plan.
Example
// login.cy.js — Cypress E2E test
describe('Login', () => {
it('logs in successfully', () => {
cy.visit('/login');
cy.get('#username').type('alice');
cy.get('#password').type('secret123');
cy.get('button[type="submit"]').click();
cy.url().should('include', '/dashboard');
cy.get('h1').should('contain', 'Welcome, Alice');
});
});
// Run: npx cypress run
// ✓ 1 Login "logs in successfully"Cypress runs in the browser alongside your app: cy.visit navigates, cy.get/type/click interact with elements, and .should() chains assertions. It provides a visual test runner for debugging.
Related terms
Related Resources
Related Lessons
- E2E Testing
End-to-end testing overview.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.