Complete the code to run the setup before each test.
beforeEach(() => {
cy.[1]('https://example.com')
});The beforeEach hook runs before every test. Using cy.visit() inside it loads the page before each test starts.
Complete the code to clean up after each test.
afterEach(() => {
cy.[1]()
});The afterEach hook runs after every test. Using cy.clearLocalStorage() clears local storage to avoid test interference.
Fix the error in the hook to correctly run code before each test.
beforeEach(function() {
cy.[1]('https://testsite.com')
});The beforeEach hook should use cy.visit() to load the page before each test. Using other commands like click or wait here is incorrect.
Fill both blanks to run setup before and cleanup after each test.
beforeEach(() => {
cy.[1]('https://mysite.com')
});
afterEach(() => {
cy.[2]()
});Use cy.visit() in beforeEach to load the page before tests. Use cy.clearLocalStorage() in afterEach to clear storage after tests.
Fill all three blanks to visit a page, check a button, and clear storage around tests.
beforeEach(() => {
cy.[1]('https://app.com')
cy.get('button#submit').[2]()
});
afterEach(() => {
cy.[3]()
});Use cy.visit() to open the page before tests, cy.get(...).click() to click the button, and cy.clearLocalStorage() after tests to clean up.