casper-flow

Expressive end-to-end testing with casperjs

npm install casper-flow
1 downloads in the last week
6 downloads in the last month

Casper-flow

An extension for casperjs workflow. It was developed as tool for end-to-end integration testing of large-scale web-application Gingko App.

Features:

  • intuitive jQuery-like API
  • powerful expectations with chai
  • extensibility, create your high-level utilities to test whatever you need
  • useful build-in modules: location, console, localStorage
  • easy development workflow: display browser's console.log, do screenshots on error, and etc
  • full access to reach set of casperjs methods

Installation

$ npm install casper-flow --save-dev

Also casper-flow uses casperjs 1.1.0-beta2, you can install it with: brew install casperjs --devel

Example

Assume you have scenario example/gingko-hyperloop.js to browse hyperloop's tree.

flow.use(require('./casper-helper'));

You can run it so:

$ casperjs test example/gingko-hyperloop.js

Core API

Globals: flow, describe, next.

flow.describe(desc, cb)

flow.next(desc, cb)

flow.get(key)

flow.set(key, value)

flow.open(url, [cb, ...args])

flow.error(message)

flow.expect(target)

flow.chai

Access to internal chai instance uses by flow. It helps:

  • define new assertions
  • get access to assert, should and use them
  • use plugins with chai.use

flow.$

$(selector)

$.click(selector, [desc], [cb])

$.type

$.keypress

Built-in Modules

flow.location

flow.localStrorage

Use flow.proxy, to implement modules like location and localStrorage.

Development

Make sure you have node >= 0.10, and pahntomjs, clone and run:

$ npm install && npm test

License

Aleksey Kulikov, MIT.

npm loves you