Cypress E2E Test Generator
Generate cypress/e2e/*.cy.ts boilerplate instantly.
Pick your test type, enter your selectors, and get complete TypeScript test code with
cy.visit, cy.get,
cy.intercept, and proper assertions — ready to copy and run.
Frequently Asked Questions
What is Cypress and when should I use it?▼
Cypress is an end-to-end (E2E) testing framework that runs tests directly in the browser, giving you real interaction with your UI just like a real user. Use it when you need to test complete user flows — login, form submission, navigation, API interactions — from the browser's perspective. Unlike unit tests, Cypress catches integration bugs that only appear when components interact with real DOM and network requests.
What is the difference between cy.get() and cy.contains()?▼
cy.get() selects elements by CSS selector (e.g. '[data-testid="btn"]', '.submit', '#email'). cy.contains() finds elements by their text content, making it useful for asserting that specific text appears on the page. Use cy.get() for targeting specific interactive elements, and cy.contains() for verifying text outcomes like success messages or navigation labels.
What are data-testid attributes and why use them?▼
data-testid attributes (e.g. data-testid="submit-btn") are custom HTML attributes added specifically to target elements in tests. They're preferred over CSS classes or IDs because they decouple your tests from styling decisions — renaming a class won't break your tests. Add them to your React/Vue/HTML elements: <button data-testid="submit-btn">. Then select with cy.get('[data-testid="submit-btn"]').
How does cy.intercept() work for API testing?▼
cy.intercept() intercepts network requests made by your app. You can observe them (cy.wait('@alias') to confirm they fired and check request/response details) or mock them (by providing a fixture or inline response body). This lets you test how your UI reacts to specific API responses — including errors — without hitting a real backend. Always call cy.intercept() before the action that triggers the request.
How do I run Cypress in CI/CD?▼
Use npx cypress run (headless mode) in your CI pipeline. Add it to your GitHub Actions, GitLab CI, or CircleCI config. The Cypress Dashboard service records test results, screenshots, and videos. For parallel runs: npx cypress run --record --parallel. Set your CYPRESS_baseUrl environment variable to your staging URL so cy.visit('/path') resolves correctly.
How do I handle flaky tests in Cypress?▼
Flaky tests usually stem from timing issues. Avoid cy.wait(1000) (arbitrary waits). Instead: wait for elements to appear (cy.get('.el').should('be.visible')), wait for network requests (cy.wait('@alias')), or use cy.intercept() to stub slow APIs. Cypress automatically retries queries until they pass or time out. For persistent flakiness, check if your app has race conditions or inconsistent async behavior.
Related Products
on GumroadTypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →DevToolkit Starter Kit
A ready-to-deploy developer tools website with 12 built-in tools. Astro + Preact + Tailwind. Deploy to Cloudflare Pages for free. Built-in SEO, dark mode, and ad-ready layout.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
Cypress Frontend Testing Guide
Complete Cypress testing guide for E2E and component testing. Learn cy.visit, cy.get, cy.intercept, custom commands, component testing, and time-travel debugging.
Open free tool →
JS Prototype Chain Visualizer
Explore JavaScript prototype chains interactively. Visualize built-in types (Array, Map, Promise, Error) and custom classes with property lookup path diagrams.
Open free tool →
Jest Testing Framework Guide
Complete guide to Jest JavaScript testing framework. Learn describe/it/expect, mocking, snapshot testing, async tests, coverage, and best practices for unit and integration testing.
Open free tool →
More Free Tools
Related Articles
End-to-End Testing in 2026: Writing Tests That Don't Lie
E2E testing guide 2026: choose Playwright or Cypress, eliminate flakiness, structure test suites for CI/CD, and understand real application quality limits.
Playwright vs Cypress vs Puppeteer 2026: Which Testing Tool Should You Choose?
Playwright vs Cypress vs Puppeteer 2026 — compare feature sets, performance, developer experience, parallel testing, CI costs, and browser support. Find the right E2E testing tool for your stack.
Playwright vs Cypress vs Puppeteer: E2E Testing in 2026
Comprehensive comparison of Playwright, Cypress, and Puppeteer for end-to-end testing in 2026. Speed, API design, CI/CD integration, cross-browser support, and when to choose each tool.
Playwright vs Cypress vs Selenium: E2E Testing Framework Comparison 2026
Compare Playwright, Cypress, and Selenium for end-to-end testing. Speed, browser support, DX, CI integration, and which framework to choose in 2026.
Playwright vs Selenium 2026: Which Should You Choose?
Complete comparison of Playwright and Selenium for browser automation and end-to-end testing in 2026. Performance benchmarks, API differences, migration guide, and when to use each.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →