Implement beforeUITests similar to what Hilary already has that will be used by the UI to run CasperJS tests

@bp323 A lot of this seems like copy-paste from `beforeTests.js`, but almost all of it can be grouped together into an API that is callable from `beforeTests.js` and `beforeUITests.js`. Lets try and reduce duplication as much as possible.