Table of contents

After running the example project, it is time to add UI tests to your own plugin. We are starting with a minimal example.

1. Required directory structure

Add the following directories to your plugin (<project root>/src/test/ should already exist):

<project root>/
 └── src/
      └── test/
           └── ui-tests/
                ├── specs/
                |    └── common/
                └── page-objects/

2. Configuration files

For adding required resources and configuring the protractor UI tests, you need to add the package.json (project-root/) and a protractorConfig.js (project-root/src/test/ui-tests/).

You can just copy the files from the random page sources and change your project attributes (name, description, etc) in the package.json

(question) If you already have package.json, extend it with the 'devDependencies' and 'scripts'. 

3. Plugin installation spec

For you very first spec you may start by uploading your plugin via UI test. Therefore copy the uploadPlugin.spec.js (project-root/src/test/ui-tests/specs/common/) into your project and change the plugin information, meaning 'artifact id' and 'plugin name' (can be found in the pom.xml).

(warning) If you do not bundle an *.obr file, changes it to *.jar

var mavenVersion = universalPluginManager.parseMavenVersionFromPom();
// "randompage" -> plugin <artifactId> from pom.xml
var pluginPath = "./target/randompage-" + mavenVersion + ".obr";
// "Random Page" -> plugin <name> from pom.xml
universalPluginManager.uploadPlugin("Random Page", pluginPath, PLUGIN_UPLOAD_TIMEOUT);

As you only provide one spec file, remove the other specs in the protractorConfig.js 

specs: [

4. Run UI test

Your directory structure should now look like this

<project root>/
 ├── src/
 |     └── test/
 |          └── ui-tests/
 |               ├── specs/
 |               |    └── common/
 |               |         └── uploadPlugin.spec.js
 |               ├── page-objects/
 |               └── protractorConfig.js
 └── package.json

Do as documented here: Requirements

Make sure you've built the plugin before (atlas-package)

You should see a browser, where 'admin' logs-in and uploads your plugin

(tick) Congratulations you've successfully installed UI tests in your project

5. Next steps

After installing your plugin you have two options

If you want further information about the package.json and the protractorConfig.js, have a look at Part 2: Infrastructure.

If you want to implement your tests in TypeScript, see Part 6: Implementing in TypeScript first.

  • No labels

This content was last updated on 02/19/2018.

This content hasn't been updated in a while. That doesn't have to be a problem. Some of our pages live for years without becoming obsolete. Please click this link if you want us to update this page. Old content can be incorrect, misleading or outdated. Please get in contact with us via a form on this page, our live chat or via email with if you are in doubt, have a question, suggestion, or want changes from us.