Open-source npm tool that scaffolds Playwright TypeScript tests, page objects, and self-healing locators directly from your .feature files. Same engine that powers TestForge AI; use it standalone or as part of the platform.
Install
$ npm install --save-dev @vijaypjavvadi/bdd2pw
Point it at a directory of .feature files and a target URL. bdd2pw scans the live application, builds a page-object model from the DOM, and emits Playwright test files that compile cleanly and run on day one.
# Scaffold tests from every feature against a live app
$ npx bdd2pw scaffold features/ \
--url https://staging.acme.com \
--page Login --self-healing
# Outputs:
# pages/login.page.ts ← Page Object
# tests/login.spec.ts ← Playwright test
# playwright.config.ts ← Configured runner
# BDD_REVIEW.md ← What was generated, what needs review
Smart step routing
Verbs like 'is visible' route to toBeVisible(); 'navigates to' routes to toHaveURL(). No generic locator(':root') fallbacks.
Live page scanning via Playwright MCP
Scans the live application through Microsoft's Playwright MCP server, detects existing Page Objects, and only emits what's actually missing.
Self-healing locators
Optional --self-healing wraps every locator with a heal-or-throw retry that falls back to role / label / accessible-name.
Governed LLM fallback
Optional --llm anthropic / openai / gemini for steps that don't match the built-in routing. Every prompt scrubbed; full audit trail.
CLI and HTTP service
Use as a one-shot CLI in CI, or run it long-lived as an HTTP service for IDE plugins and editor integrations.
Powered by pw-emit
Built on @vijaypjavvadi/pw-emit, the shared emitter library that also powers sel2pw. One IR, two front ends.
TestForge AI is a hosted platform built on the assumption that generating Playwright tests should be a solved problem. The hard parts of test automation — triage, healing, narrative analysis — only become tractable once the boilerplate of writing the tests is gone.
bdd2pw is the engine that solves the boilerplate. We open-sourced it because the ecosystem is better when the foundational building blocks are inspectable, forkable, and free. The hosted TestForge platform adds the test-run pipeline, AI defect analysis, visual regression, and the rest of the system around it — but bdd2pw on its own is genuinely useful, and we encourage you to use it standalone if that's what you need.
Contributions, issues, and discussions are welcome on GitHub.
bdd2pw handles the generation step. TestForge AI is what happens around it.
bdd2pw on its own
TestForge AI platform