Code Monkey home page Code Monkey logo

needler's Introduction

needler

Needler is a visual diff test suite runner for needle.

By providing needler a YAML config defining the pages and components you wish to visually assert on.

Note: This project is still in development and not yet released, please use at your own risk.

Installing

git clone https://github.com/underdogio/needler
cd ./needler
python setup.py install

Along with installing needler you will have to manually install any browser, or diffing software that you will need (e.g. perceptualdiff, phantomjs, etc).

CLI Interface

$ needler --help
usage: Needler [-h] [-c CONFIG] [-b] [-d BASELINE_DIRECTORY]
               [-o OUTPUT_DIRECTORY] [-j]

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -c CONFIG, --config CONFIG
  -b, --baseline
  -d BASELINE_DIRECTORY, --baseline-directory BASELINE_DIRECTORY
  -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
  -j, --json

Example

Given the following config file.

# needler.yaml
cases:
  homepage:
    url: 'http://localhost:5000/'
    components:
      content: '.content'
      header: '.header'
      footer: '.footer'
# Collect the baseline images for testing
#   This will run all the cases and save the output images
#   to use as the baseline for assertions
needler --baseline

# Run the test cases and assert they are the
# same as the baseline images
needler

Config file

The needler.yaml config file is used to tell needler which test cases it should generate and how to run them.

# needler.yaml
driver: firefox
engine: perceptualdiff
sizes:
  extra_large: 1440x809
  large: 1024x575
  medium: 768x1024
  small: 530x946
cases:
  homepage:
    url: 'http://localhost:5000/'
    components:
      header: '.header'
      footer: '.footer'

The above example will tell needler to use the firefox driver, and the perceptualdiff command to test the image differences.

As well, it will generate 8 test cases, one for each case/component/size combination:

  • homepage_header_extra_large
  • homepage_header_large
  • homepage_header_medium
  • homepage_header_small.
  • homepage_footer_extra_large
  • homepage_footer_large
  • homepage_footer_medium
  • homepage_footer_small.

needler's People

Contributors

brettlangdon avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.