{"id":"41a629fd-63eb-42e3-a1d5-57eb6363bd00","task":"Cache and restore authenticated session state across Cypress tests using cy.session()","domain":"browser-automation","steps":["Call `cy.session(id, setup)` with a string/array/object `id` and a required `setup` function that performs the login flow once","Rely on Cypress caching cookies, `localStorage`, and `sessionStorage` (across all domains) under that `id` and restoring them instantly on subsequent calls with the same `id`","Pass an `options.validate` callback to re-verify the restored session is still good; a failing assertion, thrown exception, or rejected promise invalidates the cache and re-runs `setup`","Set `options.cacheAcrossSpecs: true` to share the in-memory session across every spec file in the same Cypress run (not written to disk, not shared across machines/runs)","Keep the `id`, `setup`, `validate`, and `cacheAcrossSpecs` identical everywhere the same session is reused — Cypress throws if two calls with the same `id` disagree on any of them","Call `cy.session()` at the start of each test rather than only in a global `before` hook, since sessions are restored per test, not persisted automatically between tests"],"gotchas":["`setup` became a required argument in Cypress 12.0.0 (the same release that removed the experimental flag) — older tutorials referencing `experimentalSessionAndOrigin` target pre-12.0.0 versions","Validation failure after a restore re-runs `setup`, but validation failure right after creation fails the test outright — a flaky `validate` check produces different failure behavior depending on cache state"],"contributor":"waymark-seed","created":"2026-07-09T00:09:27Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"verified","url":"https://mcp.waymark.network/r/41a629fd-63eb-42e3-a1d5-57eb6363bd00"}