• This repository has been archived on 16/Jul/2019
  • Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 6 years ago

Reviews

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

Repository Details

Visual regression testing framework, comparing screenshots from multiple builds

Kobold

Visual regression testing framework, comparing screenshots from multiple builds.

Build Status Coveralls Coverage Code Climate Grade

NPM version NPM License

NPM NPM

Coverage Report API Documentation

Gitter Support

Table of Contents

##Installation

Install this module with the following command:

npm install kobold

Install this module globally with the following command:

npm install -g kobold

This will make sure that you don't have to enter the whole path when running Kobold.

Add the module to your package.json dependencies:

npm install --save kobold

Add the module to your package.json dev-dependencies:

npm install --save-dev kobold

##Getting Started

Kobold can be executed by running kobold script in the bin directory of the package. When you installed the module globally, then you can us only kobold to run it.

Only one parameter is required to run the tests:

kobold test/ui/regression

With this parameter, Kobold starts running tests on the test/ui/regression directory. It analyzes what screens were already approved, what screens are available in the current build, and what screens it has to compare. Then, it creates the test-code and executes the image-comparison, creating the test results in the highlight directory.

Instead of implicitly using the last argument for the test-path, you can also be more specific and supply the --test-path parameter:

kobold --test-path test/ui/regression

By default, Kobold will look for four directories:

  • approved - All approved screens should be available in this folder. These are the "golden standard" images that will be used to compare them to build screens.
  • build - Screens that were just taken are saved in this folder. This is most likely done by some Selenium tests, taking screenshots and saving them in this directory. These images will be compared to the images in the approved folder, creating comparison result images in highlight.
  • highlight - Image comparison results of the latest test-run are saved in this folder. These images will highlight the differences between the approved-image and the build-image.
  • config - Custom configuration files (.js or .json) for image specific comparison options. Sometimes, it is helpful to tune the comparison of a specific image. These options overwrite globally set comparison options. They are also optional. See the Blink-Diff Project WebSite for more information on these options.

The folder names for approved, build, highlight, and config can be changed by supplying the parameters --approved-folder, --build-folder, --highlight-folder, and --config-folder respectively:

kobold --approved-folder "golden" --highlight-folder "differences" /test/ui/regression

This test-run will look for golden and differences for the approved and highlight folder respectively instead of using the default folder names. In this specific case, build was not changed.

Sometimes, you want the tests to fail when previously approved screens are missing from the build directory. This can be the case when for example the tests that created these screenshots didn't fully run. Use the --fail-orphans flag to make these tests fail:

kobold --fail-orphans test/ui/regression

The --fail-additions flag will fail tests for screens that are new, screens that were never approved before.

kobold --fail-orphans --fail-additions test/ui/regression

Kobold also supports all Mocha parameters which can be interspersed with the Kobold parameters:

kobold --slow 3000 --fail-orphans --fail-additions --reporter dot --test-path test/ui/regression

##Command-Line Since Kobold is built on top of Mocha, it supports all of its parameters in addition to the following:

  • approved-folder - Name of the approved folder (default: 'approved')
  • build-folder - Name of the build folder (default: 'build')
  • highlight-folder - Name of the highlight folder (default: 'highlight')
  • config-folder - Name of the config folder (default: 'config')
  • fail-orphans - Flag that determines that tests should fail when screens that were previously approved, being in the approve folder, are not found in the build folder.
  • fail-additions - Flag that determines that tests should fail when unapproved screens are found in the build folder, meaning screens that are missing from the approve folder.
  • test-path - Path to directory with all test related folders as mentioned above (required). Uses implicitly the last parameter element when none is given.
  • config - Path to a config file (.js or .json) that is used to overwrite comparison options. (default: none) See the Blink-Diff Project WebSite for more information on these options.

##Configuration The global configuration file that can be selected by supplying --config to the command-line describes default-values for the comparison.

Here is an example of the file (config.js - can also be a JSON file):

module.exports = {
	"delta": 35 // Changing the distance of pixel-comparison
};

This file then can be called as follows:

kobold --config config.js test/ui/regression

Configuration files for specific screens on the other hand describe only the comparison options for that screen. Here is an example for a screen that is named "YDN_Missing"; the path is config/YDN_Missing.json (could also be a .js):

{
	"outputBackgroundOpacity": 0.3,
	"outputBackgroundGreen": 100
}

This example will make the background for the comparison image look greener, and lightens-up the whole comparison by reducing the opacity of the background-mask.

##Examples Kobold creates a regular test report as if the tests were manually written, and it also creates the following images, comparing the approved (left) with the build screenshot (right), pointing out the differences (middle).

  • Changed color Screen1
  • Missing items Screen2
  • Messed-up sorting Screen3
  • Image swap Screen4
  • Text formatting Screen4

These examples can be found in the examples folder. The above results were produced by running the following command in the project root with a globally installed Kobold:

kobold test/ui/regression

##API-Documentation

Generate the API-documentation with following command:

npm run docs

This will generate the source-code documentation in the docs folder of the module root.

