Cypress — Fast, Easy & Reliable Browser Testing
Cypress is a next-generation front-end testing tool built for the modern web. Runs in the same run-loop as your app for superior debuggability, with time-travel, automatic waiting, real-time reloads, and screenshots on failure.
Ready-to-run agent install
This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.
npx -y tokrepo@latest install 4fa5c7a2-3580-11f1-9bc6-00163e2b0d79 --target codexRun after dry-run confirms the install plan.
What it is
Cypress is a front-end testing framework built for modern web applications. Unlike Selenium-based tools that operate outside the browser, Cypress runs in the same event loop as your application. This architecture enables time-travel debugging, automatic waiting for elements and network requests, real-time reloads during test development, and automatic screenshots on failure.
Cypress targets front-end developers and QA engineers testing web applications. It supports end-to-end testing, component testing, and API testing with a unified API. The test runner provides a visual interface showing each test step alongside your running application.
How it saves time or tokens
Cypress eliminates the flakiness common in Selenium-based tests. Automatic waiting means you never write explicit sleep or waitFor calls. The time-travel feature lets you hover over each command in the test log to see the DOM state at that exact moment. Real-time reloads re-run tests as you save files. These features cut debugging time significantly compared to traditional E2E frameworks.
How to use
- Install Cypress as a dev dependency:
npm i -D cypress. - Open the interactive test runner with
npx cypress openor run headlessly withnpx cypress run. - Write test files in
cypress/e2e/using the Cypress API for visiting pages, selecting elements, and making assertions.
Example
// cypress/e2e/login.cy.ts
describe('Login', () => {
it('logs in with valid credentials', () => {
cy.visit('/login');
cy.get('[data-test=email]').type('user@example.com');
cy.get('[data-test=password]').type('secret123');
cy.get('[data-test=submit]').click();
cy.url().should('include', '/dashboard');
cy.contains('Welcome back').should('be.visible');
});
it('shows error for invalid password', () => {
cy.visit('/login');
cy.get('[data-test=email]').type('user@example.com');
cy.get('[data-test=password]').type('wrong');
cy.get('[data-test=submit]').click();
cy.contains('Invalid credentials').should('be.visible');
});
});
Related on TokRepo
- Testing AI Tools — Testing frameworks and automation tools
- Coding AI Tools — Developer productivity tools
Common pitfalls
- Cypress runs inside the browser and cannot test across multiple domains in a single test. If your flow involves OAuth redirects to a third-party domain, you need workarounds.
- Cypress tests are JavaScript/TypeScript only. If your team prefers Python or Java for test code, Cypress is not the right fit.
- The free tier of Cypress Cloud (formerly Dashboard) has limited parallelization. CI pipeline speed depends on how many parallel runners you configure.
Frequently Asked Questions
Cypress runs inside the browser event loop alongside your application, while Selenium operates externally via WebDriver. This gives Cypress automatic waiting, time-travel debugging, and consistent results. Selenium supports more browsers and languages but requires more setup and flake management.
Yes. Cypress supports both end-to-end testing and component testing. Component testing mounts individual React, Vue, Angular, or Svelte components in isolation and tests them with the same Cypress API used for E2E tests.
Cypress supports Chrome, Edge, Firefox, and Electron. Safari support is not available. Chrome-family browsers get the best support since Cypress uses the Chrome DevTools Protocol for advanced features.
Yes. Cypress provides cy.request() for making HTTP requests and asserting on responses. You can test API endpoints alongside UI tests or use cy.intercept() to mock API responses during E2E tests.
Run npx cypress run for headless execution. Cypress supports Docker images, GitHub Actions, GitLab CI, and all major CI platforms. Cypress Cloud provides parallel test execution and test recording for CI optimization.
Citations (3)
- Cypress GitHub— Cypress runs in the browser event loop alongside your application
- Cypress Documentation— Time-travel debugging, automatic waiting, and real-time reloads
- Cypress Official Site— Browser testing architecture and modern E2E testing approaches
Related on TokRepo
Discussion
Related Assets
Goss — Quick and Easy Server Validation and Testing
A YAML-based server testing tool that validates system state — packages, services, files, ports, and more — in seconds. Commonly used for infrastructure testing, health checks, and container validation in CI/CD pipelines.
wg-easy — Self-Hosted WireGuard VPN with Web Admin UI
Deploy a full WireGuard VPN server with an intuitive browser-based dashboard for managing clients, QR codes, and traffic stats.
Polars — Blazingly Fast DataFrame Library in Rust
Polars is an extremely fast DataFrame library written in Rust with bindings for Python, Node.js, and R. Uses Apache Arrow columnar format, lazy evaluation, and multi-threaded query execution. The modern alternative to pandas for data engineering and analytics.
egui — Easy-to-Use Immediate Mode GUI in Pure Rust That Runs Anywhere
egui is a pure-Rust immediate-mode GUI library that compiles to native, web (WASM), and embedded targets. The Rust ecosystem's answer to Dear ImGui — with a more modern API and first-class WASM support.