Cut Test Runtime by Caching Auth State with Cypress cy.session()
Learn how to use Cypress cy.session() to cache authentication state across tests, eliminate repeated UI logins, and keep your suite fast without hiding login regressions.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to use Cypress cy.session() to cache authentication state across tests, eliminate repeated UI logins, and keep your suite fast without hiding login regressions.
Cypress cy.session() can eliminate redundant logins, but only if you disable testIsolation. Learn the trade-offs, version requirements, and how to verify the cache works.
Fixed cy.wait() calls make Cypress suites slow and still flaky. Retry-ability, network aliases, and retrying assertions replace guesswork with deterministic waiting.
Stub XHR/fetch at the browser boundary with cy.intercept() to make UI tests deterministic — registering, verifying, and recovering from silent pass-through.
Decide when to stub API calls with cy.intercept() or hit the real endpoint with cy.request() in Cypress. A practical guide compares speed, reliability, maintenance, and contract validation, then shows concrete test snippets and how to measure trade‑offs.
Replace flaky waits with deterministic network control using Cypress cy.intercept(): stub responses, synchronize with aliases, and modify requests to cover error and slow-network states.
Cypress retries can stabilize a flaky CI pipeline — or hide real bugs. Here's how to configure run-mode-only retries, pair them with assertion-driven waits, and keep flake visible.
cy.intercept() makes Cypress tests deterministic by stubbing or spying on HTTP requests — but heavy stubbing can drift from the real API. Here's how to use it well.
Catch visual regressions early by running BrowserStack Percy on pull requests. Learn how to add a single snapshot to a Cypress test, handle dynamic content, and balance cost versus quality in your CI pipeline.