# E2E tests exist for the primary user flow

- **Pattern:** `ab-000301` (`ai-slop-test-theater.coverage-reality.e2e-tests-exist-for-primary-flow`)
- **Severity:** high
- **Lifecycle:** active
- **Last modified:** 2026-04-18
- **Canonical URL:** https://auditbuffet.com/patterns/ab-000301
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-000301)

## Why it matters

An E2E framework installed in `devDependencies` with no actual E2E tests is worse than not having one at all — it creates the impression of integration-level coverage that doesn't exist. Playwright, Cypress, and Puppeteer are designed to catch the class of bugs unit tests cannot: routing misconfigurations, broken form submissions, misconfigured auth redirects. A signup flow that works in isolation but fails end-to-end due to a missing CORS header or broken redirect will never be caught by unit tests. ISO-25010:2011 testability requires that critical user journeys be exercised as a system.

## Severity rationale

High because missing E2E coverage for the primary user flow means complete-flow regressions — auth, checkout, signup — go undetected until a user reports them.

## Remediation

Write one E2E test covering the primary user journey. It needs three things: navigation to the starting URL, form interaction, and an assertion on the resulting page state. Add it to `e2e/` or `tests/e2e/`:

```ts
// e2e/signup.spec.ts
import { test, expect } from '@playwright/test'

test('new user can sign up and reach dashboard', async ({ page }) => {
  await page.goto('/signup')
  await page.fill('input[name=email]', 'new@example.com')
  await page.fill('input[name=password]', 'P@ssw0rd123')
  await page.click('button[type=submit]')
  await expect(page).toHaveURL('/dashboard')
  await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible()
})
```

## Detection

- **ID:** `e2e-tests-exist-for-primary-flow`
- **Severity:** `high`
- **What to look for:** When `@playwright/test`, `cypress`, `puppeteer` (used for testing), `webdriverio`, `nightwatch`, OR `@testing-library/react` with E2E patterns is in `devDependencies`, walk all test files under `e2e/`, `tests/e2e/`, `cypress/e2e/`, `tests-e2e/`, `playwright/`, `tests/playwright/`. Count all E2E test files and verify at least 1 contains: a `goto(`/`visit(` call AND a form interaction (`fill(`/`type(`/`click('button')`) AND an assertion. If at least 1 such E2E test exists, the project has primary-flow E2E coverage.
- **Pass criteria:** At least 1 E2E test file with goto + interaction + assertion exists. Report: "X E2E test files inspected, Y with primary-flow patterns, framework: [name]."
- **Fail criteria:** An E2E framework is in deps but 0 E2E test files contain a complete primary-flow pattern.
- **Skip (N/A) when:** No E2E framework in `devDependencies`.
- **Detail on fail:** `"@playwright/test is in devDependencies but no E2E tests with goto + form interaction + assertion exist. The framework is installed but never used."`
- **Remediation:** An E2E framework with no tests is a bigger smell than no E2E framework at all. Add a single happy-path test:

  ```ts
  // e2e/signup.spec.ts
  import { test, expect } from '@playwright/test'

  test('user can sign up', async ({ page }) => {
    await page.goto('/signup')
    await page.fill('input[name=email]', 'new@example.com')
    await page.fill('input[name=password]', 'P@ssw0rd123')
    await page.click('button[type=submit]')
    await expect(page).toHaveURL('/dashboard')
    await expect(page.getByText('Welcome')).toBeVisible()
  })
  ```

## External references

- iso-25010 maintainability.testability

Taxons: code-quality

HTML version: https://auditbuffet.com/patterns/ab-000301
