Cypress · Junior · Question 40 of 75
Where should code that runs before each test, like cy.visit('/'), go?
- 1In
beforeEach - 2At the top of the file
- 3In
after
Show the answer
Correct answer: In beforeEach
Explanation
beforeEach runs before every test. Code outside hooks and tests runs while specs are collected, not inside a test.