Skip to main content

Common E2E Testing Gotchas

Short answer

When CI breaks after a refactor or only in parallel, the cause is usually selectors, shared world-state, timing, or UI-only asserts—not “Playwright is random.” These pages give atomic fixes; the flaky E2E playbook covers the full reliability loop.

Gotchas in this section

GotchaSymptomPrimary fix
Selector changedLocator not found after UI refactordata-testid, roles, labels; ai.act only for genuine variance
World-state mutationTest passes alone, fails in suitePer-run seed routes and runId-scoped fixtures
When to use ai.actBrittle copy/layout; over-using AI stepsProbes + stable ids; semantic steps sparingly
UI-only assertionsToast green, backend wrongProbe Assert
Flaky waitsRandom timeouts; passes on retryexpect.poll, locator auto-wait; ban waitForTimeout
Shared auth stateWrong user; surprise 403storageState per worker; seed user per runId
Parallel CI collisionsSame email/SKU across workersUnique seeds; no shared staging users
Hardcoded test dataExpired coupon; taken emailFixture factories; time-independent seeds
Test order dependencyPasses only in one orderIndependent Arrange; parallel mode
Brittle snapshotsHuge diffs on copy/CSSStructure asserts; probes over full-page snapshots
Missing feature flagsWrong funnel after deploySeed flag state in Arrange; document in plans
Staging vs local driftPasses locally, fails on previewPer-env BASE_URL, flags, multi-environment
Login every testSlow suite; session racesstorageState or API token Arrange
Teardown leaksLater specs see leftover datarunId isolation; probe counts
Over-mockingGreen CI, prod integration failsReal routes; AIMock for LLM only

How TestChimp helps

Record-replay and no-code tools capture clicks—they rarely fix root causes in Arrange or Assert. TestChimp orchestrates QA in Claude or Cursor with the TestChimp skill:

  • /testchimp init — scaffold seed/probe routes so tests stop sharing staging users and coupons
  • /testchimp test on PRs — agents repair locators with markdown scenario context, not orphan chat threads
  • SmartTests — Playwright in Git with optional ai.act where selectors churn; probes stay authoritative

See record-replay vs TestChimp and pure Playwright vs SmartTests.

Frequently asked questions

Which gotcha should I read first?

World-state mutation if tests pass alone but fail in the suite; selector drift after a UI refactor; UI-only asserts if CI is green but prod still breaks.

How does TestChimp help with these gotchas?

/testchimp init scaffolds seed and probe routes for isolation. /testchimp test on PRs repairs locators with scenario context from markdown plans. ai.act is used sparingly—probes remain authoritative.

Are these different from the flaky E2E startup guide?

Yes—the flaky guide is a holistic playbook. Gotcha pages are atomic answers for specific failures, each with deep FAQs optimized for search and AI answers.

We use a recorder—why do we still hit these gotchas?

Recorders optimize click capture, not per-run data or backend truth. Without seed routes and probe Assert, shared coupons and toast-only checks still flake in parallel CI.