DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk6 min

How to Debug Cypress Tests: Find the First Failure and Fix It

Find the first meaningful Cypress failure, inspect the right browser state, and narrow flaky or CI-only behavior with a repeatable debugging workflow.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start with the earliest failed Cypress command, not the last error in the report. Read its message and stack trace, inspect the command’s subject and the application state at that moment, then reproduce the failure while changing one condition at a time. This sequence helps distinguish a real application or test defect from timing, browser, and CI differences.

1. Read the earliest failure

Open the first failed command in the test’s Command Log and examine the error type, message, code frame, and stack trace. Cypress errors may include a “Learn more” link. The highlighted source location can point to the failing assertion or action, while the stack trace helps trace how execution reached it. Avoid beginning with a later failure: it may be a consequence of the first one.

As an Amazon Associate I earn from qualifying purchases.

With browser DevTools open, click a command in the Command Log to print its subject and yielded result. Compare what Cypress expected with what the application actually produced. See Cypress’s Debugging in Cypress guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Inspect the state when the command runs

Cypress queues commands inside the test callback and executes them after the callback has enqueued them. That means a bare debugger written after Cypress commands may pause after those commands have already completed, rather than at the state you intended to inspect.

#1 Best Overall
Sale
Amazon Basics Wired QWERTY Keyboard, Works with Windows, Plug and Play, Easy to Use with Media Control, Full-Sized, Black
  • KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
  • EASY SETUP: Experience simple installation with the USB wired connection
  • VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
  • SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
  • FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.

Pause after a query with .then()

Put the breakpoint inside a callback after the query whose result you need to inspect:

cy.get('[data-testid="save-button"]').then(($button) => {
  debugger
  // Inspect $button and the current page in DevTools.
})

Execution pauses when the callback runs, with the queried element available as $button.

Inspect the current subject with .debug()

cy.get('[data-testid="save-button"]').debug().click()

The .debug() command exposes the current subject as subject in DevTools. It is useful when you want to inspect a chain without adding a separate callback.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Logitech MK270 Full Size Wireless Keyboard and Mouse Combo - Black
  • Reliable Plug and Play: The USB receiver provides a reliable wireless connection up to 33 ft (1), so you can forget about drop-outs and delays and you can take it wherever you use your computer
  • Type in Comfort: The design of this keyboard creates a comfortable typing experience thanks to the low-profile, quiet keys and standard layout with full-size F-keys, number pad, and arrow keys
  • Durable and Resilient: This full-size wireless keyboard features a spill-resistant design (2), durable keys and sturdy tilt legs with adjustable height
  • Long Battery Life: MK270 combo features a 36-month keyboard and 12-month mouse battery life (3), along with on/off switches allowing you to go months without the hassle of changing batteries
  • Easy to Use: This wireless keyboard and mouse combo features 8 multimedia hotkeys for instant access to the Internet, email, play/pause, and volume so you can easily check out your favorite sites

Step through commands with cy.pause()

Add cy.pause() at the point where you want to stop. In open mode, step through commands and inspect the DOM, network activity, or browser storage as the test proceeds. The Command Log also keeps command and hook history; in open mode, its snapshots let you travel back to earlier application states. Those earlier snapshots can reveal when a selector, response, or UI transition stopped matching expectations. See Open mode in the Cypress app.

3. Decide whether the test needs to wait or has actually failed

Cypress retry-ability and test retries address different problems. Queries and assertions retry while the application changes, giving the UI time to reach the state being asserted. Configured test retries rerun the entire failed test for a limited number of additional attempts. A passing retry is a flake signal to investigate, not evidence that the underlying issue is fixed.

Each test retry reruns beforeEach and afterEach. Failures in before and after hooks do not trigger a retry. Use Cypress’s guides to check the distinction between Retry-ability in Cypress and Test retries in Cypress.

Rank #3
Sale
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
  • All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
  • Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
  • Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
  • Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
  • Plastic parts in K120 include 51% certified post-consumer recycled plastic*
  • If a query or assertion fails while the page is still loading or updating, check that the test is asserting the intended state and that the application has a reliable signal for reaching it.
  • If a whole-test retry passes, compare the first attempt with the retry: the difference may expose unstable test data, state setup, timing, or an environment dependency.
  • Do not treat a retry as a substitute for understanding why the first attempt failed.

4. Reduce the failure to a small reproduction

Try to make the failing test the smallest one that still reproduces the problem. Review any available screenshot, video, or replay, then split up a long test or spec if doing so helps isolate the failing behavior. Compare browsers and environments while keeping the application build, test data, and relevant configuration fixed where possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Change one comparison axis at a time:

  • Local machine versus CI.
  • Headed versus headless execution.
  • Browser family or version.
  • Isolated test versus full spec.
  • First attempt versus retry.

This makes it easier to tell whether the cause follows the test, application timing, browser, or environment. Cypress’s troubleshooting guide recommends reducing the problem and comparing environments to isolate failures.

5. Investigate headless-only failures

When a test fails in headless CI but passes locally, run it locally in a visible browser to inspect the commands and final page state. For Chrome, Cypress documents this example:

