This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

puppetbox

0.1.0 • Public • Published

puppetbox

Node.js CI

Capture screenshots of HTML using Chrome's headless mode.

Requirements

Why puppetbox?

  • Its code base is tiny and maintainable.
  • It's framework-agnostic. All that is needed to get started is a HTML string.

Installation

$ npm i -D puppetbox

Usage

puppetbox allows you to capture screenshots using headless Chrome by entering a HTML string. For visual regression testing, a screenshot could later be compared using looks-same.

import { capture, htmlEnvelope } from "puppetbox";
import { writeFileSync } from "fs";

(async () => {
  const input = htmlEnvelope("<p>hello world</p>");

  const screenshot = await capture(input, {
    height: 100,
    width: 100
  });
  writeFileSync(`example.png`, screenshot)
})();

screenshot of "example.png" below:

example.png

Notes

Changelog

0.1.0

Stop embedding fragments in HTML doc.

  • Stop exporting capture as default
  • Export htmlEnvelope function
  • Add tests for capture and htmlEnvelope functions
  • Add Note about how headless Chrome renders fragments differently from documents

0.0.1

  • Release initial version

License

See License.

Package Sidebar

Install

npm i puppetbox

Weekly Downloads

0

Version

0.1.0

License

GPL-3.0-only

Unpacked Size

14.3 kB

Total Files

11

Last publish

Collaborators

  • timdaub