Skip to content

commandTesting

E2E Scenario

Turns a plain-language user journey into an end-to-end test written in the framework your project already uses.

npx workspacetemplates add e2e-scenario --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/e2e-scenario.md15 lines · 1.1 KBFile
---
description: Turns a plain-language user journey into an end-to-end test written in the framework your project already uses.
argument-hint: "[the journey in plain words]"
---

Write an end-to-end test for this journey: $ARGUMENTS

1. Detect the framework in use (Playwright, Cypress, Selenium, WebdriverIO, Detox, Maestro) from config and dependencies. Use it; do not introduce another. If none exists, recommend Playwright and ask first.
2. Read two existing e2e tests for structure, page objects, base URL handling and login helpers. Reuse them.
3. Break the journey into steps with a visible result at each one. Write assertions on what the user sees, not on internal state.
4. Choose selectors in this order: role and accessible name, label, test id. Avoid CSS chains and text that changes. If a needed element has no stable handle, list the data-testid to add and ask before editing the app.
5. Never use fixed sleeps; wait for a condition. Create test data through an API or seed script and clean it up afterward.
6. Run the test 3 times locally. Report any flake and fix its cause.

Show the file path, the steps covered, the run results and anything left manual.

What it does

End-to-end tests are slow to write and easy to make flaky. This command takes a journey described in everyday words, finds your existing setup, and writes the scenario with stable selectors, explicit waits for state and clean test data.

It runs the new test several times to check it is steady, and reports the result along with anything that needs a data-test attribute in the app.

Example

you › /e2e-scenario a new user signs up, verifies email and creates a first project

agent › Created e2e/signup-first-project.spec.ts (Playwright). 6 steps, email read through the mail sandbox API.
3 of 3 runs passed in 14 s each. Needs data-testid="create-project" on the empty-state button. Add it?

Questions

What if I have no e2e framework?
It recommends one, explains why, and waits for your approval before installing anything.
How does it avoid flaky tests?
It waits on conditions rather than time, uses stable selectors, isolates data and runs the test repeatedly before finishing.
  • Add Edge Case Tests

    CommandTesting

    Free
  • Add Regression Test

    CommandTesting

    Free
  • Coverage Gaps

    CommandTesting

    Free
  • Fix Failing Tests

    CommandTesting

    Free