• This repository has been archived on 03/Nov/2019
  • Stars
    star
    125
  • Rank 284,914 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automated visual testing for React Styleguidist, using Puppeteer and pixelmatch.

Visual Testing for React Styleguidist Version Build Status

Allows you to do easy visual diffing of your React Styleguidist examples.

Demo of react-styleguidist-visual

Installation

Add the dependency to your project:

$ npm install --save-dev react-styleguidist-visual

Usage

Point the tool to your styleguide:

$ npx styleguidist-visual test --url "https://react-styleguidist.js.org/examples/basic/"

You can also test against your local style guide. The following command will first build the style guide and then run the visual test.

$ npx styleguidist build && styleguidist-visual test --url \"file://$(pwd)/styleguide/index.html\"

The first time you run the tool, it will create reference screenshots for all examples in your styleguide, and store them in the styleguide-visual folder. If you run the same command again, it will take new screenshots, compare them to the reference ones, and show you the differences between them.

If the new screenshots look good, you can promote them to be the new reference files by running:

$ npx styleguidist-visual approve

Options

You can see all possible options by appending the --help argument to any command:

$ npx styleguidist-visual --help
$ npx styleguidist-visual test --help
$ npx styleguidist-visual approve --help

Action States

You can capture screenshots after simulating an action, by providing a JSON.stringifyed list of actions as props to the component wrapper like this:

```js { "props": { "data-action-states": "[{\"action\":\"none\"},{\"action\":\"hover\",\"selector\":\".my-button\",\"wait\":\"1000\"},{\"action\":\"focus\",\"selector\":\".my-button\"},{\"action\":\"keyPress\",\"key\":\"Tab\"}]" } }
<Button className="my-button" />
```

Available actions are:

  • none - Capture the component without performing an action.
  • hover - Provide a selector to hover over.
  • focus - Provide a selector to focus on.
  • click - Provide a selector to click on.
  • mouseDown - Provide a selector to mouse down on.
  • keyPress - Provide a key to press.
  • wait - An optional time in ms to wait between performing the action and snapping the screenshot.

Debugging

Use the DEBUG environment variable to see debugging statements:

$ DEBUG=react-styleguidist-visual npx styleguidist-visual test --url "https://react-styleguidist.js.org/examples/basic/"

Meta

Contributors

License

Copyright (c) 2018 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.

More Repositories

1

stats-webpack-plugin

Write the stats of a Webpack build to a file.
JavaScript
165
star
2

lua-fsm

A simple finite-state machine implementation for Lua.
Lua
79
star
3

palette-creator

Browser extension that allows you to create a color palette from any image.
JavaScript
47
star
4

neuquant-js

NeuQuant neural-network image quantization algorithm.
JavaScript
32
star
5

custom-immutable-matchers

Add a set of custom matchers for Immutable related checks.
JavaScript
26
star
6

webpack-presentation

"Webpack is Awesome" presentation.
JavaScript
24
star
7

jscs-loader

Run your source through the JSCS style checker.
JavaScript
23
star
8

allowlist-manager

Browser extension that automatically blocks all pages from any website that is not in your list of allowed websites.
JavaScript
21
star
9

markdown-it-loader

Parse source as Markdown.
JavaScript
18
star
10

copong-iphone

A Pong clone made with Cocos2D for iPhone.
Objective-C
17
star
11

custom-jquery-matchers

Add a set of custom matchers for HTML and CSS related checks, using jQuery.
JavaScript
14
star
12

jquery-easteregg

A jQuery plugin for including easter eggs triggered by keyboard sequences.
JavaScript
12
star
13

remarkable-loader

Parse source as Markdown.
JavaScript
11
star
14

storybook-addon-rtl

Right-to-left addon for Storybook.
JavaScript
11
star
15

react-redux-winjs-example

Example app using React, Redux and WinJS.
JavaScript
11
star
16

wrap-loader

Add custom content before and after the loaded source.
JavaScript
10
star
17

online-kramdown-sinatra

Online Kramdown editor.
JavaScript
10
star
18

