Cypress Hooks is the construct that helps in performing a particular set of actions before/after each test case or before/after all the test cases in the test suite. Cypress provides various hooks like before(), beforeEach(), after(), and afterEach() to execute pre and post steps.
In this video, Chris DeSilva (@desilvadev) showcases how hooks can minimize boilerplate and run tasks at different points in the test suite. He also talks about the four common Cypress hooks and when they invoke in a test suite: ➧ before() ➧ after() ➧ beforeEach() ➧ afterEach()
You will learn -:
What are hooks in Cypress?
How do you write the first test in Cypress?
How to use hook in Cypress?
How to define hooks in a Cypress TestScript?