title: using mocha-phantomjs to automate functional testing
body: <p>My project is using: Node, Coffeescript, SocketIO, Browserify and Mocha. (mocha for standard server-side unit tests)</p>
  
  <p>I would like to automate some client-side interface testing using a headless browser. PhantomJS looked like the ideal choice (picked over Zombie due to web socket support).</p>
  
  <p>The PhantomJS pages warn it is not a test runner, which I understand, and they recommend using the <a href="https://github.com/metaskills/mocha-phantomjs">mocha-phantomjs</a> project to drive your tests.</p>
  
  <p>So I've been able to get the sample tests running (e.g. <code>mocha-phantomjs tests/mixed.html</code>), but my current problem is actually using PHANTOM within the tests. All the sample tests in the mocha-phantomjs repo seem to use standard mocha server-side unit test.</p>
  
  <p>e.g. I can easily run <code>mocha-phantomjs tests/mixed.html</code> to view boring old unit tests. Or I can run <code>phantomjs tests/login.coffee</code> to load up my login screen... but how do I combine the two to make assertions on what I should expect to see on my login screen?</p>
  
  <p>I can't find any examples of this on the web, and I'm struggling with understanding the best way to go about this.</p>
  
  <p>Hope this all makes sense. Thanks in advance for any assistance.</p>
  
  <p><strong>UPDATE</strong>: I found the following suggestion by the author (<a href="https://github.com/metaskills/mocha-phantomjs/issues/18">here</a>), but I don't really understand exactly what to do with it: <code>phantomjs lib/mocha-phantomjs.coffee test/mixed.html</code></p>