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

@bloom-perf/yaml-pptr

v2.0.2

Published

A library to generate puppeteer browser controls through a YAML api.

Readme

yaml-pptr

npm version GitHub last commit GitHub Workflow Status GitHub release License

yaml-pptr is a library that allows you to control web browsers using Puppeteer by defining your scenarios in YAML. No more verbose Puppeteer scripts - just simple, human-readable configuration files.

Installation

npm install @bloom-perf/yaml-pptr

Quick Start

import { readYamlAndInterpret } from '@bloom-perf/yaml-pptr';

const yaml = `
scenarios:
  - name: Login Test
    location: "https://www.saucedemo.com"
    steps:
      - input:
          selector: "#user-name"
          text: "standard_user"
      - input:
          selector: "#password"
          text: "secret_sauce"
      - click: "#login-button"
      - wait: 2
`;

readYamlAndInterpret(yaml);

Examples

Ready-to-run examples are available in the examples/ directory:

npm run example:login   # Login test with screenshot
npm run example:load    # Load test (3 workers × 2 iterations)

Getting Started

Project Structure

my-automation/
├── scenarios/
│   └── login-test.yaml
├── src/
│   └── runner.ts
├── package.json
└── tsconfig.json

1. Create a YAML scenario

scenarios/login-test.yaml

scenarios:
  - name: Sauce Demo Login
    location: "https://www.saucedemo.com"
    steps:
      - input:
          selector: "#user-name"
          text: "standard_user"
      - input:
          selector: "#password"
          text: "secret_sauce"
      - click: "#login-button"
      - wait: 2
    actions:
      - type: WAIT_FOR_SELECTOR
        selector: ".inventory_list"
        options:
          visible: true
      - type: SCREENSHOT
        path: "screenshots/result.png"
        options:
          fullPage: true

2. Create a runner script

src/runner.ts

import { readYamlAndInterpret } from '@bloom-perf/yaml-pptr';
import * as fs from 'fs';

const yaml = fs.readFileSync('./scenarios/login-test.yaml', 'utf-8');

fs.mkdirSync('./screenshots', { recursive: true });

readYamlAndInterpret(yaml)
  .then(() => console.log('Done!'))
  .catch(console.error);

3. Run it

npx ts-node src/runner.ts

YAML Reference

Scenario Configuration

| Property | Type | Default | Description | | -------- | ---- | ------- | ----------- | | name | string | Scenario N | Scenario name | | browser | chrome | firefox | chrome | Browser to use | | run | PARALLEL | SEQUENTIAL | PARALLEL | Worker start strategy | | initialDelaySeconds | number | 0 | Delay before starting | | workers | number | 1 | Number of parallel workers | | iterations | number | 1 | Repetitions per worker | | location | string | - | Starting URL | | steps | array | - | Simplified syntax | | actions | array | - | Full syntax with options |

Steps (Simplified Syntax)

click

- click: "#submit-button"

input

- input:
    selector: "#username"
    text: "myuser"

navigate

- navigate: "http://example.com"
- navigate: "$ENV_VAR"

wait

- wait: 3  # seconds

waitForever

- waitForever

Actions (Full Syntax)

Use actions instead of steps when you need advanced options.

GOTO

- type: GOTO
  url: "http://example.com"
  options:
    timeout: 30000
    waitUntil: networkidle0  # load | domcontentloaded | networkidle0 | networkidle2
    referer: "http://referrer.com"

CLICK

- type: CLICK
  selector: "#button"
  options:
    button: left     # left | right | middle
    clickCount: 2    # double-click
    delay: 100       # ms between mousedown/mouseup

TYPE

- type: TYPE
  selector: "#input"
  text: "Hello"
  options:
    delay: 50  # ms between keystrokes

WAIT

- type: WAIT
  milliseconds: 2000

WAIT_FOR_SELECTOR

- type: WAIT_FOR_SELECTOR
  selector: ".loaded"
  options:
    visible: true
    hidden: false
    timeout: 5000

WAIT_FOR_TIMEOUT

- type: WAIT_FOR_TIMEOUT
  timeout: 1000

SCREENSHOT

- type: SCREENSHOT
  path: "screenshot.png"
  options:
    type: png          # png | jpeg
    quality: 80        # jpeg quality (0-100)
    fullPage: true
    omitBackground: false
    encoding: binary   # binary | base64
    clip:
      x: 0
      y: 0
      width: 800
      height: 600

EVALUATE

- type: EVALUATE
  script: "document.title"

SET_VIEWPORT

- type: SET_VIEWPORT
  width: 1920
  height: 1080

PAUSE

- type: PAUSE  # Press Enter to continue

CLOSE

- type: CLOSE

Environment Variables

Use $VAR_NAME syntax in location or navigate:

location: "$BASE_URL"
BASE_URL=https://example.com npx ts-node runner.ts

Indexed Variables

Assign different values to each worker using $VAR[workerIndex]:

scenarios:
  - name: Multi-URL Test
    workers: 3
    location: "$URLS[workerIndex]"
    steps:
      - wait: 2
URLS="https://site1.com,https://site2.com,https://site3.com" npx ts-node runner.ts

Worker 0 gets site1.com, worker 1 gets site2.com, etc.

Load Testing Example

scenarios:
  - name: Load Test
    run: PARALLEL
    workers: 10
    iterations: 5
    location: "https://example.com"
    steps:
      - click: "#action-button"
      - wait: 1

This runs 10 workers in parallel, each executing the scenario 5 times.

Development

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Build
npm run build

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

Apache 2.0