sincecutoff.com
← all changes

Cookie commands become retryable queries

Introduced 2026-09-01 · score 0.95

HOW TO USE IT

When overwriting any cookie read query in Cypress 16, register it with `Cypress.Commands.overwriteQuery()`; chained `.should()` assertions retry cookie reads until they pass or the command timeout expires.

Cypress.Commands.overwriteQuery('getCookie', function (originalFn, ...args) { return originalFn.apply(this, args) })
cy.getCookie('<name>').should('exist')
cy.getCookies().should('have.length', <count>)

WHY THIS HELPS

Update custom overwrites and assertions for Cypress cookie query commands.

BEFORE THIS CHANGE

Use `Cypress.Commands.overwrite()` to overwrite `cy.getCookie()`, `cy.getCookies()`, or `cy.getAllCookies()`; the commands were not retryable queries.

REQUIREMENTS AND LIMITATIONS

  • Version: 16.0.0
  • name (required): Query name string passed to `overwriteQuery`, such as `getCookie`, `getCookies`, or `getAllCookies`.
  • callbackFn (required): Overwrite callback; its first argument is the original query function. It must return an inner function; use `function`, not an arrow function, because the query API uses `this` for timeouts.
  • defaultCommandTimeout: Default timeout in milliseconds for most DOM based commands; cookie query options also default to this timeout.
  • options.domain: For `cy.getCookies()`, select cookies from the specified domain; defaults to the application hostname.
  • options.log: Show the cookie query in the Command log; defaults to `true`.
  • options.timeout: Time in milliseconds to wait for the cookie query; defaults to `defaultCommandTimeout`.
  • Prerequisite: Use Cypress 16.0.0 or later for these cookie reads to be queries.
  • Prerequisite: Cookie queries must be chained from `cy`; use chained `.should()` assertions to drive retry behavior. A `.then()` callback itself is not retried.
  • These commands can no longer be overwritten with `Cypress.Commands.overwrite()`.
  • The retry behavior is governed by `defaultCommandTimeout`.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card