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")