Windsurf prompt to write end-to-end tests
End-to-end tests fail for boring reasons: selectors that never matched the real markup, specs that share state, servers that were not running. This prompt makes Cascade read your actual routes before writing Playwright specs, then run the suite headed in Windsurf so you watch the first pass yourself.
Last updated
Set up Playwright end-to-end tests. Create e2e/ with a fixtures.ts for auth state and specs for the three paths that matter most in this app; read the route files first and tell me which paths you picked. Prefer getByRole locators over CSS selectors, adding data-testid only where roles are ambiguous. Each spec seeds and cleans its own data through the API, never through the UI, so specs stay independent. Configure Playwright's webServer option so the suite boots the app itself. Run it headed once from the Windsurf terminal while I watch, then headless; paste any flaky failure output. Close with a list of user paths you noticed but did not cover, so I can decide what comes next.
Same task in other tools
Questions about this prompt
Why have Cascade read the route files before writing specs?
Generated selectors drift from real markup fast, and getByRole only works when the roles actually exist. Grounding specs in the code you have beats debugging twenty locator timeouts later.
How do I pick the three critical paths myself?
Name your flows explicitly in the prompt, in priority order, and delete the sentence asking Cascade to choose. Put the flow that costs you money at the top; it gets the most thorough coverage.
A spec passes alone and fails in the full suite. What is wrong?
Shared state, almost every time: one spec's data leaking into another through the database or a logged-in session. The seed-and-clean-through-the-API rule exists for this; check whether the failing spec skipped it.