Skip to content

Test Guidelines : Integration tests

Julian Descottes edited this page Jan 9, 2017 · 1 revision

Introduction

Integration tests are using CasperJS (documentation).

CasperJS allows to simulate some user inputs which we use to test our UI controllers. The primary goal of those tests is to cover dialog controllers and settings controllers.

Integration tests can be found in test/casperjs/integration.

They run on Travis CI for every commit.

How to run tests

Integration tests are run as part of the grunt test task. To run only integration tests, use the dedicated task grunt integration-test.

Tests are declared in /test/casperjs/integration/IntegrationSuite.js and run in the order defined in this file. To run a single test, temporarily modify this file to reduce the suite only to the test you want to run.

How to write a test

  • create a new test file following the same patterns as the ones that can be found in other tests
  • add the test to /test/casperjs/integration/IntegrationSuite.js
  • some shared helpers can be found in /test/casperjs/integration/include.js
  • if you need access to the content window, you need to use casper.evaluate() which takes a string/function as argument. When providing a function, keep in mind it will be stringified, so you can't access anything from the upper scope