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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cypress-repeat-snapshot

v0.1.3

Published

A repeater for Cypress.

Readme

Cypress Match Repeat Snapshot

A Cypress plugin aims to test interaction easily.

Install

Install with npm

$ npm install cypress-repeat-snapshot --save-dev

Configure

// cypress/plugins/index
const { addMatchRepeaterPlugin } = require('cypress-repeat-snapshot/lib/plugin');

module.exports = (on, config) => {
  addMatchRepeaterPlugin(on, config);
};

// cypress/support/commands
import { addMatchRepeaterCommand } from 'cypress-repeat-snapshot/lib/command';

addMatchRepeaterCommand();

// Command name is `toMatchRepeatSnapshot` by default.
// Options can be passed as a default options here or you can pass it to `toMatchRepeatSnapshot` command.
addMatchRepeaterCommand(commandName, options);

At this point, the command is available.

// sometest.spec.js
cy.toMatchRepeatSnapshot(name, snapshot)

It you need typescript intellisense support, add triple slash directive to your spec file.

/// <reference types="cypress-repeat-snapshot" />

Usage

basic

You can pass the snapshot(JSON file from repeater), then the repeater will run automatically.

// sometest.spec.js

// just take a screenshot
cy.toMatchRepeatSnapshot()

// repeat actions and take a snapshot
cy.toMatchRepeatSnapshot(snapshot)

// repeat actions and take a snapshot whose file name is `snapshotName`
cy.toMatchRepeatSnapshot(snapshotName, snapshot)

// pass options in single test
cy.toMatchRepeatSnapshot(snapshotName, snapshot, options)

// take a screenshot of selected element
cy.get('selector').toMatchRepeatSnapshot(...)

Or you can just write it by yourself, the file will looks like this:

{
  "viewport": {
    "width": 1000,
    "height": 1000,
  },
  "events": [
    {
      "type": "mousedown",
      "x": 10,
      "y": 10,
      "ts": 100,
    }
  ]
}

After the test finished, you can check screenshots in /cypress/__repeater__snapshots.

Options

You can pass any options which is jest-image-snapshot or cy.screenshot options.

For example, you can set customSnapshotsDir or customDiffDir which is the property of the jest-image-snapshot's options:

cy.toMatchSnapshot(snapshot, {
  customSnapshotsDir: '../__cypress__repeater__snapshots',
  customDiffDir: '../__cypress__repeater__snapshots/__diff__output'
})

Custom event properties

Any event properties can be added in repeater JSON file and it will be passed to event triggered.

// repeater.json
{
  "type": "mousedown",
  "button": 0,
  "bubbles": false
}

Updating snapshots

Run Cypress with --env updateSnapshots=true in order to update the base image files for all of your tests.

Preventing failures

Run Cypress with --env failOnSnapshotDiff=false in order to prevent test failures when an image diff does not pass.

Other features

How it works

The workflow of call toMatchRepeatSnapshot(name, json):