grunt-electron-installer-windows

Create a Windows package for your Electron app.
JavaScript
8
star
19

grunt-electron-installer-debian

Create a Debian package for your Electron app.
JavaScript
7
star
20

webmanifest-loader

Help deal with Web App Manifest files.
JavaScript
7
star
21

grunt-rcedit

Edit resources of EXE files.
JavaScript
7
star
22

grunt-sharp

Resize JPEG, PNG, WebP and TIFF images.
JavaScript
6
star
23

react-puzzle

Sliding puzzle component for React.
JavaScript
5
star
24

unindented-sapper

The source code for my website.
JavaScript
5
star
25

provision-tor-relays-with-ansible

Provision Tor relays with Ansible.
4
star
26

sicp-guile

SICP with Guile.
Scheme
4
star
27

provision-azure-boxes-with-vagrant

Provision Azure boxes with Vagrant.
3
star
28

grunt-npm-command

Run npm commands from Grunt.
JavaScript
3
star
29

fortune-example

Example API using Fortune.js.
JavaScript
3
star
30

fake-json

Generate fake data based on a JSON schema.
JavaScript
3
star
31

puzzle-creator

Browser extension that allows you to create a sliding puzzle from any image.
JavaScript
3
star
32

unindented-contents

The contents for my website.
JavaScript
2
star
33

requirejs-style-plugins

Small set of plugins for RequireJS that deal with CSS and preprocessors.
JavaScript
2
star
34

dotfiles

These are my dotfiles.
Shell
2
star
35

unity-space-shooter

Simple space shooter game built in Unity.
C#
2
star
36

tizen-config-loader

Help deal with Tizen's config files.
JavaScript
2
star
37

toobig

Check file and directory sizes against a budget.
TypeScript
2
star
38

recruit

Simple CRUD app for collecting candidate information at job fairs.
Ruby
2
star
39

azure-pipelines-tasks

Some random VSTS/ADO tasks for my own use.
TypeScript
2
star
40

grunt-electron-installer-redhat

Create a Red Hat package for your Electron app.
JavaScript
2
star
41

defold-astar

Simple A* demo.
Lua
1
star
42

defold-asteroids

Lua
1
star
43

ulmus-loader

Compile Elm files.
JavaScript
1
star
44

dotfiles-windows

These are my dotfiles on Windows.
PowerShell
1
star
45

resume

My resume.
CSS
1
star
46

info-viewer-win

Small open source viewer for NFO, DIZ, and other ASCII art files.
C
1
star
47

spreadsheet-backbone

Spreadsheet built with Backbone.
JavaScript
1
star
48

typescript-at-yammer-presentation

"TypeScript at Yammer" presentation
HTML
1
star
49

dreamhost-tiddlywiki

TiddlyWiki installation, ready to run on my DreamHost shared host.
HTML
1
star
50

unindented-hugo

The source code for my website.
JavaScript
1
star
51

defold-template

Lua
1
star
52

tiles-rails

Windows 8.1 tile helpers for Rails.
Ruby
1
star
53

grunt-legal-eagle

Generate a LICENSE file with all the licenses for your dependencies.
JavaScript
1
star
54

haxe-heaps-game

Haxe
1
star
55

react-native-101-presentation

"React Native 101" presentation.
JavaScript
1
star
56

defold-pong

Pong clone using Defold.
Lua
1
star
57

immutable-redux

Utilities for dealing with Immutable data structures in Redux.
TypeScript
1
star
58

polarclock-chrome

Displays an animated polar clock in the Google Chrome toolbar.
JavaScript
1
star
59

rack-highlighter

Rack Middleware for syntax highlighting.
Ruby
1
star
60

rougher

TypeScript
1
star
61

frontend-scaling-presentation

"The one trick to scaling your frontend codebase..." presentation.
JavaScript
1
star
62

color-clock-html

Representing time as a hexadecimal color value.
CoffeeScript
1
star
63

java-regex-tester-applet

A simple regular expression tester applet.
Java
1
star