GithubHelp home page GithubHelp logo

grunt-phantomflow's Introduction

grunt-phantomflow

A grunt plugin for PhantomFlow

Grunt

Basics

This plugin requires Grunt ~0.4.2

If you are unfamilar with Grunt check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins.

npm install grunt-phantomflow --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-phantomflow');

Setup

grunt.config.set('phantomflow', {
	app: {
		/*
			How many threads would you like to parallelise on?
			Default value is 4
		*/
		threads: 4

		/*
			Any command line options to be passed down to casper?
			Example: ['--cookies-file=testcookies.txt']
			Default value is []
		*/
		casperArgs: [],

		/*
			Should a report/visualisation be generated after
			the test run? Default value is false
		*/
		createReport: false,

		/*
			Should the report output live somewhere else, e.g. for
			proxying through a real webserver?
			Example: '../visualtest/htdocs'
			Default value is undefined.
			If unset, the default set by PhantomFlow will be used.
		*/
		reports: null,
		
		/*
			Do you have scripts to include?
			Default value is ./include
		*/
		includes: './include',
		
		/*
			Where do the tests live?
			Default value is ./test
		*/
		tests: './test',
		
		/*
			Where should the results go?
			Default value is ./test-results
		*/
		results: './test-results',
		
		/*
			Hide elements in the page
		*/
		hideElements: ['img', 'input']
	}
});

Command line parameters

Running a specific test

If you're working on a test you can use the test parameter to run a specific test file. The value can be a substring of the file name. Please note that test filenames should follow the *.test.js naming convention.

grunt phantomflow:websitetests --test=mytestfile

Reporting

To show the PhantomFlow visualisation use the 'report' param. You need to have previously generated a report by setting the createReport option to true. Tests will not be executed when the 'report' param is used. The previously generated visualisation will open in your browser.

grunt phantomflow:websitetests --report

Multithreading

By default phantomflow will divide and execute groups of tests concurrantly on different threads. By default this is 4 threads

Use the thread parameter to increase the amount of threads and reduce the feedback time.

grunt phantomflow:websitetests --threads=8

Debugging

Show more logging: grunt phantomflow:websitetests --debug=1

Save screenshots and show more logging: grunt phantomflow:websitetests --debug=2

By default phantomflow will not abort when a test fails, set the earlyexit parameter to true stop the tests upon seeing the first failure.

grunt phantomflow:websitetests --earlyexit=true

Remote debugging using Web Inspector.

PhantomJS supports remote debugging. The following grunt options allow you to start phantom with the correct options.

grunt.config.set('phantomflow', {
	app: {
		remoteDebug: true, // default false
		remoteDebugAutoStart: false, // default false,
		remoteDebugPort: 9000 // default 9000
	}
});

Overview

In your project's Gruntfile, use either grunt.initConfig( {} ) or grunt.config.set( 'phantomflow', {} ).

var phantomflowConfig = {
  test: {
    tests: '/mytests'
  },
  report: {} // this task is reserved for reporting only
};

grunt.initConfig({
  decision: phantomflowConfig
};

grunt-phantomflow's People

Contributors

istr avatar meltuhamy avatar teamon avatar

Watchers

 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.