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 🙏

© 2024 – Pkg Stats / Ryan Hefner

snaptest

v0.0.6

Published

automated website screenshotting command line tool and library

Downloads

4

Readme

Installation

npm install snaptest -g

Usage

CLI

snaptest

This command will run through the snaptest.config file in the current directory. If it is not found, a generic one will be made.

snaptest-rails

This command is the same as snaptest, but it will go talk to your Rails application to mine your "named routes" and add them to the Snaptest.path array as long as the directory you run this from is a Rails application.

snaptest.config

This file determines how snaptest will run - everything from mananging states or to the width at which you'd like to snap screenshots. Here's a sample snaptest.config file below:

{
  "host": "www.yoursitehere.com", // string. required. snaptest will run all paths against this host.
  "width": 1024, // integer. default is 1024 if not set. snaptest will hit each path with this width.
  "height": 768, // integer. default is 768 if not set. snaptest will hit each path with this height.
  "ignore": [ "some_path", ... ], // array[string]. contains a list of path names to not visit.
  "paths": {
    "some_path": { // string. name of the path.
      "path": "/path", // string. path to visit. will be added to host. can be a fully-qualified URL.
      "params": { "key": "value", ... }, // Object. will populate $key$ with value in path.
      "cases": [ // array[Object]. contains a list of case configurations. will screenshot after every case.
        {
          "name": "Case Name", // string. a name for the case.
          "actions": [ // array[Object]. will perform each nightmare action after visiting the path.
            { "nightmareAction": [ "nightmareArg1", "nightmareArg2", ... ] },
            ...
          ],
          "params": { "key": "value", ... }, // Object. will populate $key$ with value in path.
          "only": [ "Another State", ... ], // array[string]. will only perform the case for the states listed.
          "except": [ "A State", ... ] // array[string]. will only perform the case for states not listed.
        }
      ]
    }
  },
  "states": { // Object. each attribute represents the name of a state. will visit each path once in each state.
    "A State": {
      "width": 1024, // integer. sets the width of the viewport for a state.
      "height": 768, // integer. sets the height of the viewport for a state.
      "partial": true // boolean. if set to true, it will not visit any paths.
    },
    "Another State": {
      "before" : [ // array[Object]. will perform each nightmare action before visiting the path.
        { "nightmareAction": [ "nightmareArg1", "nightmareArg2", ... ] },
        ...
      ]
      "ignore": [ "some_path", ... ], // array[string]. paths the state will not visit.
      "inherits": [ "A State", ... ] // array[string]. gains attributes of listed states.
    },
  }
}

Nightmare actions

Wherever you see "nightmareAction" in snaptest.config you may use any of the actions listed at https://github.com/segmentio/nightmare#interact. For actions requiring no arguments, pass an empty array.

Versions

0.0.6 - Actually fixed the bug that 0.0.5 should have fixed!
0.0.5 - Fixed state inheritance issue.
0.0.4 - Fixed a bug with new height option.
0.0.3 - Added support for a new height config option.
0.0.2 - Fixed a bug when no states exist in snaptest.config.
0.0.1 - Initial release.