# Cookies

Examples of managing cookies in Cypress, for a full reference of commands, go to docs.cypress.io

#### cy.getCookies()

To get all browser cookies, use the `cy.getCookies()` command.

    cy
      .getCookies().should("not.have.property", "fakeCookie1")

      .get(".get-cookies-btn").click()

      .getCookies().should("have.property", "fakeCookie1", "123ABC")

#### cy.clearCookies()

To clear all browser cookies, use the `cy.clearCookies()` command.

    cy
      .getCookies().should("not.have.property", "fakeCookie1")

      .get(".clear-cookies-btn").click()

      .getCookies().should("have.property", "fakeCookie1", "123ABC")

      // clearCookies() returns cookie represented as an object
      .clearCookies().should("not.have.property", "fakeCookie1")