Open source · MITv3.9.0 · npm

bdd2pw
Gherkin → Playwright, generated.

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

What bdd2pw does

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.

CLI
# 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.

Why we built bdd2pw — and why it's open source

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 standalone vs. TestForge AI

bdd2pw handles the generation step. TestForge AI is what happens around it.

bdd2pw on its own

  • ✓ Scaffolds Playwright tests + page objects + config
  • ✓ Self-healing locators (opt-in)
  • ✓ Anthropic LLM fallback for unmatched steps
  • ✓ Free, MIT-licensed, runs in your CI
  • — You run the tests, capture artefacts, triage failures, manage page objects over time

TestForge AI platform

  • ✓ Everything bdd2pw does, hosted
  • ✓ Generates scenarios from your PRD before bdd2pw runs
  • ✓ Runs every test in a disposable Docker container
  • ✓ Per-step visual regression baselines + diffs
  • ✓ AI Defect Analysis with four-section plain-English narratives
  • ✓ Drafts Jira tickets for every real-defect verdict
  • ✓ Self-healing graduation — locator drift learned and surfaced
Start Free — no credit card →