Test Overview
This test checks if a cookie named session_id is set correctly after visiting the homepage. It then verifies the cookie value and deletes it to confirm removal.
This test checks if a cookie named session_id is set correctly after visiting the homepage. It then verifies the cookie value and deletes it to confirm removal.
describe('Cookie management test', () => { it('should set, verify, and clear a cookie', () => { cy.visit('https://example.com'); cy.setCookie('session_id', 'abc123'); cy.getCookie('session_id').should('have.property', 'value', 'abc123'); cy.clearCookie('session_id'); cy.getCookie('session_id').should('be.null'); }); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, no browser opened yet | - | PASS |
| 2 | Browser opens and navigates to https://example.com | Homepage of example.com loaded in browser | - | PASS |
| 3 | Set cookie named 'session_id' with value 'abc123' | Cookie 'session_id=abc123' stored in browser | - | PASS |
| 4 | Get cookie 'session_id' and check its value | Cookie 'session_id' retrieved from browser | Verify cookie value equals 'abc123' | PASS |
| 5 | Clear cookie named 'session_id' | Cookie 'session_id' removed from browser | - | PASS |
| 6 | Get cookie 'session_id' and verify it is null | No cookie named 'session_id' found | Verify cookie is null (does not exist) | PASS |