Test Overview
This test checks that a user can log in successfully using a fast login handling method. It verifies that the login process completes and the user dashboard is shown, speeding up the test suite by avoiding repeated full login flows.
This test checks that a user can log in successfully using a fast login handling method. It verifies that the login process completes and the user dashboard is shown, speeding up the test suite by avoiding repeated full login flows.
describe('Fast Login Handling Test', () => { before(() => { // Use API to log in and set session cookie cy.request('POST', '/api/login', { username: 'user1', password: 'pass123' }) .then((response) => { expect(response.status).to.eq(200); cy.setCookie('session_id', response.body.sessionId); }); }); it('should show dashboard after fast login', () => { cy.visit('/dashboard'); cy.get('h1').should('contain.text', 'Welcome, user1'); }); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test suite starts and before hook runs | No browser opened yet; preparing login session via API | - | PASS |
| 2 | Send POST request to /api/login with username and password | API server receives login request | Response status is 200 | PASS |
| 3 | Set session cookie with sessionId from response | Browser session cookie set for authentication | - | PASS |
| 4 | Visit /dashboard page in browser | Dashboard page loads with user session active | - | PASS |
| 5 | Find <h1> element and check it contains 'Welcome, user1' | Dashboard page shows welcome message | Text contains 'Welcome, user1' | PASS |