Workflow Testing

Write End-to-End Tests

Workflow for writing browser-based end-to-end tests

testinge2ebrowser
CLAUDE.md

When writing end-to-end tests:

  1. Identify the user flow to test. Focus on critical paths: signup, login, core feature, checkout.
  2. Write the test as the user would experience it: navigate, fill in forms, click buttons, verify results.
  3. Use stable selectors: data-testid attributes, ARIA roles, or semantic element queries — not CSS classes or XPaths.
  4. Add wait conditions for async operations — don’t use fixed sleep timers.
  5. Assert on visible outcomes: text on the page, navigation to a URL, presence of elements.
  6. Test one complete flow per test. Don’t chain unrelated flows.
  7. Run the test against a clean state. Seed required data before the test, clean up after.

Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.

get crystl