HabitRPG/habitrpg — pull request #2396 by aughr (2014-01-14 06:12:15+00:00)
Title: Convert API tests to normal JS

In the process, I also ran into some other issues that I've addressed in the attached commits:

* The tests were loading static.js after app.js, so the habitrpg module definition in static.js was clobbering the main one. In other words, the tests weren't testing what they should have been testing. I changed the static.js module name to `habitrpgStatic` and updated the jade template to match.
* It looks like the symptom has been fixed on master, but when I started the tests weren't passing because some service code was looking for an object hanging off `$rootScope`. Finding dependencies is what dependency injection is for, so I added a new service wrapping window.habitrpgShared for use in non-view code.
* At least on my machine (maybe it's slower?), the `sleep 3` in `run_tests.sh` wasn't enough for selenium to start. I added a loop to wait (for up to 30 seconds) for it to answer on its port.

Finally, I translated the API tests into normal JS. There were a number of commented-out tests saying that they should be either rewritten to work or deleted, which I didn't convert under the assumption that they can be retrieved from git history if needed.

Any concerns? Also, what would be the appropriate forum to propose and discuss refactoring the test suite? I don't want to put too much time only to find out I was working under the wrong assumptions.