Pure-Javascript Demo Recorder and Integration Testing Suite
Last updated 7 years ago by mikesmullin .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install choreography 
SYNC missed versions from official npm registry.


As seen on YouTube.

Inspired by Selenium, Capybara, Zombie.js, Jasmine, Mocha, Chai and Syn.js.


npm install choreography

Using the Recorder

# symlink the static html+js assets to a public-facing
# subdirectory within your application
ln -s node_modules/choreography public/test
# then browse to the demo recorder
# replace /debug/slides with the actual url of your app you want to test
# note that it must be on the same domain and port for security reasons
google-chrome http://localhost:3000/test/recorder.html#/debug/slides

Using the Integration Tester

Make a view like this (haml example):

- content_for :head do
  = stylesheet_link_tag "test/suite", :media => 'all'
  = javascript_include_tag "test/suite"


= javascript_include_tag "test/specs"

The test/suite stylesheet just includes the mocha styles (example in scss+sprockets)

//= require node_modules/choreography/node_modules/mocha/mocha

The test/suite javascript looks like this (coffee+sprockets):

#= require node_modules/choreography/node_modules/mocha/mocha
#= require node_modules/choreography/node_modules/chai/chai
#= require node_modules/choreography/node_modules/async2/coffee/async2
#= require node_modules/choreography/vendor/syn
#= require_self

  ui: 'bdd'
  timeout: 1000*60*5 # 5 min
  globals: [

The test/specs javascript looks like this (coffee+sprockets):

#= require node_modules/choreography/coffee/actor
#= require node_modules/choreography/coffee/browser
#= require_tree ./mock/
#= require_tree ./unit/
#= require_tree ./integration/
#= require_self

Where the ./integration/ folder contains a bunch of *_spec.js files which get aggregated together by those sprockets directives into that single specs.js file.

Inside each spec is a mocha test which looks like this (in coffee);

assert = chai.assert
window.frame = undefined

describe 'Slides', ->

  beforeEach (done) ->
      '<iframe name="iframe-fixtures" name="fixtures" style="width:98%;height:50%;position:fixed;left:1%;bottom:0;border:none;border-top:3px double #333"/>')
        window.frame = window.frames['iframe-fixtures']
      .attr('src', '/debug/slides')
    ).css('padding-bottom', jQuery('iframe[name=iframe-fixtures]').height()+20+'px')

    it 'can complete blue slider sliide', (done) ->
      (new actor)
        .select('#slides', 'modules/01/_11e')
        .read('h2#slide-title', 'Are you listening?')
        .within(20000).drag('div.handle-blue:eq(0)', '724X143')
        .within(10000).drag('div.handle-blue:eq(1)', '731X220')
        .within(10000).drag('div.handle-blue:eq(2)', '616X328')

Where /debug/slides again is the url you want to test in the iframe.

Of course, that's a lot of setup. Will improve with time.

Useful documentation

Syn.js API Reference

Syn is the library that powers the click, drag, keystroke recording and playback.

Zombie.js Browser API Reference

Our Browser class sort of resembles the one from zombie.js.


Current Tags

  • 0.1.1                                ...           latest (7 years ago)

2 Versions

  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (0)
Dependents (2)

Copyright 2014 - 2016 © |