Skip to content
masterclass Buddy

Cypress · Function

before

Cypress uses hooks to prepare and clean up tests. Use before and after once per block, and beforeEach and afterEach around every test; keep tests independent.

Last updated

Syntax

before(fn)
beforeEach(fn)
afterEach(fn)
after(fn)
describe(name, fn)
describe(name, config, fn)
it(name, fn)
it(name, config, fn)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • describe()
  • context()
  • it()
  • specify()
  • before()
  • beforeEach()
  • afterEach()
  • after()

Source: Writing and organizing Cypress tests | Cypress Documentation. Checked 2026-11-03.