Cypress E2E testing patterns -- selectors, cy.intercept, cy.session, cy.clock, custom commands, test isolation, and anti-patterns
98
99%
Does it follow best practices?
Impact
97%
1.25xAverage score across 4 eval scenarios
Passed
No known issues
A web application has a login page and an authenticated dashboard. Write Cypress E2E tests covering the login flow and the dashboard page.
The app runs on http://localhost:3000 with these pages:
/login -- email and password form with "Sign in" button/dashboard -- displays a welcome banner, recent activity feed, and quick-action cards/dashboard/profile -- user profile page showing name, email, and avatarThe app has these API endpoints:
POST /api/auth/login -- authenticates user, sets session cookieGET /api/dashboard/summary -- returns dashboard summary dataGET /api/user/profile -- returns current user profileAll dashboard pages require authentication. Unauthenticated users are redirected to /login.
Produce:
cypress.config.ts -- Cypress configurationcypress/e2e/login.cy.ts -- tests for login flow (success, failure, validation)cypress/e2e/dashboard.cy.ts -- tests for the authenticated dashboardcypress/support/commands.ts -- any reusable test helperspackage.json -- with cypress dependency listedYou may create additional support files for good test organization.