Inject test scripts with casperjs

This allows us to remove test-specific code from main.js