Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Testing the front end

Debra Willrett edited this page Nov 1, 2017 · 22 revisions

Running the tests

Unit Tests

Tests are written in Jasmine and run with the Karma test runner.

To avoid Google Analytics errors while running Karma tests the value of analyticsKey in the tracking-service.conf.json file should be the string false.

To run the tests:

npm test

To have karma watch for changes:

$ karma start

End-to-end (e2e) Tests

e2e tests use Protractor. To run them, make sure you are on node version 6. Then install dependencies:

$ npm node 6    (if you need to update it)

$ npm install

$ npm install gulp -g

$ npm install protractor -g

$ webdriver-manager update

To run the tests:

$ webdriver-manager start

Now open another terminal window. Make sure you gulp first before running e2e the first time.

$ gulp

Then you can run the e2e tests from gulp:

$ gulp e2e

To run the tests against a different server backend:

  1. Edit bash_profile setting CEDAR_FRONTEND_TARGET to "local" or "staging":

    export CEDAR_FRONTEND_TARGET="local"
    export CEDAR_FRONTEND_TARGET="staging"
    
  2. Edit app/keycloak.json setting auth-server-url to local server or staging server:

    "auth-server-url": "https://auth.metadatacenter.orgx/auth"
    "auth-server-url": "https://auth.staging.metadatacenter.org/auth"
    

Take a look at the following links for more information about writing tests for Protractor:

http://ramonvictor.github.io/protractor/slides/#/1

http://www.protractortest.org/#/

Clone this wiki locally