A deterministic QA tool that converts manual test steps (plain text) into a single, immediately runnable Playwright TypeScript test.
This project is intentionally narrow in scope. It is designed to be predictable, boring, and reliable — not “smart.”
- Go to https://www.saucedemo.com
- Enter username standard_user
- Enter password secret_sauce
- Click Login
- Verify Products is visible
import { test, expect } from '@playwright/test';
test('Login and verify products title visible', async ({ page }) => {
await page.goto('https://www.saucedemo.com');
await page.getByTestId('username').fill('standard_user');
await page.getByTestId('password').fill('secret_sauce');
await page.getByTestId('login-button').click();
await expect(page.getByTestId('title')).toBeVisible();
});- VS Code
- Node.js (LTS recommended)
- An existing Playwright project
- If needed:
npm init playwright@latest
- If needed:
- Playwright installed (
npx playwright install) - An OpenAI API key (API usage billed directly by OpenAI)
- You control API costs
- No vendor lock-in
- No usage markup
- No data stored by this tool
- Typical cost per generation: a few cents
- Converts copied/pasted manual test steps into:
- One Playwright
.spec.tsfile - One
test()per file
- One Playwright
- Output is immediately runnable (paste → save → run)
- Uses deterministic selectors only
- Prefers
data-testid, thenrole, thenlabel - No guessing, no DOM scraping, no heuristics
- Prefers
- Designed and validated specifically against saucedemo.com
- Intended for QA engineers, not end users
The codebase supports two generation paths:
Manual Steps
→ LLM
→ Playwright TypeScript test
This is the workflow shown in the demo. Internally, the extension now uses the V1.5 structured pipeline while preserving the same user experience.
Manual Steps
→ LLM
→ Structured JSON (schema-enforced)
→ Renderer
→ Playwright TypeScript test
Key idea:
- The LLM does NOT directly generate test code
- It produces structured JSON first
- A renderer converts that JSON into deterministic Playwright code
Why this matters:
- More consistent output
- Reduced variability across runs
- Clear validation boundaries between planning and execution
Note: V1.5 is now used internally by the extension’s Generate flow, while maintaining the same user experience.
- ❌ No DOM inspection or auto-discovery
- ❌ No Excel ingestion (copy/paste only)
- ❌ No multi-test generation
- ❌ No retries, waits, or “smart” timing logic
- ❌ No framework abstraction
- ❌ No AI reasoning about intent beyond explicit rules
- ❌ No general-purpose website support
If a scenario is not explicitly supported, the output is allowed to fail.
This tool is a good fit if you:
- Are comfortable running Playwright locally
- Want a repeatable workflow for generating a Playwright test draft from written steps
- Are OK refining selectors after inspecting the real DOM (expected by design)
- Can supply your own OpenAI API key for local execution (
OPENAI_API_KEY)
This tool is not a fit if you expect:
- DOM auto-discovery or scraping
- Self-healing automation
- A SaaS / hosted product
- Guaranteed “first run pass” on arbitrary websites
The following scenarios have been generated, saved, and executed successfully:
- Login and add item to cart
- Add multiple items and remove one
- Checkout complete order
- Negative login (locked-out user)
- Cart badge state changes (0 → 1 → 2)
- Product sorting (low to high price)
These scenarios define the functional contract of V1.
- Clone the repository:
git clone <repo-url>
cd playwright-gen-prototype(In GitHub, click Code → copy the HTTPS URL)
- Install dependencies:
npm install- Open the project in VS Code:
code .-
Start the VS Code extension:
-
Press F5 to launch the extension in a new Extension Development Host window
-
In that new window, open your Playwright project (the repo where you will run tests)
-
-
Generate a test:
- Paste your manual test steps
- Click Generate
- Click Save .spec.ts
- The generated
.spec.tsfile is saved into your Playwright project under the generator’s configured output directory
-
Run via:
npx playwright test <path-to-the-generated-spec-file>
- Use the relative path to the generated
.spec.tsfile in your Playwright project.
- Use the relative path to the generated
If these steps complete without error, your setup is correct.
- Valid Playwright API usage only
- No markdown, commentary, or explanations in generated output
- Stable selectors preferred
- One test file per scenario
- One
test()per file - Output is readable, editable, and production-style
This describes the intended usage pattern once the extension is running.
-
Open an Excel sheet containing manual test steps
-
Copy steps (including a
Test Name:line if desired) -
Paste into the VS Code extension UI
-
Click Generate
-
Click Save .spec.ts
-
Run via:
npx playwright test
<path-to-the-generated-spec-file>
- (Use the relative path to the generated
.spec.tsfile in your Playwright project.)
- Observe pass/fail output
This workflow is intentional and part of the design.
playwright-gen-prototype/
├── README.md # Product spec & usage contract
├── generator.js # Core generation logic (V1 + V1.5 schema mode)
├── renderer.js # Converts structured JSON → Playwright test
├── index.js # CLI / entry wiring
├── vscode-extension/
│ └── extension.js # VS Code UI integration (V1 locked)
├── package.json
└── package-lock.json
Most users will interact only with:
- The VS Code extension UI
- The generated
.spec.tsoutput - Their own Playwright project
- Generator core source code
- VS Code extension for local use
- Documentation defining supported behavior and scope
- A deterministic workflow: paste → generate → save → run
- V1 is frozen
- Any enhancements must:
- Be explicitly defined
- Be validated with passing scenarios
- Move into V1.5 or V2
- Be documented before implementation
No silent scope expansion.
- Senior QA engineers
- Test automation engineers
- Teams converting manual regression suites to Playwright
- Internal tooling / proof-of-concept automation accelerators
This is not a low-code testing product.
MIT License. See LICENSE.
Best-effort support via GitHub Issues. PRs are welcome.
V1 is considered DONE when all are true:
- Paste manual steps into VS Code extension UI
- Click Generate
- Click Save .spec.ts
- Click
▶️ Run (or run via terminal) - Test passes without editing generated code
- Output is only valid TypeScript (no markdown, no prose)
- Exactly one test('...', async ({ page }) => { ... })
- Uses locator actions correctly (locator.click(), locator.fill())
- Never does invalid calls like page.click(locator)
- Assertions use await expect(...)
- Prefers stable selectors (getByTestId, getByRole, getByLabel)
- Avoids .nth() unless it’s a true last resort
- When product names are specified, targets those products explicitly
- Login fields use test ids: username, password, login-button
- Page header uses page.getByTestId('title')
- Cart link uses page.getByTestId('shopping-cart-link')
- Checkout step-one fields use firstName, lastName, postalCode
- Cart badge count uses .shopping_cart_badge:
- Empty → toHaveCount(0)
- After 1 add → toHaveText('1')
- After 2 adds → toHaveText('2')
- Scenario 1: login + add to cart + verify (PASS)
- Scenario 2: add 2 items → remove 1 → verify count (PASS)
- Scenario 3: checkout complete order (PASS)
- Scenario 4: locked-out user shows error (PASS)
- Scenario 5: cart badge increments 0 → 1 → 2 (PASS)
- Any new functionality goes into V1.5+
- Generator instructions may not change without README update
- SauceDemo rules stay clearly labeled as app-specific