Rank #4
Sale
Redragon K521 Upgrade Rainbow LED Gaming Keyboard, 104 Keys Wired Mechanical Feeling Keyboard with Multimedia Keys, One-Touch Backlit, Anti-Ghosting, Compatible with PC, Mac, PS4/5, Xbox
  • 【Dreamy Rainbow Gaming Keyboard】K521 Gaming Keyboard Adopts a Different LED Backlight Design, Upgraded on the Traditional LED Backlight Effect, Making the Light More Penetrating, Giving You a More Dazzling Visual Effect, Making Your Gaming Process More Enjoyable
  • 【One Touch Opens & Visual Feast】The K521 Red Dragon Keyboard has a One-Touch on/off Lighting Button for Added Convenience. It also has a Three-Position Adjustable Breathing Mode and a Four-Position Adjustable Brightness Lighting Mode
  • 【Mechanical Feeling & Fast Tapping】The PC Keyboard Keys are Designed for Mechanical Feeling, Giving You a Better Feel During Use and the Ability to Trigger Keys Quickly, Allowing You to Win All Your Games
  • 【19 Keys Anti-Ghosting Keyboard】Anti-Ghosting Ensures Every Button Can Be Triggered. This Allows You to Trigger Key Combinations In The Game Accurately, And Each Skill Can Be Accurately Released to Increase Your Winning Rate. Redragon K521 Will Be Your Perfect Partner
  • 【12 Multimedia Combination Keys】The K521 Wired Gaming Keyboard is Equipped with 12 Multimedia Keys That Can Greatly Enhance Your Gaming/Office Efficiency and Make It More Convenient to Use
npx cypress run --headed --no-exit --browser chrome

--headed displays the browser; --no-exit leaves Cypress open after the run so you can inspect the Command Log and final application state. This is a way to investigate a headless-only failure, not proof that headed and headless runs are otherwise identical. Consult Launching browsers in Cypress for browser-launch details.

6. Use screenshots, video, and CI run evidence

Screenshots and video

Cypress automatically captures screenshots on failure during cypress run; it does not do so automatically in cypress open. Video is off by default. Set video: true to record specs in cypress run; Cypress does not record video in cypress open. The default folders are cypress/screenshots and cypress/videos. A run clears those folders before execution unless configured otherwise, so save artifacts you need before a later run removes them. Details are in Capture screenshots and videos in Cypress.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recorded CI runs

For a run recorded to Cypress Cloud, inspect the error, retry attempts, artifacts, and test history. Test Replay can help when the original browser session is gone and reproducing the same conditions locally is difficult. It is an option for investigating recorded CI failures, not a replacement for a minimal local reproduction. See Debug failing tests in CI with Cypress Cloud.

Best Value
Sale
Logitech K270 Full Size Wireless Keyboard for Windows - Black
  • All-day Comfort: This USB keyboard creates a comfortable and familiar typing experience thanks to the deep-profile keys and standard full-size layout with all F-keys, number pad and arrow keys
  • Built to Last: The spill-proof (2) design and durable print characters keep you on track for years to come despite any on-the-job mishaps; it’s a reliable partner for your desk at home, or at work
  • Long-lasting Battery Life: A 24-month battery life (4) means you can go for 2 years without the hassle of changing batteries of your wireless full-size keyboard
  • Simply plug the USB receiver into a USB port on your desktop, laptop or netbook computer and start using the keyboard right away without any software installation
  • Simply Wireless: Forget about drop-outs and delays thanks to a strong, reliable wireless connection with up to 33 ft range (5); K270 is compatible with Windows 7, 8, 10 or later
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

7. Turn on targeted Cypress diagnostics

For Cypress’s own internal diagnostics, set DEBUG before launching the app or test run. Broad logging:

DEBUG=cypress:* npx cypress run

For narrower output, select a namespace, for example:

DEBUG=cypress:server:project npx cypress run
DEBUG=cypress:server:browsers* npx cypress open

Use the command that matches the issue and launch mode. Cypress warns that debug output can be large and may affect performance, so enable it only when useful and prefer a narrow namespace when possible. In browser open mode, Cypress also documents setting localStorage.debug = 'cypress*' in DevTools and reloading to see browser logs. The troubleshooting guide describes these options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common Cypress debugging problems

Symptom Likely explanation Next step
A breakpoint runs after the state you wanted has changed The test callback enqueued commands, which Cypress executed before reaching the bare debugger. Put debugger inside a .then() callback after the relevant query, or use .debug() or cy.pause().
A test fails once and passes on retry A whole-test retry reran the test; it did not establish that the original failure was harmless. Compare the first attempt and retry, including setup hooks, state, and timing. Remember that beforeEach and afterEach rerun; before and after hook failures do not trigger retries.
The failure appears only in headless CI Execution mode, browser, or environment may differ. Try npx cypress run --headed --no-exit --browser chrome locally, then compare one axis at a time.
No failure screenshot appears in open mode Failure screenshots are automatic in cypress run, not cypress open. Use the open-mode Command Log and snapshots, or run the test with cypress run when you need its automatic failure screenshot.
Expected video is missing Video is off by default and is recorded in cypress run, not cypress open. Enable video: true and run with cypress run.
Debug logs are overwhelming or the run slows down cypress:* produces broad output, and debug logging may affect performance. Disable broad logging or use a narrower namespace such as cypress:server:project or cypress:server:browsers*.

Or skip the browser setup

If a Cypress screenshot helps you inspect a page state or compare what rendered, you can capture a URL with one request instead of configuring a local browser. ScreenshotNeo is a website screenshot API and MCP server for developers. Its clean-shot steps can accept cookie or consent banners like a visitor and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. AI agents can use its MCP tools, including take_screenshot, get_page_info, and capture_pdf.

For example, use this cURL request to save a WebP screenshot:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Replace the target URL as needed and provide your API key. See the ScreenshotNeo API documentation for request options. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month, with no card required.

Quick Recap

SaleBestseller No. 1
SaleBestseller No. 3
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Plastic parts in K120 include 51% certified post-consumer recycled plastic*; Product carbon footprint: 4.02 kg CO2e
$12.39
SaleBestseller No. 5
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Plastic parts in K270 include 38% certified post-consumer recycled plastic; Eight hot keys: For instant access to the Internet, e-mail, music volume and more
$21.48

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.