##Tests

Run the tests with the following command:

npm run test

The code-coverage will be written to the coverage folder in the module root.

##Project Name A Kobold is a gnome that can make itself invisible and is often the source of nuisances - so, pretty much like visual regressions.

##Third-party libraries

The following third-party libraries are used by this module:

###Dependencies

###Dev-Dependencies

##License

The MIT License

Copyright 2014 Yahoo Inc.

More Repositories

1

anthelion

Anthelion is a plugin for Apache Nutch to crawl semantic annotations within HTML pages.
Java
2,841
star
2

mojito

[archiving soon] Yahoo! Mojito Framework
JavaScript
1,570
star
3

boomerang

End user oriented web performance testing and beaconing
JavaScript
1,182
star
4

xss-filters

Secure XSS Filters.
JavaScript
1,079
star
5

flux-examples

Isomorphic Flux examples with Fluxible
1,073
star
6

YangMingShan

YangMingShan is a collection of iOS UI components that we created while building Yahoo apps.
Objective-C
641
star
7

samoa

SAMOA (Scalable Advanced Massive Online Analysis) is an open-source platform for mining big data streams.
Java
426
star
8

dispatchr

A Flux dispatcher for applications that run on the server and the client.
385
star
9

oozie

Oozie - workflow engine for Hadoop
Java
375
star
10

android-range-seek-bar

It provides a SeekBar similar to the default Android one, but with two thumb controls allowing a range to be selected, and some other extras as well.
Java
345
star
11

omid

