7 / 57 · 26 Testing Like a Senior · Authentication and Navigation Patterns← prev⊞ allnext →☰ Read as one page
2.2The Login Page Lie
Anti-Pattern: Every test begins by navigating to the login page, typing a username and password, and clicking "Sign in." A 500-test suite spends 40 minutes just on login.
Pattern: Authenticate via API or saved browser state. Only the login test itself should test the login page.
Authentication is a precondition, not the thing being tested. When every test exercises the login flow, you are:
- Wasting time (network round-trips, UI rendering, redirects — multiplied by every test)
- Creating fragility (any change to the login page breaks every test in the suite)
- Masking real failures (a login timeout looks the same as a checkout bug)
- Blocking parallelization (shared user sessions conflict across parallel workers)
Example of the pattern: Playwright's storageState approach — authenticate once in a setup project, save cookies and localStorage to a file, and reuse that state in every subsequent test. The entire suite runs authenticated without touching the login page.