How to Continue Cypress Test Execution After a Check Fails
A failed Cypress check stops the current test. Learn when to split tests, use retries, handle expected exceptions, and keep the suite moving.

Short answer: Cypress does not continue executing later commands in the same test after an assertion or command fails. To keep useful coverage running, split independent checks into separate it tests. Use assertion retry-ability for conditions that may become true, configure whole-test retries for intermittent failures, and handle only known application exceptions. After a test and its retries are exhausted, Cypress proceeds to remaining tests unless a failing hook prevents dependent tests from running.
What “continue execution” can mean
Several Cypress behaviors are often confused:
| Situation | What Cypress does | What to use |
|---|---|---|
| A query and assertion are waiting for the UI | Cypress retries the linked query and assertion until they pass or time out. | Assertion retry-ability |
| An assertion finally fails inside a test | The current test stops; later commands in that test body do not run. | Split independent checks into separate tests |
| A test is flaky | Cypress can rerun the entire test, including its beforeEach and afterEach hooks. |
Test retries |
| A test fails after all attempts | Cypress reports it as failed and moves to remaining tests. | Keep tests independent and hooks reliable |
| A known application exception is expected | You can narrowly suppress that exception. | A scoped uncaught:exception handler |
Recommended design: one independent outcome per test
If the page title and submit button are independent checks, put them in separate tests. A failure in one test then does not hide the result of the other.