Transactional Support for HBase (Mirror of https://github.com/apache/incubator-omid)
Java
301
star
12

strip-loader

Webpack loader to strip arbitrary functions out of your production code.
JavaScript
282
star
13

express-state

Share configuration and state data of an Express app with the client-side via JavaScript.
JavaScript
247
star
14

flux-router-component

[DEPRECATED] React components and mixins for router related features that work for applications with Fluxible architecture
JavaScript
247
star
15

end-to-end

Use OpenPGP-based encryption in Yahoo mail.
JavaScript
223
star
16

swiv

For the open source UI formerly know as Pivot
TypeScript
167
star
17

Optimal-LSH

This package provides an efficient implementation of locality-sensitve hashing (LSH)
MATLAB
150
star
18

ygloo-ymagine

[archiving soon]
C
140
star
19

rtrace

Rtrace is an x86/x86_64 native code debugger written in Ruby with zero dependencies
Ruby
139
star
20

yos-social-objc

[dormant] Yahoo! Social SDK, an Objective-C library for Mac and iPhone developers.
Objective-C
110
star
21

coname

An experimental cooperative keyserver based on ideas from dename.
Go
107
star
22

crow

Cross-dimensional weighting for aggregated deep convolutional features.
Python
105
star
23

fluxible-router

MOVED TO FLUXIBLE REPO
104
star
24

pngjs-image

JavaScript-based PNG image encoder, decoder, and manipulator
JavaScript
93
star
25

mendel

A build toolchain for experimentation on isomorphic web applications with tree-inheritance and multivariate support.
JavaScript
88
star
26

daytona

An application-agnostic framework for automated performance testing and analysis.
PHP
80
star
27

howl

Common metadata layer for Hadoop's Map Reduce, Pig, and Hive
Java
78
star
28

yos-social-php5

[dormant] Yahoo! Social SDK - PHP5 library
PHP
76
star
29

ypromise

An ES6 Promise polyfill
JavaScript
73
star
30

cronshot

Node module to schedule, take, alter, and store web page screenshots.
JavaScript
69
star
31

yos-social-php

[dormant] Yahoo! Social SDK - PHP library
PHP
68
star
32

yos-social-python

[dormant] Python SDK
Python
62
star
33

gondola

High-performance Raft-based Java Web Container
Java
61
star
34

PyIOCe

Python IOC Editor
Python
60
star
35

Pluton

C++
58
star
36

YaraParser

Yara K-Beam Arc-Eager Dependency Parser
Java
55
star
37

fake-server

Fake-server is a generic and non-intrusive tool used to mock any server response. It has been designed to address issues when running tests against unstable or slow external servers.
JavaScript
54
star
38

csptester

A quick and easy way to test CSP behavior on modern browsers
HTML
49
star
39

storage-lru

An LRU cache to be used with pluggable storage mechanism
JavaScript
47
star
40

messenger-sdk-php

PHP SDK for Yahoo! Messenger API
PHP
46
star
41

secure-handlebars

Handlebars Context Pre-compiler
JavaScript
45
star
42

fs-lock

File restrictions in Node.js
JavaScript
41
star
43

html-purify

HTML5 Purify
HTML
40
star
44

scrollable

React Scrollable
JavaScript
40
star
45

YMPromptKit

YMPromptKit
Objective-C
36
star
46

simplified-lambda

Java
36
star
47

fluxible-plugin-routr

[DEPRECATED] A plugin for fluxible applications to provide routing methods
JavaScript
33
star
48

messenger-sdk

Yahoo! Messenger API SDK
Java
30
star
49

process-watcher

Launch and control your NodeJS processes.
JavaScript
29
star
50

filelogger

filelogger monitors files and sends a copy of every new line to a local or remote syslog
C
28
star
51

mojito-shaker

[archiving soon] Static asset rollup manager for Mojito applications.
JavaScript
27
star
52

locator

A node module that gives semantic meaning to filesystem paths.
JavaScript
24
star
53

mockaccino

A simple Node (and Express.js) server to quickly mock web services responses.
JavaScript
24
star
54

cnet

A wrapper around the Chromium HTTP network stack.
C++
21
star
55

pipr

Tool to pip install missing imports and more
Python
20
star
56

http-filters

Filters for HTTP requests
C++
20
star
57

ACT

ACT.js - Advertising Creative Technology library.
JavaScript
19
star
58

artifactory_ssh_proxy

An ssh proxy for Artifactory
Java
18
star
59

firefoxos-webbing

A template to package web apps for Firefox OS.
JavaScript
18
star
60

xpath_proto_builder

xpath_proto_builder is a library to convert objects (JSON, XML, POJO) into protobuf using xpath notation.
Java
18
star
61

express-yui

Express extension for YUI Applications.
JavaScript
17
star
62

yos-social-java

[dormant] YOS SDK for Java
Java
17
star
63

guerilla

Guerilla is a distributed build/test server specialized for iOS and Android.
JavaScript
17
star
64

spartan

A Scalable Client Authentication & Authorization System for Container-based Environments
JavaScript
17
star
65

Sparkle

Objective-C
16
star
66

express-combo

Combo handler for express applications.
JavaScript
15
star
67

express-secure-handlebars

Express with Secure Handlebars
JavaScript
13
star
68

express-map

Assembles an Express app's route configuration for sharing with the client side via JavaScript.
JavaScript
12
star
69

CocoaSanitizer

A suite of dynamic analysis tools to find bugs at design time. The tools leverage the Objective-C runtime, to look for common anti-patterns which can lead to crashes.
Objective-C
12
star
70

css-js

CSS Parser
JavaScript
11
star
71

express-annotations

Module to augment Express routes with metadata.
JavaScript
11
star
72

node-restrict

Nodejs module that blocks applications from using procss.binding('process_wrap'), process.kill and child_process methods.
JavaScript
11
star
73

extractify

Browserify plugin to extract code to be lazy loaded into separate bundles
JavaScript
10
star
74

bossmashup

Mashup library for Yahoo! Search BOSS
10
star
75

Openstack-EC2

Python
10
star
76

druid-extensions

This repository holds a number of extensions to Druid that we have created at Yahoo.
Java
10
star
77

keyshop

Stub keyserver for the End-to-End extension
Go
9
star
78

formality-classifier

A Python library to predict the formality level of text.
Python
9
star
79

mojito-pipeline

[archiving soon] A rendering scheduler and streamer for Mojito webapps
JavaScript
9
star
80

FlowEtl

This is a framework designed for the creation of testable components which can be interconnected via arbitrary inputs and outputs and those components can be executed in the correct order (inputs satisfied before running) automatically. This is useful since it aids developers in thinking in the paradigm where they plan components ahead of time, allowing for simpler reuse and refactoring later. At yahoo! this was created for a ETL like framework & pipeline, but its applications are not limited to solely that, since the concept itself is generic.
Java
9
star
81

yos-social-as3

[dormant] Yahoo! Social SDK, an ActionScript 3 library for Flash and AIR
ActionScript
9
star
82

locator-handlebars

Handlebars template compiler for locator
JavaScript
7
star
83

yupdates-wordpress

Posts a Yahoo! Update to your connections when you update your WordPress blog.
PHP
7
star
84

metafs

MetaFS is for generating a datastore of file metadata for rapid complex searches
Python
7
star
85

viper

Viper is a utility that returns a live host from a list of host names.
Java
7
star
86

yamall

PLSQL
6
star
87

openstack-ops-tools

Operational tools and utilities for managing openstack
Python
6
star
88

imlost-Android

Random Hack for Kindness project
Java
6
star
89

secure-handlebars-helpers

secure-handlebars-helpers
JavaScript
5
star
90

Image-Builder

Python
5
star
91

node-xlog

JavaScript
5
star
92

locator-lang

Locator plugin to compile language bundles
JavaScript
4
star
93

zeus

Configuration Compiler
C++
4
star
94

memcached-binary

Binary Memcached client for Node.js
JavaScript
4
star
95

cronshot-local

JavaScript
4
star
96

mojito-jscheck

[archiving soon]
JavaScript
4
star
97

mojito-markup-test

[archiving soon]
JavaScript
4
star
98

mojito-rs-hotswap

[archiving soon] Hotswap plugin for Mojito's Resource Store
JavaScript
4
star
99

ygloo

[archiving soon]
4
star
100

yos-social-demo-dotnet

[dormant] A sample implementation of Hybrid OAuth and YQL in .Net
C#
4
star