Skip to content

Running End to End Tests for Jazz UI

Satish Malireddi edited this page Nov 13, 2018 · 1 revision

We use Protractor for running UI end-to-end tests. Protractor is an end-to-end test framework for Angular and AngularJS applications. Read more about Protractor here.

Setup Protractor

Protractor being a Node.js program can be installed easily using npm. Follow these instructions to install it in your machine. Or, execute these commands locally.

npm install -g protractor
webdriver-manager update
webdriver-manager start

This will start up a Selenium Server locally. Your Protractor test will send requests to this server to control a local browser. You can see information about the status of the server here.

Getting UI code ready

Jazz UI code is located in core/jazz_ui folder. To get the code,

  1. Clone jazz repository from Github

    git clone https://github.com/tmobile/jazz.git
  2. Go to the folder that contains angular code

    cd jazz/core/jazz_ui
  3. Install the dependencies for the project

    npm install

Writing Tests

Jazz comes with set of automation tests that you can run on your stack. They are located at jazz/core/jazz_ui/e2e folder. You can add more tests to this location and have protractor run them as part of the test suite. Existing tests follow naming convention -spec.ts, you can follow the same convention to run your new tests along with the existing test suite.

Configurations

  1. protractor.conf.js: This configuration tells Protractor where your test files (specs) are, and where to talk to your Selenium Server (seleniumAddress). It will use the defaults for all other configuration. Chrome is the default browser. This can be located at jazz/core/jazz_ui/protractor.conf.js in this project.

  2. configuration.ts: This file contains Jazz specific configurations. Default (blank) template is provided already. This can be located at jazz/core/jazz_ui/src/config/configuration.ts in this project. Update this file with information specific to your Jazz stack. Example below -

        e2e: {
            "EMAIL_ID": "", // Your email id - optional field
            "USER_NAME": "JazzAdmin",  // Any registered username for Jazz application
            "PASSWORD": "", // Password for the username above
            "REG_USER_NAME": "", // Username to use for Jazz registration
            "REG_PASS_WORD": "", // Password to use for the username above
            "REG_CODE": "", // Jazz registration code to use
            "APPLN_URL": "" // Jazz Application Url
        }
    

Running Tests

You are all set! Run the test suite in the location - jazz/core/jazz_ui/ using the command below -

protractor protractor.conf.js