npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

pwtgen

v2.3.13

Published

AI-Powered Playwright Test Generator CLI - Modernized

Downloads

214

Readme

pwtgen: Playwright MCP-Powered Test Generator CLI (with RAG)

pwtgen is a CLI tool for generating Playwright tests directly from Jira tickets using the Playwright MCP server, now enhanced with RAG (Retrieval-Augmented Generation).

Jira card → RAG (KB context) → Playwright MCP server → Playwright test file

  • Only the Playwright MCP server is used for test generation.
  • RAG retrieves relevant selectors, workflows, and patterns from your knowledge base and includes them in the prompt sent to the MCP server.
  • The CLI sends Jira card contents and KB context to the Playwright MCP server, which generates a ready-to-run Playwright test file.

Onboarding Checklist (Playwright MCP + RAG)

  1. Install dependencies:
    npm install
  2. Set up your .env file with required credentials (see docs/environment.md).
    • Ensure your OpenAI API key is set for RAG embedding.
  3. Configure your Playwright MCP server in mcp.json:
    {
      "mcpServers": {
        "playwright": {
          "command": "npm",
          "args": ["run", "mcp:playwright"]
        }
      }
    }
    • The CLI will validate your MCP config and provide clear error messages if missing or invalid.
  4. Run the MCP server (the CLI will start it automatically during test generation).
  5. New: During onboarding (pwtgen wizard), you can now capture a snapshot of any page for context embeddings:
    • You will be prompted for a URL.
    • Playwright will navigate to the URL, capture the full HTML, and save it as snapshot.html.
    • The snapshot is automatically added to your knowledge base for future embeddings.
  6. Use pwtgen gen --mcp to generate tests from Jira tickets:
    pwtgen gen --mcp --ticket <JIRA_KEY>
    • The CLI will send the Jira card contents and KB context to the Playwright MCP server and save the generated test to tests/e2e/<JIRA_KEY>.spec.ts.
  7. Review and edit generated tests as needed.
  8. Refer to CLI usage and environment setup guides for troubleshooting.

Quickstart (Playwright MCP + RAG)

Install globally:

npm install -g pwtgen

Or run directly with npx:

npx pwtgen gen --mcp --ticket <JIRA_KEY>

CLI Commands & Example Usage

  • pwtgen gen --mcp --ticket <JIRA_KEY>
    • Uses RAG to retrieve KB context, sends Jira card and KB context to the Playwright MCP server, and generates a Playwright test file.
    • Example:
      pwtgen gen --mcp --ticket QA-123
      # Output: tests/e2e/QA-123.spec.ts
  • pwtgen wizard
    • Interactive onboarding wizard for first-time setup and configuration.
    • New: Includes a step to capture a page snapshot for context embeddings.

Troubleshooting

  • Missing MCP config: The CLI will show a clear error and copy-paste instructions for setup.
  • MCP server not running: The CLI will attempt to start the server automatically and report any issues.
  • Test not generated: Ensure your Jira card has sufficient details, KB is populated, and the MCP server is configured correctly.

Advanced Usage

  • Only the Playwright MCP server is supported for test generation. RAG is used to enhance prompts with KB context.
  • Knowledge base and RAG features are for embedding and reference, and now directly inform test generation.
  • Page snapshot onboarding: Use the wizard to capture and embed page context for richer test generation.

For more details, see:

  • docs/CLI-USAGE-GUIDE.md
  • docs/architecture.md
  • docs/environment.md