Complete the code to visit a page and clear all cookies.
cy.visit('https://example.com') cy.[1]()
The correct Cypress command to clear all cookies is cy.clearCookies(). It clears all cookies for the current domain.
Complete the code to set a cookie named 'session_id' with value 'abc123'.
cy.setCookie('[1]', 'abc123')
The cookie name to set is session_id as required.
Fix the error in the code to get a cookie named 'user_token'.
cy.getCookie([1]).should('exist')
The cookie name must be a string literal, so it needs quotes like 'user_token'.
Fill both blanks to check that the cookie 'auth' has value 'true'.
cy.getCookie('[1]').its('value').should('[2]', 'true')
The cookie name is auth. To check its value, use .its('value').should('eq', 'true').
Fill all three blanks to clear a cookie named 'session', then verify it no longer exists.
cy.clearCookie('[1]').then(() => { cy.getCookie('[2]').should('[3]') })
We clear the cookie named session. Then we check that the same cookie no longer exists using should('not.exist').