
- Updated
Write an end-to-end test for a user journey
This prompt writes an end-to-end test for a full user journey, such as sign up to first project. It uses role and label selectors and real waits instead of sleeps, so the test does not break every time the design changes.
Act as a QA automation engineer using [TOOL, e.g. Playwright with TypeScript]. User journey to test: [STEPS, e.g. sign up, verify email, create first project] App URL: [e.g. http://localhost:3000] Useful selectors or page code: [PASTE OR DESCRIBE] Write a reliable end-to-end test. Use role and label selectors, not CSS classes. Wait for real conditions, never fixed sleeps. Set up and clean up test data. Add clear step names so a failure is easy to read, and explain how to run it headed and in CI.
Selectors like getByRole and getByLabel survive design changes. CSS class selectors break often.
Get a better result
A reliable end-to-end test that uses role and label selectors, waits on real conditions, sets up and cleans up test data, has clear step names, and comes with instructions to run it headed and in CI.
The test uses CSS classes and breaks after a redesign.
Fix: Keep the rule to use roles, labels and visible text. Paste the page’s markup so the AI can pick accurate ones.
- It passes locally and fails in CI. Ask for no fixed waits, a stable test account and a fresh database state for each run, and note the CI browser and its settings.
- The test data stays behind and breaks the next run. Ask for a setup and a cleanup step, using a unique email or name for each run.
Ask for “a screenshot and a trace saved only when the test fails”. It makes CI failures much quicker to understand.
Split the journey into three steps with clear names. After each, check one visible result, and keep the selectors based on roles and labels.
Guides that use this prompt
More chat & writing prompts
See all 465 →More like this
- Build a landing page in plain HTML and CSSClaude · ChatGPT · Gemini
- Write friendly release notesChatGPT · Gemini · Claude
- Add logging that helps you debug laterClaude · ChatGPT · Gemini
- Upgrade a library to a new major versionClaude · ChatGPT · Claude Code
- Write a system prompt for an AI assistantChatGPT · Gemini · Claude



