Complete the code to run a setup step before all tests in the suite.
describe('My Test Suite', () => { [1](() => { cy.log('Setup before all tests') }) it('Test 1', () => { cy.visit('/') }) })
The before hook runs once before all tests in the suite. It is used for setup steps.
Complete the code to run a cleanup step after each test in the suite.
describe('My Test Suite', () => { [1](() => { cy.log('Cleanup after each test') }) it('Test 1', () => { cy.visit('/') }) })
The afterEach hook runs after each test in the suite. It is used for cleanup steps.
Fix the error in the hook name to run code after all tests.
describe('My Test Suite', () => { [1](() => { cy.log('Runs after all tests') }) it('Test 1', () => { cy.visit('/') }) })
The correct hook to run code after all tests is after. afterAll is not a valid Cypress hook.
Fill both blanks to run setup before each test and cleanup after each test.
describe('My Test Suite', () => { [1](() => { cy.log('Setup before each test') }) [2](() => { cy.log('Cleanup after each test') }) it('Test 1', () => { cy.visit('/') }) })
beforeEach runs before each test for setup, and afterEach runs after each test for cleanup.
Fill all three blanks to run setup once before all tests, setup before each test, and cleanup once after all tests.
describe('My Test Suite', () => { [1](() => { cy.log('Setup once before all tests') }) [2](() => { cy.log('Setup before each test') }) [3](() => { cy.log('Cleanup once after all tests') }) it('Test 1', () => { cy.visit('/') }) })
before runs once before all tests, beforeEach runs before each test, and after runs once after all tests.