What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
A Cypress test that fails once and passes on retry is flaky—not fixed. Use retries to expose inconsistent outcomes, then trace the cause: shared state, timing assumptions, unstable selectors, or differences between CI and local runs. Make the test wait for observable conditions, capture evidence from the failed attempt, and track each flake until its cause is corrected.
Confirm what is actually flaky
Start by recording the exact spec and test, assertion or command that failed, browser, run mode, environment, and CI job. Establish whether it fails only in CI, only after another test runs, or on the first attempt before passing on a retry. Cypress retries can reveal that a test changes outcome across attempts, but a retry pass is a signal to investigate rather than proof of a repair. See Cypress’s test retries guidance.
As an Amazon Associate I earn from qualifying purchases.
Run the test by itself and in its normal suite context. If it passes alone but fails in the suite, look for order dependence or state left by another test. If it fails only in CI, compare the application build, browser, configuration, test data, server startup, network access, and available resources with the local run.
Make tests independent of shared state
Cypress states that “Tests should always be able to be run independently from one another and still pass.” End-to-end test isolation is enabled by default, and Cypress cleans the browser context between tests when isolation is enabled. That does not reset every database, service, shared account, or server-side fixture.
#1 Best Overall
- Give each test predictable data and setup; avoid depending on records created by another test.
- Check whether shared accounts or persistent data are being changed by parallel jobs or prior runs.
- Use programmatic login and controlled application state when login itself is not the behavior being tested.
- Run the suspect test alone, then in its suite, to distinguish external-state issues from order dependence.
Use Cypress’s writing and organizing tests guidance when deciding how to isolate test behavior.
Wait for observable conditions, not guessed durations
A fixed sleep assumes the application always becomes ready within the duration chosen. Network speed, animations, API responses, server startup, or database availability can invalidate that assumption. Cypress identifies these and other race conditions in its retry documentation.
Rank #2
- Identify the state the next action actually requires: a button enabled, a result rendered, a request completed, or a loading indicator gone.
- Use Cypress’s retryable queries and assertions to wait for that state rather than inserting an arbitrary delay.
- For important actions and requests, assert the required intermediate result before proceeding. This localizes failure to the step that did not complete as expected.
Cypress’s debugging guide notes that insufficient assertions around actions or requests are a common flake pattern.
Reduce selector and test-scope fragility
- Prefer stable
data-*attributes for selectors when the application can provide them. Selectors tied to styling or implementation details are more likely to break when the interface changes. - Keep each test focused enough that its failure location points maintainers toward the broken behavior.
- Do not exercise unrelated setup through the UI when a controlled setup path is appropriate. Cypress recommends programmatic login when login is not the behavior under test.
See Cypress’s best practices for additional guidance on selectors and test setup.
Rank #3
Investigate CI failures using the failed attempt
Compare an actual failing attempt with a passing attempt on the same code where possible. Inspect the failure location and the state immediately before it, then compare relevant application and environment differences: build, server startup, browser, configuration, test data, network access, and resource availability. Cypress’s debugging guide recommends reviewing CI build changes and recognizes network speed variation as a source of local-versus-CI differences.
If the run is recorded in Cypress Cloud, Test Replay can provide the DOM, network requests, console logs, and element state from a test attempt. Comparing a failing replay with a passing attempt can help show whether the cause was an unmet UI state, a request, or an environmental difference. Cloud’s Flaky Test Management applies to recorded runs with retries enabled; the current documentation says its detection, analytics, and alerting require a Team plan. See Cypress Cloud Flaky Test Management.
Rank #4
Choose a retry policy deliberately
Cypress retries are disabled by default. You can configure retry counts for run mode and open mode. Retries rerun the test and its hooks, so they increase execution time; use a restrained setting and review which tests rely on retries. A retry may reduce noisy failures while the team investigates, but should not become the permanent substitute for a root-cause fix. The details are in Cypress test retries.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesThere is no universally correct retry count or pass/fail policy. Decide based on suite duration and the reliability signal your release process needs:
- Signal policy: Does a test that fails and then passes count as passing, or should detected flakiness fail the run?
- Feedback cost: How much time do extra test attempts and rerun hooks add?
- Evidence: Can the team inspect attempt logs, DOM state, network records, console messages, screenshots, video, or replay?
- Operational fit: Can the team record CI runs and access the Cypress Cloud plan required for its analytics, or should it rely on local and CI artifacts?
- Ownership: Is each flaky test assigned and tracked to a root-cause fix?
Cypress documents experimental strategies that change how detected flakes affect the final pass/fail result. They are experimental: verify the current names and behavior in Cypress’s experimental features documentation before adopting them. Align the signal with your release needs rather than treating a particular setting as a universal standard.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot by symptom
| Symptom | Likely area to inspect | Next step |
|---|---|---|
| Passes alone, fails in the suite | Test order, shared account or server-side data, setup that runs only once | Compare isolated and suite runs; make setup and data independent. |
| Fails before a retry, then passes | Nondeterministic state, timing, requests, or environment | Inspect the failed attempt and replace timing assumptions with assertions on required state. |
| Fails in CI but passes locally | Build, browser, configuration, server readiness, test data, network, or resource differences | Compare CI and local conditions and inspect recorded attempt evidence where available. |
| Fails after a UI change | Selector coupled to styling or implementation details | Use a stable application-provided data-* selector where practical. |
| Failures move between unrelated steps | Insufficient assertions around earlier actions or requests | Add assertions at the state transitions the later steps depend on. |
Or skip the browser setup
For capturing a page screenshot as part of a debugging workflow, ScreenshotNeo provides a single-request screenshot API; it is not a replacement for diagnosing Cypress test behavior. Example using cURL (replace the URL with the page you need):
Quick Recap
ScreenshotNeo API documentation
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Cookie banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →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.




