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

@quantum-sec/visual-regression-testing

v1.1.0

Published

Wrapper utility for performing BackstopJS visual regression tests and storing artifacts in S3.

Downloads

3

Readme

visual-regression-testing

Wrapper utility for performing BackstopJS visual regression tests and storing artifacts (reference sets and reports) in S3.

Usage

AWS Credentials

The reference sets are stored in AWS S3, so you'll need to set your AWS credentials on your environment prior to running this utility.

Running with NPX

# Run scenarios and collect a baseline
npx --yes --package @quantum-sec/visual-regression-testing --call 'vreg-test [args]'

# Approve the baseline to create a reference set
npx --yes --package @quantum-sec/visual-regression-testing --call 'vreg-approve [args]'
  • The vreg-test command performs a visual regression test against the current reference set.
  • The vreg-approve command promotes the most recent test result set as the new reference set.

Arguments

  • --config – optionally specify a path to the .vregrc.json file. (default: $PWD)

Configuration

You should create a .vregrc.json file with the following configuration parameters:

{
  "project": "Example",
  "scenariosPath": "./vreg/scenarios/",
  "baseUrl": "https://quantum-sec-dev.refined.site",
  "viewports": [
    "sm",
    "lg",
    { "label": "custom", "width": 1024, "height": 768 },
  ],
  "s3BucketName": "vreg.dev.platform.quantum.security",
  "s3BucketRegion": "ap-southeast-1",
  "storageKey": "example"
}
  • project – the name of the project or test suite (used for display purposes only)
  • scenariosPath – the starting path to search for scenario (.vreg.js) files. (default: ./vreg/scenarios/)
  • baseUrl - the URL of the application being tested; note that if you use localhost and run this on a build server the possibility of port binding conflict exists.
  • viewports – a list of viewport sizes to test; this can be either a list of preset breakpoints (i.e. xs, sm, md, lg, xl, xxl, or max) or an object containing label, width, and height properties.
  • s3BucketName – the name of the S3 bucket in which reference sets and reports are stored
  • s3BucketRegion – the AWS region in which the S3 bucket resides
  • storageKey – the folder within the S3 bucket in which reference sets and reports are stored

Defining Visual Regression Tests

The utility will search your project for .vreg.js files and include them in the test suite. These files should be CommonJS modules that export an object with the options provided by BackstopJS. See https://github.com/garris/BackstopJS#using-backstopjs

module.exports = [{
  label: 'example',
  url: '/',
  readySelector: 'h1.site-title',
  delay: 2000, // Allow time for images to load
}];

Note that the url property should be relative unless you're testing something outside of the baseUrl you defined in your .vregrc.json file (uncommon).