How to run tests

Please make sure you read and installed all the projects as described in the Installing section.

CLA Backend tests

This is a standard Django project so you can run unit tests using:

source env/bin/activate

./manage.py test

CLA Frontend tests

Django unit tests

This is a standard Django project so you can run unit tests using:

source env/bin/activate

./manage.py test

Js unit tests

There are a few js karma tests that you can run without the backend/frontend server. Just cd into cla_frontend and run:

npm test

Js e2e tests

In order for these tests to work, you need:

1. Backend testserver running

    cd cla_backend
source env/bin/activate

python manage.py testserver initial_groups.json kb_from_knowledgebase.json initial_category.json test_provider.json initial_mattertype.json test_auth_clients.json initial_media_codes.json test_rotas.json test_casearchived.json test_providercases.json test_provider_allocations.json --noinput --settings=cla_backend.settings.testing

2. Frontend server running

cd cla_frontend
source env/bin/activate

python manage.py runserver 8001

Now you can run the e2e tests using:

npm run protractor

Troubleshooting common errors

If some tests fail:

  1. If postcode related, make sure that your frontend local.py has the ADDRESSFINDER_API_* values set
  2. If too many login attempts, just reload your backend testserver and try again