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 🙏

© 2026 – Pkg Stats / Ryan Hefner

visual-docs-playwright

v0.0.1

Published

Build a visual documentation from playwright tests

Readme

Visual Docs Playwright

Build visual documentation from Playwright tests by automatically capturing and organizing screenshots of your application's UI states.

Summary

Visual Docs Playwright is a tool that generates visual documentation from your Playwright tests. It captures screenshots during test execution and creates an organized documentation website. This helps teams maintain up-to-date UI documentation, validate design consistency, and communicate UI states across the organization.

Installation

# Using pnpm
pnpm install -D visual-docs-playwright

# Using npm
npm install --save-dev visual-docs-playwright

# Using yarn
yarn add -D visual-docs-playwright

Using in Your Project

Create an end to end test folder at the root of your project. Default name is e2e-tests, but you can name it anything you want.

Add your tests in the folder. e2e-tests/my-flow.spec.ts

Have only one test per file.

In the test, add annotations to describe the UI state you want to capture.

test(
    'My workflow title',
    {
        annoation: {
            type: 'Group name',
            description: `Your flow description

You can add anything you want here, as long as it is valid markdown.
- Lists
- Links
- Images
- Tables
- ...
`
        }
    }
    async ({ page }, testInfo) => {
  // You test code
});

The test name (My workflow title in the example above) will be used as the title of the page.

The type (Group name in the example above) will be used to groups multiple test pages.

In your test code, you can add sections and screenshots :

import { addDocumentationScreenshot, addDocumentationSection } from 'visual-docs-playwright';

// ...
    async ({ page }, testInfo) => {
        // ...
        await addDocumentationSection(
            testInfo,
            'Section title',
            'Section description (markdown)'
        );

        // ...

        await addDocumentationScreenshot(
            page,
            testInfo,
            'Screenshot title',
            'Screenshot description (markdown)'
        );
// ...

In addDocumentationScreenshot, the title and the description are optional.

Usually, you would create sections in your test like Authentication success or Autentication failure for invalid email and then proceed to add screenshots after every relevant step. If the tests are too long, you should split them into multiple files and group them under the same type.

Generating Documentation Locally

Run your Playwright tests with the visual docs reporter:

# Run tests and generate documentation
npx playwright test

# Start the documentation server
npx visual-docs-playwright serve

# Generate static documentation
npx visual-docs-playwright build

Pay attention to the fact that the application should be running when you generate the documentation. Playwright is an end to end testing tool, so it will not run the application for you.

CLI Options

Usage: visual-docs-playwright [command] [options]

Commands:
  build          Generate static documentation

Options:
    -d, --test-dir       <path>    Directory containing test files  ./e2e-tests
    -o, --output-dir     <path>    Directory containing the build   ./__generated_visual_doc
    -t, --timeout        <ms>      Timeout in milliseconds          30000
    -b, --browser        <browser> Browser to use                   chromium
    -u, --base-url       <url>     Base URL to use                  http://localhost:8181
    -u, --base-url       <url>     Base URL to use                  http://localhost:8181
    -w, --workers        <number>  Number of worker threads         1
    -r, --retry-failures <number>  Retry failed tests               0
    -n, --project-name   <name>    Project name                     Generated documentation
    -g, --repository-url <url>     Repository URL                   ''

Continuous Integration

GitHub Actions Example

name: Visual Documentation

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Setup Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '18'

    - name: Install dependencies
      run: npm ci

    - name: Install Playwright browsers
      run: npx playwright install --with-deps

    - name: Run tests and generate documentation
      run: |
        npx playwright test
        npx visual-docs-playwright build

    - name: Deploy to GitHub Pages
      uses: peaceiris/actions-gh-pages@v3
      if: github.ref == 'refs/heads/main'
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./visual-docs

Contributing

Contributions are welcome!

License

MIT