describe('checkout page', () => {
beforeEach(() => {
cy.visit('/checkout')
})
it('shows the expected page title', () => {
cy.title().should('eq', 'Checkout')
})
it('enables the submit button', () => {
cy.get('[data-cy="submit-order"]').should('be.enabled')
})
})
Do not split tests while leaving them dependent on mutable state from one another. Each test should create or reset the data it needs, usually through the UI or an API setup step.
Use Cypress retry-ability for transient UI state
Cypress automatically retries linked queries and assertions. This is waiting for a condition to become true; it is not a mechanism for continuing after a final failure.
it('shows the saved profile', () => {
cy.get('[data-cy="profile-status"]')
.should('be.visible')
.and('contain', 'Saved')
})
The get and assertions remain linked, so Cypress retries the chain until it passes or the command timeout is reached. Avoid inserting arbitrary delays when the application exposes a reliable element or state to assert.
Retry the whole test when failure is genuinely intermittent
Test retries are disabled by default. Configure them when a complete rerun is useful, such as for a known intermittent network or rendering condition. A retry count of 1 means one additional attempt, for up to two total attempts.
import { defineConfig } from 'cypress'
export default defineConfig({
retries: {
runMode: 1,
openMode: 0,
},
})
Retries rerun the whole test from its beginning, including beforeEach and afterEach. They do not jump past the failed command. Make setup and cleanup safe to repeat, and treat a consistently failing test as a defect rather than hiding it with a high retry count. Cypress documents the behavior in Test retries in Cypress and notes the added time cost in Optimizing test performance.
Keep tests moving after a failed test
Once a test has failed and exhausted its retries, Cypress continues with later tests. Organize the spec so failures are independently reportable:
describe('account settings', () => {
it('updates the display name', () => {
cy.visit('/settings')
cy.get('[data-cy="display-name"]').clear().type('Ada')
cy.get('[data-cy="save"]').click()
cy.get('[data-cy="toast"]').should('contain', 'Saved')
})
it('shows the password form', () => {
cy.visit('/settings')
cy.get('[data-cy="password-form"]').should('be.visible')
})
})
Shared before, beforeEach, after, or afterEach hooks can still prevent dependent tests from running. Keep hooks small, deterministic, and limited to setup required by the tests that follow. See Writing and organizing Cypress tests.
Handle an expected application exception narrowly
If the application intentionally throws a known exception that should not fail this particular test, use a per-test cy.on listener and match the error precisely.
it('continues when the legacy widget throws its known error', () => {
cy.on('uncaught:exception', (error) => {
if (error.message.includes('LegacyWidget: optional module unavailable')) {
return false
}
// Return nothing for every other error so Cypress fails the test.
})
cy.visit('/dashboard')
cy.get('[data-cy="dashboard-heading"]').should('be.visible')
})
Use this only for an exception the test explicitly expects. Returning false for every exception can conceal real regressions. Cypress commands and assertions are not supported inside the exception callback. A cy.on listener is removed at the end of the test; a global Cypress.on listener persists until removed. Consult the Catalog of Events, Common error messages, and Cypress FAQ.
Patterns that do not provide continuation
- Wrapping assertions in JavaScript
try/catch: Cypress commands are queued and asynchronous; a normaltry/catchdoes not turn a failed Cypress assertion into a continuing command chain. - Adding
cy.wait(1000): a delay does not make a deterministic failure recoverable. Assert on the state you need. - Using retries to hide a product bug: retries rerun the same actions and can make CI slower while leaving the defect intact.
- Suppressing all uncaught exceptions: this can make serious application failures look like passing tests.
A practical decision checklist
- Is the condition expected to change while the page loads? Use a linked query and assertion.
- Should later checks produce their own pass or fail result? Put each independent check in its own
itblock. - Is the failure intermittent and safe to rerun from the beginning? Configure a small retry count.
- Does setup fail before the test body starts? Fix or isolate the hook; test separation cannot bypass a broken shared prerequisite.
- Is an application exception intentional and documented? Match that exact error with a scoped handler.
- Would continuing conceal a real defect? Let Cypress fail the test and report it.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Commands after should() never run |
The assertion failed permanently or timed out. | Split the checks into separate tests or fix the failing condition. |
| The next test is skipped | A before or beforeEach hook failed. |
Make setup independent, repair the hook, or move unrelated setup into the test that needs it. |
| The test runs twice unexpectedly | A retry is configured for the current mode. | Inspect retries.runMode and retries.openMode; remember the count is additional attempts. |
| Retries never fix the failure | The failure is deterministic, or repeated setup leaves stale state. | Remove the flake assumption, reset data between attempts, and fix the underlying defect. |
| Unexpected errors stop being reported | A broad Cypress.on('uncaught:exception') handler returns false for everything. |
Use a per-test cy.on handler and match only the documented error. |
| A timeout occurs while an element is still loading | The assertion is not linked to the query that finds the element, or the timeout is too short. | Chain the query and assertion, then adjust the command timeout only when the application genuinely needs more time. |
Performance, reliability, and cost considerations
Separate tests improve diagnosis but may repeat navigation and setup. Keep each test focused, use API-based data preparation where appropriate, and avoid retries on deterministic checks. Retries increase execution time because every attempt repeats the test and its hooks. A stable test suite should make failures visible rather than relying on retries as a substitute for isolation.

Or skip the browser setup
If you need screenshots of Cypress runs, failure pages, or generated test reports, ScreenshotNeo provides a single HTTP request instead of maintaining browser capture code. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf.
See the ScreenshotNeo API documentation for all options.
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url=https://example.com \
-o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://example.com',
})
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`)
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`)
const image = Buffer.from(await res.arrayBuffer())
await Bun.write('shot.webp', image)
Features include full-page capture with lazy images loaded, element capture by CSS selector, dark mode, device presets, custom viewports, retina scale, PDF output, custom CSS and JavaScript, waits, request blocking, headers, cookies, user agents, timezone and geolocation, caching, signed links, asynchronous jobs, bulk capture, usage reporting, and an OpenAPI specification. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.
FAQ
Can Cypress resume at the command after the failed assertion?
No. The current test stops at the failure. A retry starts the entire test again.
How many times does retries: 2 run a test?
Up to three total attempts: the initial run plus two additional retries.
Do retries apply to a failing before hook?
No. Failures in before and after hooks do not trigger test retries.
Should every assertion be its own test?
No. Group checks that share setup and represent one behavior; split checks when their results should be reported independently.
Does ignoring an uncaught exception make a failed assertion continue?
No. Exception handling affects matching application exceptions, not failed Cypress assertions.


