guardian/frontend — pull request #1493 by phamann (2013-09-01 23:04:12+00:00)
Title: Upgrade CasperJS to 1.1 and refactor tests

This merges in the work to upgrade CasperJS to [1.1](http://docs.casperjs.org/en/latest/upgrading/1.1.html) and change the Grunt task we use run the tests to the internally forked one that flexible-content use [grunt-casperjs](admin/app/views/fronts.scala.html).

### Notable changes:
- Set ```environment``` variable in the [Gruntfile.js](https://github.com/guardian/frontend/blob/fronts-admin-integration-tests/Gruntfile.js#L85)
- Use a [shared.js](https://github.com/guardian/frontend/blob/fronts-admin-integration-tests/integration-tests/casper/tests/shared.js) file to bootstrap each test spec. This defines the host domain from an ENV variable and good place to store common functions such as: ```clearLocalStorage();```
- Refactor all existing tests to use the new 1.1 API [example](https://github.com/guardian/frontend/blob/fronts-admin-integration-tests/integration-tests/casper/tests/admin/fronts.spec.js#L35)

### Things I learnt
- The new API is much nicer, and allows for such this as ```setUp``` & ```tearDown```
- We had the new version already installed but the old task wasn't pointing to the correct binary
- The error reporting is much nicer in the new version (i.e. it actually tells you want went wrong :wink:)

@stephanfowler it seems like a few changes admin related files have creeped into this PR, I don't know whether these where changes to make your test work or an accident, can you please check?

- admin/public/javascripts/modules/fronts/listManager.js
- admin/app/views/fronts.scala.html