Refactor UI test APIs

Refactored the UI test APIs:

- The UI APIs are used for creating users/groups/collabdocs/...
- Any JavaScript errors in the UI will be logged by CasperJS now, potentially giving more information about failing tests
- Exchange of information between UI and CasperJS happening through events
- More robust waiting for resources to get created
Same thing here. I would move the `waitFor` pattern into the utility function rather than the test. That means we could just have the following here:

```
discussionUtil().createDiscussion(null, null, function(discussionProfile) {
    // Test continues here
});
```