https://cypress.io logo
Cookies will be cleared after every `it()` block t...
# best-practices
l
Cookies will be cleared after every
it()
block to maintain test purity and to discourage a buildup of state. So you would want to perform the actions that result in a cookie at the beginning of each test. If these steps are identical in every test, you can consider moving them to a
beforeEach()
block to reduce repetition. If you'll be using the same steps across multiple spec files then I suggest putting them into a custom command. Cookie commands: https://docs.cypress.io/api/cypress-api/cookies#See-also Custom commands: https://docs.cypress.io/api/cypress-api/custom-commands