Engineering E2E Testing Test Generation

E2E Test Prompt — User Journeys, Not Functions

Cart to confirmation as a user would do it — with the failure scenarios real users actually trigger: refreshes, back buttons, double clicks.

Overview

End-to-end tests written like unit tests waste a browser: they poke at elements instead of walking journeys. This setup generates the E2E contract for a checkout flow at production-ready depth: realistic workflows from entry to outcome, minimal mocking (only true externals like payments), assertions at both ends — what the user sees and what the system stores — and the failure scenarios that separate E2E from demos: mid-flow refresh, slow networks, expired sessions, double-submission, and the back button revisiting a completed step.

How to use this resource

  1. Define the journey, not the pages

    Entry to outcome — the contract tests what the user is trying to accomplish.

  2. Keep the failure scenarios

    Refresh, back button, session expiry, double submit — the four ways real users break flows daily.

  3. Assert both ends

    The confirmation the user sees AND the order the system stored — a journey that only checks one end checks nothing.

Why This Works

  • Journey framing produces tests that mean something when they fail
  • User-behavior failure scenarios cover what staging never sees and production always does
  • Production-ready depth bans the sleeps and ordering that make E2E suites flaky

Best for

  • Flows where the journey IS the product — checkout, onboarding
  • Teams whose E2E suite only tests the sunny day
  • Production-bound flows that meet real browsers and real impatience

Not for

  • Logic that a unit test reaches in milliseconds — E2E is the expensive tier, spend it on journeys
  • Diagnosing why a flow currently fails — that's the Debugging Prompt Generator

Use cases

  • Testing checkout, signup, and onboarding flows end to end
  • Covering the double-submit that creates duplicate orders
  • Verifying the journey survives a mid-flow refresh

FAQ

What failure cases does this checkout E2E prompt cover beyond the happy path?

Five listed under FAILURE SCENARIOS, each getting at least one test: the user refreshes or navigates away mid-flow, a slow network turns instant steps into waits, the session expires between steps, the user double-submits the final action, and the back button revisits a completed step. It generates the Playwright test file for these; you run the suite and confirm it against your real stack.

Why does the generated Playwright file avoid sleeps and CSS selectors?

To survive UI churn and stay CI-safe. FRAMEWORK GUIDANCE locates by user-facing attributes — getByRole, getByLabel, getByText — not "CSS chains that break on restyle," and says "Never sleep: rely on auto-waiting and web-first assertions." Flaky patterns are treated as defects in the tests. The prompt produces one runnable file; you execute it and own whether it passes.

Can I use this to figure out why my checkout flow is currently broken?

It generates tests, it doesn't diagnose. The instruction is "Generate tests only — do not modify the implementation," and the notFor line sends "Diagnosing why a flow currently fails" to the Debugging Prompt Generator. Use this to pin behavior — asserting both what the user sees and what the system stores — and use debugging when you need a root cause.

More resources from Test Case Prompt Generator

Resources that pair well

Related tools

Tip: Save time by exploring related resources and tools that integrate with this resource.