💻 Coding

Playwright e2e Scaffold from a User Journey (No Invented Selectors)

Scaffold Playwright tests from a pasted user journey. No invented selectors, URLs, or auth secrets.

0.0
0Reviews
P
August 26, 2026

Prompt

Act as a QA engineer writing a Playwright test scaffold from a user journey. You write Playwright Test TypeScript (v1.47 style) from a journey the user pastes. You only use selectors, roles, and URLs that appear in Inputs. You do not invent data-testid values, email addresses, or storageState files. This is not Cypress and not a unit test.
You work only from Inputs. Do not invent stats, citations, quotes, URLs, names, IDs, or records that are not in Inputs.

Inputs:
- Playwright version lock: [Version]
- Base URL: [Base]
- Journey steps (action + selector or role I can prove): [Journey]
- Assertions I can prove (text, URL, status): [Assert]
- Auth setup I can prove (storageState path or env name): [Auth or NONE]
- Projects/browsers I allow: [Browsers]
- Fixtures or test ids I actually have: [Fixtures]
- What I must never click or call: [Never]
- Words I must not use: [Banned]
- Timeout overrides I can prove (or NONE): [Timeout]

Generate:
1. Honesty ledger: version, base, every selector in Journey, browsers, auth. Forbidden: testids and URLs not listed.
2. playwright.config.ts sketch: testDir, baseURL, projects from Browsers only. Timeout only from Timeout.
3. spec.ts: one test named from the journey. Each Journey step becomes a locator call using the given selector or getByRole name. If a step has no selector, write NOT IN INPUTS and skip that line rather than guessing [data-testid=submit].
4. Expect: only Assert. Do not add a screenshot assertion unless Inputs asked.
5. Auth: use Auth storageState or env name. If NONE, leave the test unauthenticated and say so.
6. Never: comment a blocklist of Never locators.
7. Run notes: npx playwright test pinned to Version. No invented grep tags.
8. Compliance pass: quote Banned words, invented selectors, Cypress cy.get. Cut them.

Constraints:
- Playwright Test TypeScript only. Not Cypress, not Selenium, not Playwright Python unless Inputs say so.
- Never invent a selector, testid, or URL.
- If a journey step lacks a locator, mark NOT IN INPUTS.
- Do not print secret values. Env names only.
- No emojis.

Instructions

Replace every [bracket] with your details before running. Works on ChatGPT, Claude, and Gemini.

Examples

Example Input

Version: Playwright 1.47.2
Base: https://checkout.northwind.example
Journey: 1 open /pay. 2 fill getByLabel('Card number') with 4111111111111111 (test PAN from our fixture card-visa-ok). 3 fill getByLabel('Expiry') with 12/28. 4 fill getByLabel('CVC') with 123. 5 click getByRole('button', { name: 'Pay now' }). No data-testid on this page.
Assert: URL contains /pay/ok; getByText('Payment received') visible. No amount assertion (amount not in the journey).
Auth: NONE (guest checkout). No storageState.
Browsers: Desktop Chrome only. No Firefox project this week.
Fixtures: test PAN card-visa-ok as above. No saved-address fixture.
Never: refund button, /admin, real PAN
Banned: data-testid=pay, cy.get, Firefox, $99.00
Timeout: NONE (keep defaults)

Example Output

1. Ledger. Playwright 1.47.2. Base https://checkout.northwind.example. Locators: getByLabel Card number, Expiry, CVC; getByRole button Pay now; getByText Payment received. Auth NONE. Browser Desktop Chrome. Forbidden: data-testid=pay, cy.get, Firefox, $99.00, /admin, real PAN.

2. config. testDir e2e. baseURL as Base. projects: Desktop Chrome only. timeout: default, NONE override.

3. spec. test('guest pay now'). page.goto('/pay'). fill card, expiry, CVC with fixture card-visa-ok values. click Pay now. No getByTestId.

4. Expect. toHaveURL /pay/ok. getByText('Payment received') visible. Amount: NOT IN INPUTS.

5. Auth. Guest. No storageState.

6. Never. Do not click refund. Do not goto /admin. Do not type a live PAN.

7. Run. npx playwright test @1.47.2. Chromium project only.

8. Compliance. Cut banned selectors and Cypress. Gaps: amount, Firefox, timeout, storageState, postal-code field (not in Journey).

Missing-data policy: if a field was blank, write NOT IN INPUTS rather than guessing. Lock any tool version named in Inputs; if unnamed, write unknown. No invented testimonials, star ratings, or press logos. If legal, clinical, insurance, HR, education-plan, or veterinary content appears, add a one-line not-advice and de-identify banner. Quote banned-word hits and cut them. End with a gaps list of five bullets the user still owes you. Character and byte caps in the job are hard; print counts when relevant. Refuse to backfill DOIs, exam dumps, PHI, PII, or compensation promises not in Inputs.

Reviews (0)

Please login to leave a review.
Loading reviews...