Feature/2177 make phantom js work for headless tests

Hi @aronasorman - here's the PR for ongoing work on #2177 - unit tests work on the `student_testing` and `control_panel` apps and still working on the others.

Here's the [github gist](https://gist.github.com/cpauya/62b2c46fa467ff0e77f0) detailing the work done so far.

Please note that this is still a WIP. :)
Why is this not working on headless?