Programmatic login using cy.request in Cypress
Preconditions (3)
Step 1: Send a POST request to '/api/login' with JSON body containing username 'testuser' and password 'Test@1234'
Step 2: Verify the response status code is 200
Step 3: Extract the authentication token from the response body
Step 4: Set the authentication token in local storage or cookies as required by the application
Step 5: Visit the '/dashboard' page
Step 6: Verify that the dashboard page loads successfully by checking the URL and presence of a welcome message
✅ Expected Result: User is logged in programmatically and dashboard page is displayed with a welcome message