Cypress: stable selectors, built-in retries and how to debug a failing test
Pick selectors that last, understand what Cypress retries and what it does not, and use pause and the time-travel view to find out why a test fails.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a sat-nav that re-checks the road, and a dashcam you can scrub. The sat-nav looks again until it finds the turn. If you miss the turn, you scrub the dashcam back to that moment.
Tom uses Cypress on synthetic Daily List. A names an agreed test target. Retry-ability re-evaluates linked queries/assertions under their documented boundaries. lets him inspect saved command snapshots, not replay every backend operation.
The sat-nav and dashcam pictures distinguish waiting for an observation from performing an action. A click is not automatically reissued until the business result looks right.
The picture has a limit. A stable selector can still be ambiguous; an assertion that passed can form a retry boundary; and snapshots are not a complete live application or server history.
(SYNTHETIC / TRAINING ONLY: Daily List and every named person are invented.)
PLAIN WORDS · 5 in this section
- cypress
- A free tool that drives a web browser for checks.
- retry
- trying the same action again after it failed
- debugging
- hunting down and fixing faults in a system
- snapshots
- records of how things stood at one moment
- reissued
- issued or sent out again
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Target intended Cypress controls and distinguish retried observations, actions and bounded debugging evidence.
- Select
- Retry
- Scrub
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| Re-checking the road until the turn appears | Retry-ability |
| Not counting seconds | No fixed waits |
| Moving back through the dashcam | Time-travel debugging |
| Stopping to look around | cy.pause |
WHERE THIS PICTURE STOPS
- Queries/assertions and actions have different retry behavior; a passed mid-chain assertion can retain a subject.
- Snapshots aid diagnosis but do not replay every backend operation or prove a business outcome.
HOOK
Keep trying, then scrub back.
TELL A FRIEND
A sat-nav: keep trying, then scrub back.
OFTEN MIXED UP WITH Cypress: your first end-to-end test. That topic writes a first Cypress test. This one makes it stable and shows how to debug it.
Sources & standards — 5 sources
- Implementation-specific
Cypress best practices ↗ — Cypress.io · Selector intent; data attributes versus required text; controlled test state (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress retry-ability ↗ — Cypress.io · Linked queries/assertions; passed assertion boundaries; once-executed actions; then/should distinction (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress actionability ↗ — Cypress.io · Disabled/detached/covered target checks and action execution boundaries (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress debugging ↗ — Cypress.io · Command Log, snapshots and bounded debugging context (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress open mode ↗ — Cypress.io · Interactive launchpad workflow; Command Log, snapshots and console details (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
PRACTISE AND KEEP
Sources for this topic — 5 sources
- Implementation-specific
Cypress best practices ↗ — Cypress.io · Selector intent; data attributes versus required text; controlled test state (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress retry-ability ↗ — Cypress.io · Linked queries/assertions; passed assertion boundaries; once-executed actions; then/should distinction (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress actionability ↗ — Cypress.io · Disabled/detached/covered target checks and action execution boundaries (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress debugging ↗ — Cypress.io · Command Log, snapshots and bounded debugging context (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
- Implementation-specific
Cypress open mode ↗ — Cypress.io · Interactive launchpad workflow; Command Log, snapshots and console details (selected actual live publisher passages read 7 November 2026; current-documentation scope, not every historical release).
Selected actual primary sections read. Current installation requirements and version-specific module-loading changes are scoped explicitly. Daily List selectors, addresses and outcomes are synthetic. Syntax/consumer checks are not a Cypress package/binary or application execution claim. No arbitrary forced action/repeated write is presented as a repair.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.