Cursor testing

E2E Tests Timing Out in Cursor-Generated Test Suites

End-to-end tests generated by Cursor using Playwright, Cypress, or Selenium time out during execution. Tests hang waiting for elements that never appear, pages that never load, or network requests that never complete. The tests work sometimes but fail intermittently, making your test suite unreliable and CI pipelines unpredictable.

E2E test flakiness is the number one reason teams abandon automated testing. Cursor generates tests that follow the happy path but don't account for the asynchronous, timing-dependent nature of real browser interactions. The AI writes selectors for elements that may not exist yet, clicks buttons before they're interactive, and asserts content that loads asynchronously.

The result is a test suite that passes locally (where the app is fast) but fails in CI (where resources are limited and the app is slower), or passes 80% of the time and fails randomly on the other 20%.

Error Messages You Might See

TimeoutError: Waiting for selector "button.submit" exceeded 30000ms TimeoutError: page.waitForNavigation: Timeout 30000ms exceeded Error: Element is not visible or not an HTMLElement CypressError: Timed out retrying after 4000ms: Expected to find element: '[data-cy=result]' Test timeout of 60000ms exceeded
TimeoutError: Waiting for selector "button.submit" exceeded 30000msTimeoutError: page.waitForNavigation: Timeout 30000ms exceededError: Element is not visible or not an HTMLElementCypressError: Timed out retrying after 4000ms: Expected to find element: '[data-cy=result]'Test timeout of 60000ms exceeded

Common Causes

  • Static waits instead of dynamic waits — Cursor uses await page.waitForTimeout(3000) instead of waiting for specific elements or conditions, which is both slow and unreliable
  • Fragile CSS selectors — Tests use selectors like .sc-bdfBwQ.iQNHGt (auto-generated class names) that change every build, or deeply nested selectors that break with minor DOM changes
  • Missing API/network wait — The test clicks a submit button and immediately checks for a success message, without waiting for the API request to complete
  • Element not interactable — The test tries to click an element that's rendered but covered by a modal, loading overlay, or tooltip
  • CI environment is slower — Tests assume fast load times from local development. CI runners have less CPU/memory, making everything slower and timing-dependent tests fail
  • Navigation not awaited — The test clicks a link that triggers navigation but checks for content before the new page loads

How to Fix It

  1. Use data-testid attributes — Add data-testid="submit-button" to important elements and select with page.getByTestId('submit-button'). These are stable across builds and style changes
  2. Wait for specific conditions, not time — Replace waitForTimeout with await page.waitForSelector('[data-testid="success-message"]') or Playwright's auto-waiting assertions like await expect(page.getByText('Success')).toBeVisible()
  3. Wait for network idle after actions — Use await page.waitForLoadState('networkidle') or await page.waitForResponse(url => url.includes('/api/submit')) after form submissions
  4. Increase default timeout for CI — Set timeout: 60000 in your Playwright/Cypress config for CI environments while keeping shorter timeouts locally
  5. Use Playwright's built-in auto-waiting — Playwright's click(), fill(), and expect() methods auto-wait for elements to be visible and interactive. Use these instead of manual waits
  6. Add retry logic for flaky assertions — Use Playwright's expect().toBeVisible({ timeout: 10000 }) or Cypress's built-in retry-ability to handle timing variations

Real developers can help you.

Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, open to work in various fields Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** Jared Hasson Jared Hasson Full time lead founding dev at a cyber security saas startup, with 10 yoe and a bachelor's in CS. Building & debugging software products is what I've spent my time on for forever Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software. ISHANTDEEP SINGH ISHANTDEEP SINGH Senior Software Engineer with 7+ years of experience in React, JavaScript, TypeScript, Next.js, and Node.js. I’ve also worked as a tech lead for startups, owning end-to-end technical execution including architecture, development, scaling, and delivery. I bring a strong mix of hands-on coding, product thinking, and technical leadership, and I’m comfortable building products from scratch as well as improving and scaling existing systems. Luca Liberati Luca Liberati I work on monoliths and microservices, backends and frontends, manage K8s clusters and love to design apps architecture Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Antriksh Narang Antriksh Narang 5 years+ Experienced Dev (Specially in Web Development), can help in python, javascript, react, next.js and full stack web dev technologies. Alvin Voo Alvin Voo I’ve watched the tech landscape evolve over the last decade—from the structured days of Java Server Pages to the current "wild west" of Agentic-driven development. While AI can "vibe" a frontend into existence, I specialize in the architecture that keeps it from collapsing. My expertise lies in the critical backend infrastructure: the parts that must be fast, secure, and scalable. I thrive on high-pressure environments, such as when I had only three weeks to architect and launch an Ethereum redemption system with minimal prior crypto knowledge, turning it into a major revenue stream. What I bring to your project: Forensic Debugging: I don't just "patch" bugs; I use tools like Datadog and Explain Analyzers to map out bottlenecks and resolve root causes—like significantly reducing memory usage by optimizing complex DB joins. Full-Stack Context: Deep experience in Node.js and React, ensuring backends play perfectly with mobile and web teams. Sanity in the Age of AI: I bridge the gap between "best practices" and modern speed, ensuring your project isn't just built fast, but built to last.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

How do I make E2E tests less flaky?

Three key practices: 1) Never use fixed timeouts (waitForTimeout), always wait for specific conditions. 2) Use stable selectors (data-testid) instead of CSS classes or XPath. 3) Wait for network requests to complete before asserting results. Also run tests in a consistent environment with controlled test data.

Should I run E2E tests in CI on every commit?

Run fast unit tests on every commit. Run E2E tests on pull requests and before deployments. E2E tests are slow and resource-intensive, so running them on every commit slows down the feedback loop. Use parallelization and test sharding to speed them up when you do run them.

Related Cursor Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help